Vehicle end time service method and device and vehicle

By determining the time difference between the backup clock source and the master clock source, and selecting a switching strategy or making step-by-step adjustments to the timestamp messages, the problem of time rollback when GNSS signals fail is solved, a smooth transition of vehicle time synchronization is achieved, and the continuity of system time and the stability of log recording are ensured.

CN121806406APending Publication Date: 2026-04-07DEEPAL AUTOMOBILE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-07
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In existing technologies, when GNSS signals fail, the switching of vehicle time sources causes time rollback and system timing disorder, affecting the log recording function and the integrity of accident analysis data.

Method used

By determining the time difference between the backup clock source and the master clock source, a switching strategy is selected or a step-by-step adjustment of the timestamp messages is made to gradually bring the timestamp messages closer together, ensuring the synchronization of the system clock's timestamp messages and achieving a smooth transition. This allows the timestamp messages to gradually approach the master clock source, avoiding large time jumps.

Benefits of technology

It maintains the continuity and consistency of system time, avoids system timing disorder caused by sudden time changes, ensures the stable operation of the vehicle controller's logging function, and provides complete data support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121806406A_ABST
    Figure CN121806406A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of vehicles, and discloses a vehicle end time service method and device and a vehicle, and the method comprises the steps: judging whether the time difference between a standby clock source and a main clock source is within a preset range or not when the vehicle is switched from the standby clock source to the main clock source; if yes, switching to the master clock source as a system time source for timing, and outputting a timestamp message according to the master clock source; if not, the standby clock source serves as a system time source for timing, and timestamp messages output according to the standby clock source are accumulated or subtracted according to a preset step length, so that the timestamp messages are gradually close to the time of the main clock source until the time difference between the timestamp messages obtained through accumulation and the main clock source is within a preset range, and the time difference between the timestamp messages obtained through accumulation and the time difference between the timestamp messages obtained through accumulation and the time difference between the timestamp messages obtained through accumulation and the main clock source is within the preset range; the standby clock source comprises an RTC time component or an NTP time component, and the main clock source comprises a GNSS module. By applying the technical scheme of the invention, the problem of log function loss caused by time jump in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of vehicle technology, and specifically to a vehicle-side timing method, device, and vehicle. Background Technology

[0002] GNSS (Global Navigation Satellite System) time is the core high-precision master clock source, while NTP (Network Time Protocol) time and RTC (Real-Time Clock) time serve as backup clock sources when GNSS signals fail (such as in tunnels or underground parking garages), ensuring the continuity of the system's basic timing. However, due to technical limitations, NTP and RTC times inherently have errors that are difficult to eliminate: NTP time acquisition is easily affected by transmission architecture and network links, making high-precision synchronization impossible; RTC time, on the other hand, experiences long-term drift due to the physical characteristics of the crystal, making it difficult to maintain stable timing accuracy.

[0003] When a vehicle leaves an area blocked by GNSS signals, the system clock source needs to switch back from NTP / RTC time to GNSS time. The resulting error can cause a significant time jump. The vehicle controller's logging function has extremely high requirements for the sequential continuity of timestamps. This time jump directly disrupts the system timestamps, causing logging to be interrupted and preventing the retention of critical data such as vehicle operation and positioning status. In the event of a traffic accident, the missing log data will make it difficult to accurately trace and analyze the cause of the accident. Summary of the Invention

[0004] In view of the shortcomings of the prior art, the purpose of this application is to provide a vehicle-side timing method, device and vehicle, which aims to solve the problem of the lack of log function caused by time jump in the prior art.

[0005] In a first aspect, embodiments of this application provide a vehicle-side time synchronization method, comprising: in response to a vehicle switching from a backup clock source to a primary clock source, determining whether the time difference between the backup clock source and the primary clock source is within a preset range; if yes, switching to the primary clock source as the system time source for time synchronization, and outputting a timestamp message based on the primary clock source; if no, using the backup clock source as the system time source for time synchronization, and accumulating or subtracting the timestamp message output based on the backup clock source according to a preset step size, so that the timestamp message gradually approaches the time of the primary clock source, thereby controlling the time difference between the timestamp message and the primary clock source within a preset range.

[0006] In the above technical solution, by first determining the time difference between the backup clock source and the master clock source, and then selecting a switching strategy based on the time difference, significant time jumps during clock source switching are avoided. Even if there is a time deviation between the backup clock source and the master clock source, a smooth transition of the time base can be achieved through step-by-step adjustments to the timestamp messages, maintaining the continuity and consistency of system time and eliminating system timing disorder caused by sudden time changes. Furthermore, since the timestamp messages can gradually converge towards the master clock source time, there will be no timestamp backsliding or disorder. Therefore, the logging function of the vehicle controller can maintain stable operation and continuously retain key information such as vehicle operating status and positioning data. This effectively solves the problems of log interruption and missing accident analysis data caused by time jumps in traditional solutions, providing complete data support for subsequent fault tracing and quality analysis.

[0007] In one embodiment, the backup clock source includes an RTC time component or an NTP time component, and the main clock source includes a GNSS module. RTC time is obtained through the hardware clock module of the RTC time component, NTP time is obtained through the communication module of the NTP time component, and GNSS time is obtained through the GNSS module.

[0008] In the above technical solution, the GNSS module provides a high-precision primary time source, the NTP time of the communication module serves as a medium-precision backup source, and the RTC time of the hardware clock module serves as an emergency backup source. The system can automatically switch time sources according to the driving scenario, avoiding system timing disorder caused by the failure of a single time source and improving the adaptability of the timing system to complex vehicle operating conditions.

[0009] In one embodiment, the method further includes: controlling the communication module to wake up the vehicle-mounted timing device at a preset period, synchronizing the NTP time or the GNSS time obtained after wake-up to the RTC time, and calibrating the RTC time.

[0010] In the above technical solution, the deviation between the periodically calibrated RTC time and NTP and GNSS times is significantly reduced, and the time jump amplitude is significantly reduced when the system switches clock sources. On the one hand, this reduces the problem of system log recording interruption caused by time jumps, ensuring the traceability of key data throughout the driving process and providing complete data support for fault analysis and after-sales maintenance; on the other hand, it avoids interference from large time jumps on the execution of intelligent driving strategies, ensuring the timing alignment of perception data and the precise triggering of control commands, thereby improving the operational safety of intelligent driving functions.

[0011] In one embodiment, frequency offset compensation is performed on the hardware clock module based on the ambient temperature surrounding the hardware clock module.

[0012] In one embodiment, frequency offset compensation of the hardware clock module based on the ambient temperature surrounding the hardware clock module specifically includes: retrieving a pre-stored compensation coefficient based on the collected ambient temperature surrounding the hardware clock module, and dynamically correcting the crystal oscillation frequency of the hardware clock module based on the compensation coefficient; the compensation coefficient is determined based on the ambient temperature surrounding the hardware clock module and a mapping relationship, the mapping relationship being used to characterize the correspondence between the ambient temperature surrounding the hardware clock module and the compensation coefficient.

[0013] In the above technical solution, by collecting the ambient temperature around the hardware clock module and retrieving the pre-stored temperature-compensation coefficient mapping relationship, the crystal oscillation frequency of the hardware clock module is dynamically corrected, which can effectively offset the physical frequency deviation of the crystal at different temperatures and control the timing deviation of the hardware clock within a very small range.

[0014] Secondly, embodiments of this application provide a vehicle-side timing device, including a backup clock source, a master clock source, and a control element. The control element, in response to a vehicle switching from a backup clock source to a master clock source, determines whether the time difference between the backup clock source and the master clock source is within a preset range. If yes, it switches to the master clock source as the system time source for timing and outputs a timestamp message based on the master clock source. If no, it uses the backup clock source as the system time source for timing and accumulates or subtracts the timestamp message output based on the backup clock source according to a preset step size, so that the timestamp message gradually approaches the time of the master clock source until the time difference between the accumulated timestamp message and the master clock source is within a preset range. The backup clock source includes an RTC time component or an NTP time component, and the master clock source includes a GNSS module.

[0015] In the above technical solution, the control element first determines the time difference between the primary and backup clock sources before switching clock sources. Based on the magnitude of the difference, different switching strategies are selected: if the difference is within a preset range, switching occurs directly; if the difference exceeds the range, a smooth transition is achieved by incrementally adding or subtracting the timestamp messages of the backup clock source. This design abandons the traditional hard-switching mode, completely avoiding large time jumps during clock source switching. It not only solves the safety hazards of timing disorder and braking command delays in the intelligent driving controller, but also eliminates the log function interruption problem caused by timestamp disorder, ensuring the continuity of the underlying timing of the vehicle system.

[0016] In one embodiment, the RTC time component includes a hardware clock module and a temperature acquisition element connected to a control element. The hardware clock module acquires the RTC time, and the temperature acquisition element acquires the ambient temperature surrounding the hardware clock module. The control element retrieves a pre-stored compensation coefficient based on the acquired ambient temperature and dynamically corrects the crystal oscillation frequency of the hardware clock module according to the compensation coefficient. The compensation coefficient is determined based on the ambient temperature surrounding the hardware clock module and a mapping relationship, whereby the mapping relationship characterizes the correspondence between the ambient temperature surrounding the hardware clock module and the compensation coefficient.

[0017] In the above technical solution, the hardware clock module and temperature acquisition element are integrated into an RTC timing component and directly connected to the control element to form a closed-loop control unit for acquisition, calculation and compensation. The temperature acquisition element can capture the ambient temperature of the hardware clock module in real time, and the control element dynamically corrects the crystal oscillation frequency of the hardware clock module according to the pre-stored temperature-compensation coefficient mapping relationship, which can effectively offset the physical frequency deviation of the crystal at different temperatures and control the RTC timing deviation within a very small range.

[0018] In one embodiment, the NTP time component includes a communication module, through which NTP time is acquired; the communication module wakes up the vehicle-mounted timing device at a preset period, synchronizes the acquired NTP time or GNSS time to the RTC time, and calibrates the RTC time.

[0019] In the above technical solution, the communication module wakes up the timing device according to a preset cycle, and uses high-precision NTP time or GNSS time to periodically calibrate the RTC time, which can effectively offset the cumulative drift error of the RTC.

[0020] In one embodiment, the communication module and the control element transmit data via at least one of the following interfaces: SMI interface, SPI interface, SDIO interface, UART interface, and Ethernet interface.

[0021] In the above technical solution, the communication module, as the core of the NTP time component, can transmit time data with the control element through high-speed interfaces such as SMI, SPI, and SDIO. These interfaces have transmission rates far exceeding CANFD, and transmission latency can be controlled at the microsecond level, effectively eliminating errors caused by overlapping transmission cycles and significantly compressing the overall timing error of NTP time. This provides a higher-precision backup time reference for GNSS signal failure scenarios. Furthermore, by integrating the communication module as the core component of the NTP time component and directly interconnecting it with the control element, the complex transmission links across devices and buses inherent in traditional split architectures are eliminated, reducing interference and fault points when signals are forwarded between multiple devices.

[0022] In one embodiment, the GNSS module simultaneously outputs a PPS second pulse signal to the control element and the timing device, using the PPS second pulse signal as a time whole-second alignment reference to achieve whole-second synchronization between the control element and the timing device; the timing device is connected to the control element, receives the timestamp message output by the control element, and performs time synchronization based on the timestamp message.

[0023] In the above technical solution, using the PPS second pulse signal as a unified whole-second alignment reference can eliminate whole-second time deviations across devices, laying the foundation for subsequent sub-millisecond precise time synchronization and ensuring the consistency of the underlying time reference of multiple electronic components in the vehicle.

[0024] Thirdly, embodiments of this application provide a vehicle including the aforementioned vehicle-side timing device. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the background art, the accompanying drawings used in the embodiments of this application will be described below.

[0026] Figure 1 This is a schematic diagram of the vehicle structure disclosed in the embodiments of this application;

[0027] Figure 2 This is a schematic diagram of one embodiment of the vehicle-mounted timing device disclosed in this application.

[0028] Figure 3 This is a schematic diagram of another embodiment of the vehicle-mounted timing device disclosed in this application.

[0029] Figure 4 This is a flowchart illustrating the vehicle-side timing method disclosed in an embodiment of this application.

[0030] Explanation of reference numerals in the attached figures:

[0031] 10-Vehicle; 20-Vehicle-side timing device; 21-Backup clock source; 211-RTC time component; 2111-Hardware clock module; 2112-Temperature acquisition element; 212-NTP time component; 2121-Communication module; 22-Master clock source; 221-GNSS module; 23-Control element; 24-Conversion module; 30-Timing equipment. Detailed Implementation

[0032] The embodiments of this application are described below with reference to the accompanying drawings.

[0033] Please refer to Figure 1 , Figure 1This is a schematic diagram of the structure of a vehicle disclosed in an embodiment of this application. The vehicle 10 includes a vehicle-mounted timing device 20. The vehicle can be, but is not limited to, a pure electric vehicle (PEV / BEV), a hybrid electric vehicle (HEV), a range-extended electric vehicle (REEV), a plug-in hybrid electric vehicle (PHEV), a new energy vehicle, or a gasoline-powered vehicle.

[0034] In the field of vehicle technology, GNSS (Global Navigation Satellite System) time is the core high-precision master clock source, while NTP (Network Time Protocol) time and RTC (Real-Time Clock) time serve as backup clock sources when GNSS signals fail (such as in tunnels, underground parking garages, etc.), ensuring the continuity of the system's basic timing. However, due to technical limitations, NTP and RTC times inherently have errors that are difficult to eliminate: the acquisition of NTP time is easily affected by the transmission architecture and network links, making high-precision synchronization impossible; RTC time, on the other hand, experiences long-term drift due to the physical characteristics of the crystal, making it difficult to maintain stable timing accuracy.

[0035] Please refer to Figure 2 , Figure 2 This is a schematic diagram of one embodiment of the vehicle-mounted time synchronization device provided in this application. The vehicle-mounted time synchronization device 20 includes a backup clock source 21, a master clock source 22, and a control element 23. In response to a vehicle switching from the backup clock source 21 to the master clock source 22, the control element 23 determines whether the time difference between the backup clock source 21 and the master clock source 22 is within a preset range. If yes, it switches to the master clock source 22 as the system time source for time synchronization and outputs a timestamp message based on the master clock source. If no, it uses the backup clock source 21 as the system time source for time synchronization and accumulates or subtracts the timestamp message output based on the backup clock source 21 according to a preset step size, so that the timestamp message gradually approaches the time of the master clock source 22, thereby controlling the time difference between the timestamp message and the master clock source 22 within a preset range.

[0036] The backup clock source 21 includes an RTC time component 211 or an NTP time component 212, and the master clock source 22 includes a GNSS module 221.

[0037] The priority of time synchronization, from highest to lowest, is GNSS time, NTP time, and RTC time. At the moment the vehicle powers on, the GNSS module 221 has not yet completed satellite acquisition and positioning calculations, and the communication module 2121 of the NTP time component 212 has not completed network registration and NTP time synchronization; both are disconnected and cannot output a valid time reference. At this time, the control element 23 automatically selects the RTC time component 211 for time synchronization. As the vehicle continues to operate, if the control element 23 detects that both the GNSS module 221 and the NTP time component 212 are ready, it strictly follows the GNSS priority principle and directly switches to GNSS time synchronization. If only the NTP time component 212 is detected as ready, such as in scenarios where GNSS signals are completely blocked (e.g., underground parking garage), it switches to NTP time synchronization.

[0038] For example, the control element 23 is an MCU (Microcontroller Unit). An MCU is a single-chip microcomputer that integrates a central processing unit (CPU), read-only memory (ROM), random access memory (RAM), multiple I / O interfaces (such as SPI, UART, Ethernet interface, etc.) and timer / counter functional modules. It has the characteristics of small size, low power consumption, high integration and high cost performance, and can independently complete the specified control logic and data processing tasks.

[0039] In some embodiments, please refer to Figure 3 The RTC time component 211 includes a hardware clock module 2111 and a temperature acquisition element 2112 connected to the control element 23. The hardware clock module 2111 acquires the RTC time; the temperature acquisition element 2112 acquires the ambient temperature around the hardware clock module 2111. The control element 23 retrieves a pre-stored compensation coefficient based on the acquired ambient temperature around the hardware clock module, and dynamically corrects the crystal oscillation frequency of the hardware clock module 2111 according to the compensation coefficient. The compensation coefficient is determined based on the ambient temperature around the hardware clock module and a mapping relationship, which characterizes the correspondence between the ambient temperature around the hardware clock module and the compensation coefficient.

[0040] In complex scenarios where intelligent driving vehicles enter long tunnels or other areas where GNSS and network signals are completely blocked, the GNSS module 221 and NTP time component 212 of the vehicle-mounted timing device 20 will fail. At this time, the control element 23 can no longer obtain satellite or network time signals as a time reference and can only rely on the counter of the internal crystal oscillator of its own hardware clock module 2111 to accumulate and extrapolate time, thereby maintaining the normal operation of the system's timing function. However, the oscillation frequency of the crystal oscillator in the hardware clock module 2111 is easily affected by ambient temperature, resulting in frequency deviation. Under extreme high-temperature conditions, its frequency deviation can rise to ±40ppm. Based on a typical scenario where a vehicle continuously travels in a long tunnel for 15 minutes, according to the error calculation formula, error = running time × crystal ppm ÷ 10... 6 For example, when the crystal frequency offset rises to ±40ppm under extreme high-temperature conditions, the system timing will generate a cumulative time error of up to ±36ms. When the vehicle exits the tunnel and the GNSS positioning function is restored, the system timing clock source will switch from the time derived by the hardware clock module 2111 crystal back to the GNSS time. The ±36ms time difference between the two will cause a significant time jump. This time jump can easily cause a delay in the feedback of intelligent driving system control commands to the perception layer, resulting in a lag in vehicle braking response and significantly increasing the probability of driving accidents.

[0041] In this embodiment, by collecting the ambient temperature around the hardware clock module 2111 and retrieving the pre-stored temperature-compensation coefficient mapping relationship, the crystal oscillation frequency of the hardware clock module 2111 is dynamically corrected, which can effectively offset the physical frequency deviation of the crystal at different temperatures. As the physical frequency deviation of the crystal is reduced, the timing deviation of the hardware clock is controlled within a very small range, reducing the risk of time jump.

[0042] A high-precision digital temperature sensor, namely the temperature acquisition element 2112, is used to perform full-temperature compensation calibration of the crystal frequency offset, ensuring that the frequency offset of the crystal is controlled within ±5ppm within the full temperature range. This results in a maximum jump error of approximately ±5ms for the system clock source, improving the response speed of the intelligent driving perception layer by 81% and significantly enhancing intelligent driving safety.

[0043] In some embodiments, please refer to Figure 3 The NTP time component 212 includes a communication module 2121, through which NTP time is acquired; the communication module 2121 and the control element 23 transmit data through at least one of the following interfaces: SMI interface, SPI interface, SDIO interface, UART interface, and Ethernet interface.

[0044] In the prior art, the 4G module for acquiring NTP time, i.e., the communication module, and the vehicle-side timing device 20 are arranged separately. The 4G module and the vehicle-side timing device 20 are connected via CANFD communication. The initial NTP time accuracy acquired by the 4G module is ±100ms, which is then forwarded to the communication interface of the vehicle-side timing device 20 via CANFD communication with a transmission rate of 2M. The communication interface then transmits the data to the control element 23. Each frame of the message is 64 bytes, and the transmission time is about 300us, which can basically negligibly reduce the error. However, the transmission period of CANFD communication is 100ms. Therefore, the NTP time error received by the conventional vehicle-side timing device 20 is about ±200ms.

[0045] In this embodiment, the communication module 2121, as the core of the NTP time component, can transmit time data with the control element through high-speed interfaces such as SPI and SDIO. These interfaces have transmission rates far exceeding CANFD, and transmission delays can be controlled at the microsecond level, effectively eliminating errors caused by overlapping transmission cycles and significantly compressing the overall timing error of NTP time. This provides a more accurate backup time reference for GNSS signal failure scenarios. Furthermore, by integrating the communication module 2121 as the core component of the NTP time component and directly interconnecting it with the control element 23, the complex transmission links across devices and buses inherent in traditional split architectures are eliminated, reducing interference and fault points when signals are forwarded between multiple devices.

[0046] For example, the communication module 2121 is a 4G module, with an initial NTP time accuracy of ±100ms; it then forwards communication via an SMI interface with a transmission rate of 24MHz, meaning it can transmit 24×10^24 times per second. 6 Each NTP time data frame consists of 64 bytes, or 512 bits; one bit is transmitted per clock cycle, requiring a total of 512 clock cycles. The transmission time for each bit is 1 / (24 × 10^6)^2. 6 Since the time interval is approximately 41.67 ns, the theoretical total transmission time for 512 binary bits is 512 × 41.67 ns ≈ 21.33 μs. Compared to conventional CANFD communication connections, this significantly reduces NTP time error. 4G stands for 4th-Generation Mobile Communication Technology, a wireless communication technology system designed for high-speed data transmission, enabling stable wireless data interaction over a wide area.

[0047] By integrating a 4G module into the vehicle-side timing device and then using 24M high-speed SMI communication, the NTP time is synchronized to the RTC inside the module in real time, improving the NTP timing accuracy by 50% in scenarios without GNSS positioning. This also systematically solves the industry pain point of large RTC time deviation after long periods of dormancy and rest in traditional vehicle-side timing devices.

[0048] In some embodiments, the communication module 2121 wakes up the vehicle-mounted timing device 20 at a preset period, synchronizes the NTP time or GNSS time obtained after wake-up to the RTC time, and calibrates the RTC time.

[0049] In existing technologies, the RTC time accuracy is approximately ±12 seconds (based on ±20 ppm over 7 days). If the vehicle remains in a long-term sleep mode, the RTC time error will continue to accumulate. In this embodiment, the communication module 2121 wakes up the vehicle-side timing device 20 at a preset cycle and uses high-precision NTP or GNSS time to periodically calibrate the RTC time, which can effectively offset the accumulated drift error of the RTC.

[0050] For example, after temperature compensation correction, the time accuracy of the RTC time component 211 is ±3s (calculated as ±5ppm over 7 days). However, after integrating the communication module 2121, it is set to wake up every 5 minutes. Through the wake-up mechanism of the communication module 2121, the NTP time or GNSS time is re-synchronized and written into the RTC time component 211 to start timing again. After optimization, the RTC time error is NTP time error + 5 minutes of running error ≈ ±(100ms + 1.5ms) = ±101.5ms, which basically maintains consistency with the error of the NTP time itself.

[0051] In some embodiments, please refer to Figure 3 The GNSS module 221 simultaneously outputs PPS second pulse signals to the control element 23 and the timing device 30, using the PPS second pulse signals as a time whole-second alignment reference, so that the time of the control element 23 and the timing device 30 is synchronized to the whole second; the timing device 30 is connected to the control element 23, receives the timestamp message output by the control element 23, and performs time synchronization based on the timestamp message.

[0052] The PPS signal pin of GNSS module 221 is directly connected to the external interrupt pin of control element 2. Control element 23 is configured to rise edge interrupt trigger mode. When the rise edge of PPS is detected, an interrupt is immediately triggered and the internal millisecond counter is cleared. At the same time, the whole second part of the current system time is locked. For example, the second field of the timestamp is forced to be synchronized to the whole second time of GNSS time synchronization, thus completing the whole second reference anchoring of the local clock of control element 23.

[0053] The PPS signal pin of the GNSS module 221 is synchronously connected to the time synchronization interface of the timing device 30, such as the intelligent driving controller, through a differential signal line. The time synchronization module built into the timing device 30 also uses the rising edge of PPS as the trigger signal to pause the second-level counting of the local time and calibrate the whole-second time base to ensure that it is on the same time axis as the whole-second timestamp of the control element 23.

[0054] Every 10 seconds, control element 23 compares the local clock's integer second digit with the integer second reference triggered by the PPS pulse. If a deviation of ±1 second or more is detected, such as integer second count drift caused by crystal frequency offset, it immediately re-anchors the integer second reference via the rising edge of the PPS pulse. The timing device 30 receives the integer second reference verification message sent by control element 23 in real time. If its local time deviates from the integer second time of control element 23 by more than 500 ms, it will actively initiate a time synchronization request and re-align the integer second time using the PPS pulse to ensure long-term consistency of the two integer second times.

[0055] After completing the whole-second synchronization, the control element 23 generates a gPTP protocol timestamp message based on the anchored whole-second reference and in combination with the GNSS time, and sends it to the timing device 30 through the Ethernet interface. The timing device 30 then uses the PPS whole-second time as a reference to perform sub-millisecond time calibration on the received timestamp message, and finally realizes a hierarchical time synchronization system of whole-second synchronization (PPS second pulse) and sub-millisecond precise time synchronization (timestamp message).

[0056] In this embodiment, the PPS second pulse signal is used as a unified whole-second alignment reference, which can eliminate whole-second time deviations across devices, lay the foundation for subsequent sub-millisecond precise time synchronization, and ensure the consistency of the underlying time reference of multiple electronic components in the vehicle.

[0057] Furthermore, the vehicle-mounted timing device 20 also includes a conversion module 24, which is connected between the control element 23 and the timing device 30.

[0058] Specifically, the conversion module 24 is an automotive-grade low-power Ethernet conversion unit that supports wide operating temperature from -40℃ to 105℃. It has a built-in gPTP protocol stack (compatible with the IEEE 802.1AS standard), TCP / IP protocol parsing module, and MII interface transceiver, enabling bidirectional protocol conversion and transparent data forwarding. It also has ±8kV ESD electrostatic protection capability, making it suitable for complex electromagnetic environments in vehicles.

[0059] The connection between the conversion module 24 and the control element 23 supports flexible selection of gPTP, MII, and TCP / IP interfaces to adapt to the hardware architecture of different vehicle models. The gPTP interface directly connects to the Ethernet MAC layer of the control element 23 via the vehicle's 100Mbps Ethernet, used to transmit gPTP timestamp messages with nanosecond-level precision and a transmission latency of ≤10µs, ensuring sub-millisecond time synchronization requirements. The MII interface, as a backup physical layer interface for the gPTP interface, enables low-level data frame interaction between the control element 23 and the conversion module 24, with a transmission rate of up to 100Mbps, adapting to economical hardware solutions without independent Ethernet control elements. The TCP / IP interface establishes a TCP / IP connection via an Ethernet link, used to transmit non-real-time control data such as time synchronization status messages from the timing device 30 and clock source switching commands from the control element 23, ensuring reliable data transmission.

[0060] The connection between the conversion module 24 and the timing device 30 retains only the gPTP and TCP / IP interfaces, eliminating the MII interface to simplify the hardware design on the timing device side. The gPTP interface continues the transmission of timestamp messages with nanosecond-level precision, ensuring that the timing device 30 (such as the intelligent driving controller) can obtain a high-precision time reference from the same source as the control element 23. The TCP / IP interface is used by the timing device 30 to feed back the time synchronization status to the control element 23, such as the time deviation value and synchronization success flag.

[0061] Please refer to Figure 4 , Figure 4 This is a flowchart illustrating the vehicle-side timing method disclosed in this application. The vehicle-side timing method provided in this application includes: in response to a vehicle 10 switching from a backup clock source 21 to a master clock source 22, determining whether the time difference between the backup clock source 21 and the master clock source 22 is within a preset range; if yes, switching to the master clock source 22 as the system time source for timing, and outputting a timestamp message based on the master clock source 22; if no, using the backup clock source 21 as the system time source for timing, and accumulating or subtracting the timestamp message output based on the backup clock source 21 according to a preset step size, so that the timestamp message gradually approaches the time of the master clock source 22, until the time difference between the accumulated timestamp message and the master clock source 22 is within a preset range; the backup clock source 21 includes an RTC time component 211 or an NTP time component 212, and the master clock source 22 includes a GNSS module 221.

[0062] By first determining the time difference between the backup clock source 21 and the master clock source 22, and then selecting a switching strategy based on the time difference, significant time jumps during clock source switching are avoided. Even if there is a time deviation between the backup clock source 21 and the master clock source 22, a smooth transition of the time base can be achieved through step-by-step adjustments to the timestamp messages, maintaining the continuity and consistency of system time and eliminating system timing disorder caused by sudden time changes. Furthermore, since the timestamp messages can gradually converge towards the time of the master clock source 22, there will be no timestamp backsliding or disorder. Therefore, the logging function of the vehicle controller can maintain stable operation and continuously retain key information such as the vehicle 10's operating status and positioning data. This effectively solves the problems of log interruption and missing accident analysis data caused by time jumps in traditional solutions, providing complete data support for subsequent fault tracing and quality analysis.

[0063] For example, the preset range is -10ms to 10ms. That is, when the system clock jumps from NTP or RTC time to GNSS time, if the NTP or RTC time is faster than the GNSS time, the control element 23 compares the received GNSS time with the NTP or RTC time. If the NTP or RTC time is more than 10ms faster than the GNSS time, a time smoothing algorithm is performed. Originally, the forwarding interval for each gPTP timestamp message output by the control element 23 was 8Hz, meaning one gPTP timestamp message was sent to the timing device 30 every 125ms. The algorithm increments the message timestamp by 1ms, adjusting it to one gPTP timestamp message sent to the timing device 30 every 126ms. This process continues until the final timestamp message is less than the previously compared GNSS time by 10ms, at which point the smoothing algorithm is exited. This time smoothing process addresses the industry pain point of system time disorder caused by time jumps, leading to abnormal function log printing.

[0064] In one embodiment, RTC time is obtained through the hardware clock module 2111 of the RTC time component 211, NTP time is obtained through the communication module 2121 of the NTP time component 212, and GNSS time is obtained through the GNSS module 221. The GNSS module 221 provides a high-precision primary time source, the NTP time of the communication module 2121 serves as a medium-precision backup source, and the RTC time of the hardware clock module 2111 serves as an emergency backup source. This allows for automatic switching of time sources based on driving scenarios, avoiding system timing disruptions caused by the failure of a single time source and improving the adaptability of the timing system to complex in-vehicle operating conditions.

[0065] In one embodiment, the vehicle-side timing method provided in this application further includes: controlling the communication module 2121 to wake up the vehicle-side timing device 20 at a preset period, synchronizing the NTP time or GNSS time acquired after wake-up to the RTC time, and calibrating the RTC time. The deviation between the periodically calibrated RTC time and the NTP and GNSS times is significantly reduced, and the time jump amplitude is significantly reduced when the system clock source switches. On the one hand, this reduces the problem of system log recording interruption caused by time jumps, ensuring the traceability of key data throughout the driving process and providing complete data support for fault analysis and after-sales maintenance; on the other hand, it avoids interference from large time jumps on the execution of intelligent driving strategies, ensuring the timing alignment of perception data and the precise triggering of control commands, thereby improving the operational safety of intelligent driving functions.

[0066] In one embodiment, frequency offset compensation for the hardware clock module 2111 based on the ambient temperature surrounding the hardware clock module 2111 includes: retrieving a pre-stored compensation coefficient based on the ambient temperature of the hardware clock module 2111 collected by the temperature acquisition element 2112, and dynamically correcting the crystal oscillation frequency of the hardware clock module 2111 based on the compensation coefficient; the compensation coefficient is determined based on the ambient temperature of the hardware clock module 2111 and a mapping relationship, the mapping relationship being used to characterize the correspondence between the ambient temperature of the hardware clock module 2111 and the compensation coefficient. By collecting the ambient temperature of the hardware clock module 2111 through the temperature acquisition element 2112 and retrieving the pre-stored temperature-compensation coefficient mapping relationship to dynamically correct the crystal oscillation frequency of the hardware clock module 2111, the physical frequency offset of the crystal at different temperatures can be effectively offset, keeping the timing deviation of the hardware clock module 2111 within a very small range.

[0067] The above embodiments are merely preferred embodiments provided to fully illustrate the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention.

Claims

1. A vehicle-end timing method, characterized in that, include: When the vehicle (10) switches from the backup clock source (21) to the main clock source (22), it is determined whether the time difference between the backup clock source (21) and the main clock source (22) is within a preset range. If yes, the main clock source (22) is switched to be the system time source for time synchronization, and a timestamp message is output according to the main clock source (22). If no, the backup clock source (21) is used as the system time source for time synchronization, and the timestamp message output according to the backup clock source (21) is accumulated or subtracted according to a preset step size, so that the timestamp message gradually approaches the time of the main clock source (22), so as to control the time difference between the timestamp message and the main clock source (22) within a preset range.

2. The vehicle-side timing method according to claim 1, characterized in that: The backup clock source (21) includes an RTC time component (211) or an NTP time component (212), and the master clock source (22) includes a GNSS module (221). The RTC time is obtained through the hardware clock module (2111) of the RTC time component (211), the NTP time is obtained through the communication module (2121) of the NTP time component (212), and the GNSS time is obtained through the GNSS module (221).

3. The vehicle-side timing method according to claim 2, characterized in that, Also includes: The communication module (2121) is controlled to wake up the vehicle-mounted timing device (20) according to a preset cycle, and the NTP time or GNSS time obtained after waking up is synchronized to the RTC time, and the RTC time is calibrated.

4. The vehicle-side timing method according to claim 2, characterized in that: Frequency offset compensation is performed on the hardware clock module (2111) based on the ambient temperature around the hardware clock module (2111).

5. The vehicle-side timing method according to claim 4, characterized in that, The frequency offset compensation of the hardware clock module (2111) based on the ambient temperature around the hardware clock module (2111) specifically includes: retrieving a pre-stored compensation coefficient based on the collected ambient temperature around the hardware clock module (2111), and dynamically correcting the crystal oscillation frequency of the hardware clock module (2111) based on the compensation coefficient; the compensation coefficient is determined based on the ambient temperature around the hardware clock module (2111) and a mapping relationship, and the mapping relationship is used to characterize the correspondence between the ambient temperature around the hardware clock module (2111) and the compensation coefficient.

6. A vehicle-mounted timing device, characterized in that: The system includes a backup clock source (21), a main clock source (22), and a control element (23). When the vehicle switches from the backup clock source (21) to the main clock source (22), the control element (23) determines whether the time difference between the backup clock source (21) and the main clock source (22) is within a preset range. If yes, the system switches to the main clock source (22) as the system time source for time synchronization and outputs a timestamp message based on the main clock source (22). If no, the system uses the backup clock source (21) as the system time source for time synchronization and accumulates or subtracts the timestamp message output based on the backup clock source (21) according to a preset step size, so that the timestamp message gradually approaches the time of the main clock source (22) until the time difference between the accumulated timestamp message and the main clock source (22) is within a preset range. The backup clock source (21) includes an RTC time component (211) or an NTP time component (212), and the master clock source (22) includes a GNSS module (221).

7. The vehicle-end timing device according to claim 6, characterized in that: The RTC time component (211) includes a hardware clock module (2111) and a temperature acquisition element (2112) connected to the control element (23). The RTC time is obtained through the hardware clock module (2111), and the ambient temperature around the hardware clock module (2111) is acquired through the temperature acquisition element (2112). The control element (23) retrieves a pre-stored compensation coefficient based on the collected ambient temperature around the hardware clock module (2111), and dynamically corrects the crystal oscillation frequency of the hardware clock module (2111) according to the compensation coefficient. The compensation coefficient is determined based on the ambient temperature around the hardware clock module (2111) and the mapping relationship. The mapping relationship is used to characterize the correspondence between the ambient temperature around the hardware clock module (2111) and the compensation coefficient.

8. The vehicle-end timing device according to claim 6, characterized in that: The NTP time component (212) includes a communication module (2121), which wakes up the vehicle-mounted timing device (20) according to a preset period, synchronizes the NTP time or GNSS time obtained after wake-up to the RTC time, and calibrates the RTC time.

9. The vehicle-end timing device according to claim 6, characterized in that, The GNSS module (221) simultaneously outputs PPS second pulse signals to the control element (23) and the timing device (30), and uses the PPS second pulse signals as the time whole second alignment reference, so that the time of the control element (23) and the timing device (30) is synchronized to the whole second; the timing device (30) is connected to the control element (23), receives the timestamp message output by the control element (23), and performs time synchronization according to the timestamp message.

10. A vehicle, characterized in that: Includes the vehicle-mounted timing device as described in any one of claims 6 to 9.