A vehicle-mounted time synchronization method, device and equipment
Patent Information
- Application Number
- CN202611316901.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-10-20
AI Technical Summary
[0004]本申请的目的在于提供一种车载时间同步方法、装置及设备,解决车辆单次上电运行过程中时间基准容易发生变化,导致域内时序连续性和一致性较差的问题
[0027]其中,第二方面至第五方面中任一种设计方式所带来的技术效果可参见第一方面或第一方面中不同可能的实现方式所带来的技术效果,此处不再赘述。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicle networking technology, and in particular to an in-vehicle time synchronization method, apparatus and device. Background Technology
[0002] With the development of vehicle electronic and electrical architecture, vehicles typically contain multiple controllers, sensors, and actuators. The data collected, control commands, and fault records generated by different nodes need to use unified time information to ensure the timing coordination between various vehicle functions.
[0003] In related technologies, vehicle-mounted time synchronization systems typically utilize satellite time synchronization, network time synchronization, or local clocks to provide time information, and perform time calibration based on the signal status and time synchronization quality of the time synchronization source during vehicle operation. When a vehicle enters a tunnel, underground parking garage, or area with poor network coverage, the time synchronization source may experience signal interruption, signal recovery, or fluctuations in time synchronization quality. The vehicle's internal time may jump, rewind, or deviate as the time synchronization information changes, resulting in inconsistent timestamps recorded by different nodes. This affects multi-source data fusion, cross-node collaborative control, and the timing of fault events. Summary of the Invention
[0004] The purpose of this application is to provide an on-board time synchronization method, device, and equipment to solve the problem that the time reference is prone to change during a single power-on operation of a vehicle, resulting in poor continuity and consistency of timing within the domain.
[0005] In a first aspect, embodiments of this application provide an in-vehicle time synchronization method, applied to a master clock node in an in-vehicle time synchronization system. The system also includes multiple slave clock nodes communicatively connected to the master clock node. The method includes: during the initialization phase when the vehicle enters a target power-on operating cycle, granting the master clock node permission to read timing information from a target timing source; determining a fixed time reference corresponding to the target power-on operating cycle based on initial timing information obtained from the target timing source and locally stored initial local timing values; after determining the fixed time reference, putting the master clock node into a reference-locked state, and disabling its permissions to read timing information from the target timing source, reference calibration, and time synchronization during the target power-on operating cycle to maintain the fixed time reference; determining the current standard time based on the initial local timing value, the fixed time reference, and the current local timing value during the target power-on operating cycle; and sending the current standard time to the multiple slave clock nodes so that the multiple slave clock nodes can synchronize their local time according to the current standard time.
[0006] The vehicle-mounted time synchronization method provided in this application establishes a fixed time reference using the target time source only during the initialization phase when the vehicle enters the target power-on operation cycle. After the fixed time reference is established, the master clock node disables the target time source's time reading, reference calibration, and time synchronization call permissions for the current power-on operation cycle, and continuously determines the current standard time based on the local timing value. Even if the target time source experiences signal interruption, signal recovery, or time quality fluctuations during vehicle operation, the established fixed time reference will not change. This reduces time jumps or rollbacks caused by changes in external time sources, ensuring that the master clock node continuously provides the current standard time based on the same fixed time reference to multiple slave clock nodes, thus improving the continuity and consistency of time synchronization within the vehicle domain.
[0007] One possible implementation involves a master clock node comprising: a clock source interface, a local timing component, a storage unit, and a control unit. Based on the initial timing information obtained from the target timing source and the locally stored initial local timing value, a fixed time base corresponding to the target power-on operation cycle is determined. This includes: setting the clock source interface to the initial timing state; obtaining initial timing information from the target timing source through the clock source interface; obtaining the initial local timing value corresponding to the time the initial timing information was obtained through the local timing component; establishing a correspondence between the initial timing information and the initial local timing value through the control unit; determining the fixed time base based on the correspondence; and storing the initial local timing value and the fixed time base in the storage unit.
[0008] One possible implementation of the vehicle-mounted time synchronization method provided in this application embodiment further includes: after storing the fixed time reference in the storage unit, setting the reference locking flag to enable the master clock node to enter the reference locking state. The initialization phase ends based on the reference locking flag, and the clock source interface is switched from the initialization timing state to the locked operation state. In the locked operation state, the timing information reading permission, reference calibration permission, and time synchronization call permission are kept closed until the target power-on operation cycle ends.
[0009] One possible implementation involves switching the clock source interface from the initialization timing state to the locked operation state, including: configuring the interface control register corresponding to the clock source interface; closing the data channel used to read timing information from the target timing source; stopping the scheduling of timing processing tasks used to read and parse timing information; and disabling the interface functions used to call the target timing source to perform reference calibration and time synchronization, so that the target timing source does not participate in the determination of the current standard time during the target power-on operation cycle.
[0010] One possible implementation involves a local timing component in the master clock node including a counter. The initial local timing value is the initial count value generated by the counter when initial timing information is acquired. The current local timing value is the current count value generated by the counter within the target power-on operating cycle. Based on the initial local timing value, a fixed time base, and the current local timing value within the target power-on operating cycle, the current standard time is determined, including: determining a count increment based on the current count value and the initial count value; determining a time increment based on the count increment and the counter's timing parameters; and determining the current standard time based on the fixed time base and the time increment.
[0011] In one possible implementation, the local timing component also includes a crystal oscillator for providing timing signals to the counter. The master clock node also includes a temperature detection component. Determining the time increment based on the count increment and the counter's timing parameters includes: acquiring the crystal oscillator's temperature information via the temperature detection component; correcting the counter's timing parameters based on the temperature information and pre-stored drift compensation parameters; and determining the time increment based on the count increment and the corrected timing parameters.
[0012] In one possible implementation, the local timing component further includes a backup crystal oscillator. The vehicle-mounted time synchronization method provided in this application further includes: when an abnormal operating state of the crystal oscillator is detected, switching the timing source used to provide timing signals to the counter from the crystal oscillator to the backup crystal oscillator. Recording the current standard time corresponding to the switching moment and the corresponding switching count value of the counter. Determining the count increment after the switch based on the current count value of the counter after the switch and the switching count value. Determining the time increment after the switch based on the count increment after the switch and the timing parameters corresponding to the backup crystal oscillator. Determining the current standard time after the switch based on the current standard time corresponding to the switching moment and the time increment after the switch.
[0013] Secondly, embodiments of this application provide an in-vehicle time synchronization device, applied to a master clock node in an in-vehicle time synchronization system. The system also includes multiple slave clock nodes communicatively connected to the master clock node. The device includes: a determining module, a controlling module, and a transmitting module.
[0014] The determination module is used to grant the master clock node permission to read the timing information of the target timing source during the initialization phase when the vehicle enters the target power-on operation cycle. Based on the initial timing information obtained from the target timing source and the initial local timing value stored locally, the fixed time base corresponding to the target power-on operation cycle is determined.
[0015] The control module is used to put the master clock node into a reference-locked state after a fixed time reference is determined, and to disable the time information reading permission, reference calibration permission, and time synchronization call permission for the target time source during the target power-on operation cycle, so as to maintain a fixed time reference.
[0016] The determination module is also used to determine the current standard time based on the initial local timing value, the fixed time base, and the current local timing value within the target power-on operation cycle.
[0017] The sending module is used to send the current standard time to multiple slave clock nodes so that the multiple slave clock nodes can synchronize their local time according to the current standard time.
[0018] One possible implementation includes a master clock node comprising a clock source interface, a local timing component, a storage unit, and a control unit. A determination module, used to determine the fixed time reference corresponding to the target power-on operation cycle based on initial timing information obtained from the target timing source and the locally stored initial local timing value, specifically performs the following: setting the clock source interface to the initial timing state; obtaining initial timing information from the target timing source through the clock source interface; obtaining the initial local timing value corresponding to the time of acquisition of the initial timing information through the local timing component; establishing the correspondence between the initial timing information and the initial local timing value through the control unit; determining the fixed time reference based on the correspondence; and storing the initial local timing value and the fixed time reference in the storage unit.
[0019] In one possible implementation, the vehicle-mounted time synchronization device provided in this application embodiment is further configured to: after storing the fixed time reference in the storage unit, set the reference locking flag to enable the master clock node to enter the reference locking state. The initialization phase ends based on the reference locking flag, and the clock source interface is switched from the initialization timing state to the locked operation state. In the locked operation state, the timing information reading permission, reference calibration permission, and time synchronization call permission are kept closed until the target power-on operation cycle ends.
[0020] One possible implementation involves a control module that, when switching the clock source interface from the initialization timing state to the locked operation state, specifically performs the following: configures the interface control register corresponding to the clock source interface; closes the data channel used to read timing information from the target timing source; stops scheduling timing processing tasks used to read and parse timing information; and disables the interface functions used to call the target timing source to perform reference calibration and time synchronization, so that the target timing source does not participate in the determination of the current standard time during the target power-on operation cycle.
[0021] One possible implementation involves a local timing component in the master clock node including a counter. The initial local timing value is the initial count value generated by the counter when initial timing information is acquired. The current local timing value is the current count value generated by the counter within the target power-on operating cycle. A determination module, used to determine the current standard time based on the initial local timing value, a fixed time base, and the current local timing value within the target power-on operating cycle, specifically performs the following: determining the count increment based on the current count value and the initial count value; determining the time increment based on the count increment and the counter's timing parameters; and determining the current standard time based on the fixed time base and the time increment.
[0022] In one possible implementation, the local timing component also includes a crystal oscillator for providing timing signals to the counter. The master clock node also includes a temperature detection component. The determination module, used to determine the time increment based on the count increment and the counter's timing parameters, specifically involves: acquiring the crystal oscillator's temperature information through the temperature detection component; correcting the counter's timing parameters based on the temperature information and pre-stored drift compensation parameters; and determining the time increment based on the count increment and the corrected timing parameters.
[0023] In one possible implementation, the local timing component further includes a backup crystal oscillator. The vehicle-mounted time synchronization device provided in this application embodiment is further configured to: switch the timing source used to provide timing signals to the counter from the original crystal oscillator to the backup crystal oscillator when an abnormal operating state of the crystal oscillator is detected; record the current standard time corresponding to the switching moment and the corresponding switching count value of the counter; determine the count increment after the switch based on the current count value of the counter after the switch and the switching count value; determine the time increment after the switch based on the count increment after the switch and the timing parameters corresponding to the backup crystal oscillator; and determine the current standard time after the switch based on the current standard time corresponding to the switching moment and the time increment after the switch.
[0024] Thirdly, embodiments of this application provide an in-vehicle time synchronization device that has the function of implementing the in-vehicle time synchronization method of the first aspect or any possible implementation of the first aspect. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function.
[0025] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a computer, enable the computer to perform the vehicle time synchronization method of the first aspect or any possible implementation thereof.
[0026] Fifthly, embodiments of this application provide a computer program product containing instructions that, when run on a computer, enable the computer to execute the vehicle time synchronization method described in the first aspect or any possible implementation thereof.
[0027] The technical effects of any of the design methods in aspects two through five can be found in aspect one or in different possible implementations of aspect one, and will not be repeated here. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0029] Figure 1 A system structure diagram of an in-vehicle time synchronization system provided in this application embodiment; Figure 2 Another system architecture diagram of an in-vehicle time synchronization system provided in this application embodiment; Figure 3 A flowchart illustrating an in-vehicle time synchronization method provided in this application embodiment; Figure 4 A schematic diagram of a vehicle-mounted time synchronization device provided in an embodiment of this application; Figure 5 This is another system architecture diagram of an in-vehicle time synchronization system provided in an embodiment of this application. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0031] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0032] Multiple control nodes within a vehicle typically require data acquisition, control command execution, and fault event recording based on a unified time reference. Related technologies usually involve continuously acquiring timing information from an external time source during vehicle power-on operation and calibrating the vehicle's internal time based on the signal status or quality of the external time source. When the vehicle's operating environment changes, the external time source may experience signal interruption, signal recovery, or fluctuations in timing quality, causing the vehicle's internal time reference to change within the same power-on cycle. This can lead to timestamp jumps, rollbacks, or deviations at different control nodes, affecting the continuity and consistency of timing within the vehicle domain.
[0033] Based on this, this application provides an in-vehicle time synchronization method. This method is applied to the master clock node in an in-vehicle time synchronization system, which also includes multiple slave clock nodes communicatively connected to the master clock node. The method includes an initialization phase when the vehicle enters a target power-on operating cycle, granting access to read timing information from a target timing source, and determining a fixed time reference corresponding to the target power-on operating cycle based on the initial timing information obtained from the target timing source and the locally stored initial local timing value. After determining the fixed time reference, the master clock node enters a reference locking state and disables access to read timing information from the target timing source, reference calibration, and time synchronization during the target power-on operating cycle to maintain the fixed time reference. The master clock node determines the current standard time based on the initial local timing value, the fixed time reference, and the current local timing value during the target power-on operating cycle, and sends the current standard time to the multiple slave clock nodes so that the multiple slave clock nodes can synchronize their local time according to the current standard time.
[0034] The vehicle-mounted time synchronization method provided in this application establishes a fixed time reference using the target time source only during the initialization phase when the vehicle enters the target power-on operation cycle. After the fixed time reference is established, the master clock node disables the target time source's time reading, reference calibration, and time synchronization call permissions for the current power-on operation cycle, and continuously determines the current standard time based on the local timing value. Even if the target time source experiences signal interruption, signal recovery, or time quality fluctuations during vehicle operation, the established fixed time reference will not change. This reduces time jumps or rollbacks caused by changes in external time sources, ensuring that the master clock node continuously provides the current standard time based on the same fixed time reference to multiple slave clock nodes, thus improving the continuity and consistency of time synchronization within the vehicle domain.
[0035] The methods provided in the embodiments of this application will now be described in conjunction with the specific accompanying drawings.
[0036] On one hand, embodiments of this application provide an in-vehicle time synchronization system. For example... Figure 1 As shown, the vehicle-mounted time synchronization system 100 may include: a master clock node 101, multiple slave clock nodes 102, a time source 103, and a vehicle-mounted communication network 104. The master clock node 101 is communicatively connected to the time source 103. The master clock node 101 is communicatively connected to the multiple slave clock nodes 102 via the vehicle-mounted communication network 104.
[0037] The master clock node 101 is used to establish the time base adopted by the vehicle during a single power-on operation cycle. It continuously determines the current standard time based on local timing information and sends the current standard time to multiple slave clock nodes 102. For example, the master clock node 101 can be a vehicle central gateway, central computing platform, domain controller, or onboard time server. The master clock node 101 can act as the master node in the onboard time synchronization system 100, providing unified time information to multiple slave clock nodes 102.
[0038] Among them, such as Figure 2 As shown, the master clock node 101 may include a clock source interface 111, a local timing component 112, a control unit 113, a storage unit 114, and a time synchronization communication component 115.
[0039] The clock source interface 111 is communicatively connected to the time source 103 and is used to receive and parse the initial time information provided by the target time source during the initialization phase when the vehicle is powered on. The clock source interface 111 can be a satellite time service interface, a network time service interface, or a real-time clock access interface, or it can be a composite clock source interface compatible with multiple time service methods.
[0040] The control unit 113 is connected to the clock source interface 111, the local timing component 112, the storage unit 114, and the time synchronization communication component 115. The control unit 113 is used to determine the initialization phase according to the power-on status of the vehicle, control the clock source interface 111 to open the time synchronization information reading permission during the initialization phase, determine the fixed time base according to the initial time synchronization information and the initial local timing value generated by the local timing component 112, and store the fixed time base and the initial local timing value in the storage unit 114.
[0041] The control unit 113 is also used to put the master clock node 101 into a reference-locked state after the fixed time reference is established, and to adjust the software access state corresponding to the clock source interface 111 so that the target time source no longer participates in time reference calibration and determination of the current standard time during the current power-on operation cycle. Thus, the time source 103 is used to provide the time origin to the master clock node 101 during the initialization phase, and the master clock node 101 maintains the vehicle domain time according to the local timing component 112 after the initialization phase ends.
[0042] Local timing component 112 is used to generate a local timing value that increments with vehicle operating time. Exemplarily, local timing component 112 may include a crystal oscillator and a counter. The crystal oscillator provides a timing signal to the counter, which generates a unidirectionally incrementing count value based on the timing signal. The counter can be a hardware counter, such as a 64-bit hardware counter. Control unit 113 can determine the current standard time based on the initial count value generated by the counter during the initialization phase, the current count value generated by the counter during vehicle operation, and a fixed time reference.
[0043] In one possible implementation, the local timing component 112 may also include a backup crystal oscillator. The backup crystal oscillator is used to provide a timing signal to the counter when the crystal oscillator stops oscillating, experiences a frequency abnormality, or suffers other hardware failure. The control unit 113 maintains the established fixed time base unchanged when switching crystal oscillators and continues to perform time calculations based on the count value at the time of switching and the current standard time, thereby reducing the impact of timing hardware switching on the continuity of the current standard time.
[0044] Furthermore, such as Figure 2 As shown, the master clock node 101 may also include a temperature detection component 116. The temperature detection component 116 is used to detect the temperature information corresponding to the crystal oscillator. This temperature detection component 116 can be a temperature sensor located near the crystal oscillator, a chip temperature detection circuit located inside the master clock node 101, or a vehicle ambient temperature sensor. The control unit 113 can correct the timing parameters of the local timing component 112 based on the temperature information and pre-stored drift compensation parameters to reduce timing errors caused by temperature changes. This correction is used to adjust the local timing increment without changing the established fixed time reference.
[0045] Storage unit 114 is used to store a fixed time base, initial local timing values, timing parameters, drift compensation parameters, and operational event information. For example, storage unit 114 can be a non-volatile memory, or it can include a non-volatile storage area and an operational storage area. After the current power-on operation cycle ends, storage unit 114 can also store corresponding time-based operational data and fault event records for use in vehicle diagnostics or fault timing tracing.
[0046] The time synchronization communication component 115 generates a time synchronization message based on the current standard time determined by the control unit 113, and sends the time synchronization message to multiple slave clock nodes 102 via the vehicle communication network 104. For example, the time synchronization communication component 115 can be an vehicle network communication controller, or a protocol processing component supporting a universal precision time protocol, a time-sensitive network, or a controller area network time synchronization protocol. The time synchronization message carries the current standard time determined based on a fixed time base and local timing information, without changing the corresponding time base using external time synchronization information reacquired during vehicle operation.
[0047] Furthermore, such as Figure 2 As shown, the master clock node 101 may also include a performance monitoring component 117. The performance monitoring component 117 is used to detect the operating status of the local timing component 112 and the vehicle communication network 104, and generates corresponding performance events when a crystal oscillator abnormality or communication interruption is detected. The performance monitoring component 117 can also record signal abnormality events of the time source 103, but the state changes of the time source 103 are not used to reselect the time base or to calibrate the current standard time, so as to maintain the vehicle domain time based on the same fixed time base during the current power-on operation cycle while retaining performance diagnostics and event tracing capabilities.
[0048] The clock node 102 can be distributed across different functional domains of the vehicle. For example, the clock node 102 can be an intelligent driving domain controller, a cockpit domain controller, a chassis domain controller, a powertrain domain controller, a body domain controller, an on-board sensor, or a vehicle actuator controller.
[0049] For any one of the multiple slave clock nodes 102, the clock node 102 is equipped with a local clock and a time synchronization slave component. The time synchronization slave component is used to receive the current standard time sent by the master clock node 101 and synchronize the local time of the corresponding slave clock node 102 according to the current standard time. When the communication between the master clock node 101 and the slave clock node 102 is temporarily interrupted, the slave clock node 102 can also perform local timing according to the most recently received current standard time and the timing information generated by the local clock.
[0050] The time source 103 is used to provide the master clock node 101 with the time information required for initialization. The time source 103 may include one or more candidate time sources. For example, the candidate time source may be a satellite time synchronization module, an in-vehicle network time synchronization device, or a real-time clock.
[0051] The satellite timing module can be a Global Navigation Satellite System (GNSS) timing module. The vehicle-mounted network timing device can be an onboard time server that provides timing information using a network time protocol or a precision time protocol. The real-time clock can be an onboard real-time clock set in the master clock node 101.
[0052] The master clock node 101 can also determine the target time source from the candidate time sources based on the availability and time quality of each candidate time source when the vehicle is powered on.
[0053] The in-vehicle communication network 104 is used to transmit time synchronization messages between the master clock node 101 and multiple slave clock nodes 102. The in-vehicle communication network 104 can be an in-vehicle Ethernet, a controller area network (CAN), or a hybrid communication network consisting of both. For different communication networks, the master clock node 101 can use a corresponding in-vehicle time synchronization protocol to send the current standard time. For example, for in-vehicle Ethernet, a general precision time protocol or a time synchronization mechanism in a time-sensitive network can be used; for a CAN, a CAN time synchronization protocol can be used.
[0054] It should be noted that, Figure 1 The vehicle-mounted time synchronization system 100 shown is merely an example of an application scenario for the method provided in the embodiments of this application, and is not intended to limit the application scenarios of the method provided in the embodiments of this application.
[0055] On the one hand, embodiments of this application provide an in-vehicle time synchronization method, which can be performed by... Figure 1 The on-board time synchronization system 100 shown is executing. For example... Figure 3 As shown, the method may include the following steps.
[0056] S301, during the initialization phase when the vehicle enters the target power-on operation cycle, grants the master clock node permission to read the timing information of the target timing source, and determines the fixed time base corresponding to the target power-on operation cycle based on the initial timing information obtained from the target timing source and the initial local timing value stored locally.
[0057] First, the operating cycle of the vehicle provided in the embodiments of this application will be described.
[0058] Specifically, during continuous use, the vehicle can sequentially go through a power-off phase, a power-on initialization phase, a power-on operation phase, and a power-off phase again. When the vehicle switches from a power-off state to a power-on state, it enters a new power-on operation cycle and first enters the initialization phase corresponding to that power-on operation cycle.
[0059] The target power-on operation cycle refers to an operation cycle that begins when the vehicle meets preset initialization conditions and continues until the vehicle is powered off. These preset initialization conditions may include cold start conditions after the vehicle is completely powered off or vehicle hard reset conditions. The power-on operation cycle that the vehicle enters after meeting the preset initialization conditions can be defined as the target power-on operation cycle.
[0060] Correspondingly, the initialization phase refers to the time period at the start of the target's power-on operation cycle, used to complete the acquisition of timing information, the acquisition of initial local timing values, and the establishment of a fixed time reference. The initialization phase can have a preset initialization duration, or it can end after the fixed time reference is determined and the corresponding parameters are stored. For example, the duration of the initialization phase can be less than 5 seconds.
[0061] After the fixed time reference is established during the initialization phase, the vehicle enters the power-on operation phase after the reference is locked. During this power-on operation phase, the master clock node continuously determines the current standard time based on the fixed time reference.
[0062] The initial local timing value refers to the local timing value generated and stored by the local timing component when the master clock node acquires the initial timing information. The initial local timing value is used to mark the local timing position corresponding to the initial timing information.
[0063] A fixed time base is used to represent the starting point for calculating the current standard time within the target power-on operating cycle. The fixed time base includes the standard time indicated by the initial time synchronization information, and the correspondence between this standard time and the initial local timing value. Once the fixed time base is determined, it will not be updated based on subsequent time synchronization information provided by the target time synchronization source within the target power-on operating cycle.
[0064] When the vehicle is completely powered down again, the current power-on operating cycle ends, and the corresponding fixed time reference becomes invalid. The next time the vehicle switches from a powered-down state to a powered-on state, it enters the next power-on operating cycle, and the corresponding fixed time reference is re-determined during the initialization phase of the next power-on operating cycle.
[0065] It should be noted that during the vehicle's operating cycle, if a partial software reset, a single domain controller restart, hibernation wake-up, or operating state switch occurs during the power-on operation phase, it still belongs to the same power-on operating cycle and does not re-enter the initialization phase used to determine the fixed time reference. Correspondingly, the master clock node can read the fixed time reference and initial local timing value already stored in the storage unit for the current target power-on operating cycle and continue timing according to the fixed time reference. This avoids the need to re-acquire timing information due to changes in partial operating state before the vehicle is powered off.
[0066] Specifically, the master clock node can determine whether the vehicle has entered the target power-on operation cycle based on the vehicle's power status, reset status, or startup status. When it is determined that the vehicle meets the cold start conditions or the vehicle hard reset conditions, the master clock node enters the initialization phase and grants access to read timing information from candidate timing sources. The master clock node can read the timing information provided by the candidate timing sources, determine the target timing source based on the availability and timing quality of the candidate timing sources, and obtain the initial timing information provided by the target timing source. At the same time, the master clock node obtains the initial local timing value at the corresponding moment, establishes the correspondence between the initial timing information and the initial local timing value, and thus determines the fixed time base.
[0067] The target time source refers to the time source selected by the master clock node during the initialization phase to provide initial time information. The target time source can be determined from multiple candidate time sources. Candidate time sources may include satellite time synchronization modules, vehicle-mounted network time synchronization devices, and real-time clocks. The initial time information represents the standard time provided by the target time source at the corresponding acquisition time and may include date information, time information, and time validity information.
[0068] It should be noted that the initial local timing value stored locally does not mean that the timing value existed before the vehicle entered the initialization phase. Rather, it means that the master clock node synchronously obtains the corresponding local timing value when it obtains the initial timing information and stores the local timing value locally before determining the fixed time base.
[0069] One possible implementation involves the master clock node determining the target time source from multiple candidate time sources according to a preset time synchronization priority. The preset time synchronization priority can correspond sequentially to the satellite time synchronization module, the vehicle-mounted network time synchronization device, and the real-time clock.
[0070] Specifically, for the satellite timing module, the master clock node can determine whether the satellite timing information meets the preset timing conditions based on the number of satellites, signal strength, and timing validity flags. If the satellite timing information meets the preset timing conditions, the satellite timing module is identified as the target timing source.
[0071] If satellite timing information does not meet the preset timing conditions, the master clock node can obtain network timing information provided by the vehicle-mounted network timing device and determine whether the network timing information meets the preset timing conditions based on network connection status, timing message validity, or timing quality parameters. If the network timing information meets the preset timing conditions, the vehicle-mounted network timing device is identified as the target timing source. For example, the vehicle-mounted network timing device can provide network timing information through a network time protocol or a precision time protocol.
[0072] If neither satellite time synchronization information nor network time synchronization information meets the preset time synchronization conditions, the master clock node can read the local time provided by the real-time clock and determine the real-time clock as the target time synchronization source.
[0073] In this way, if the vehicle is located in an underground garage, tunnel, or other area where satellite and network signals are unavailable, the master clock node can still establish the time reference corresponding to the current target power-on operation cycle.
[0074] It should be noted that the aforementioned time source selection only occurs during the initialization phase. The master clock node determines the target time source from multiple candidate time sources during the initialization phase, but this does not mean that the time source will be switched based on the status of the candidate time sources during the subsequent operation of the target power-on cycle.
[0075] One possible implementation involves a master clock node comprising a clock source interface, a local timing component, a storage unit, and a control unit. Based on the initial timing information obtained from the target timing source and the locally stored initial local timing value, a fixed time base corresponding to the target power-on operation cycle is determined. This includes: setting the clock source interface to the initial timing state; obtaining initial timing information from the target timing source through the clock source interface; obtaining the initial local timing value corresponding to the time the initial timing information was obtained through the local timing component; establishing a correspondence between the initial timing information and the initial local timing value through the control unit; determining the fixed time base based on the correspondence; and storing the initial local timing value and the fixed time base in the storage unit.
[0076] The clock source interface can be a composite interface for communicating with different candidate time synchronization sources, or it can include multiple sub-interfaces that connect to the satellite time synchronization module, the vehicle-mounted network time synchronization device, and the real-time clock, respectively. The initialization time synchronization state indicates that the clock source interface has the capability to read and parse time synchronization information. In the initialization time synchronization state, the control unit can initiate the corresponding time synchronization processing task and call the interface function corresponding to the target time synchronization source to read and parse the initial time synchronization information.
[0077] The local timing component can generate a corresponding local timing value when reading the initial timing information. The control unit can read the timing value generated by the local timing component at the corresponding time based on the time the initial timing information is received or the time parsing is completed, and obtain the initial local timing value.
[0078] It should be noted that, in order to reduce the time deviation between the initial time synchronization information and the initial local timing value, the initial time synchronization information reception time and the local timing value can be synchronously latched by a hardware trigger signal, or the control unit can call the local timing component to complete the timing value reading when the initial time synchronization information is received.
[0079] The correspondence between initial time synchronization information and initial local timing value indicates that when the local timing component's timing value is the initial local timing value, the standard time corresponding to the master clock node is the standard time indicated by the initial time synchronization information. The control unit can use the standard time indicated by the initial time synchronization information as the starting point in the fixed time base and the initial local timing value as the starting point of the local timing. Subsequently, the master clock node can continuously determine the current standard time on the fixed time base based on the change in the local timing value relative to the initial local timing value.
[0080] The storage unit can be non-volatile memory, or it can include a non-volatile storage area and a runtime storage area. The control unit can associate and store a fixed time reference, initial local timing values, a cycle identifier for the target power-on operating cycle, and corresponding configuration parameters in the storage unit. When the vehicle experiences a partial software reset, domain controller restart, or sleep wake-up, it can read the fixed time reference corresponding to the current target power-on operating cycle based on the cycle identifier, avoiding the need to re-execute external time synchronization.
[0081] Another possible implementation involves initializing the time base based on authorized instructions received through the vehicle diagnostic interface after the vehicle enters dedicated diagnostic mode. Dedicated diagnostic mode can be divided into diagnostic operation cycles independent of the vehicle's normal driving state. Upon exiting dedicated diagnostic mode or after the vehicle is powered off again, the corresponding diagnostic operation cycle ends, thus avoiding changes to the fixed time base used during the normal target power-on operation cycle.
[0082] S302, after determining the fixed time reference, puts the master clock node into the reference lock state, and disables the time information reading permission, reference calibration permission and time synchronization call permission for the target time source during the target power-on operation cycle, so as to maintain the fixed time reference.
[0083] The reference lock state refers to the master clock node having completed the determination of the fixed time reference and no longer allowing the timing information provided by the target time source to change the operating state of the fixed time reference during the target's power-on operation cycle. After entering the reference lock state, the master clock node can still determine the current standard time based on the local timing value and send the current standard time to multiple slave clock nodes.
[0084] Time synchronization information reading permission refers to the permission to read and parse time data provided by the target time synchronization source. Reference calibration permission refers to the permission to update or correct a fixed time reference using time data provided by the target time synchronization source. Time synchronization invocation permission refers to the permission to invoke the time synchronization function corresponding to the target time synchronization source, enabling the target time synchronization source to participate in the determination of the current standard time.
[0085] Specifically, after the fixed time base is determined and stored, the master clock node can update the current running status, end the initialization time synchronization processing performed for the target time synchronization source, and close the time synchronization data transmission path between the target time synchronization source and the current standard time calculation process.
[0086] Once this permission is disabled, even if the target time source continues to provide time information, the subsequent time information provided by the target time source will not be used to update the fixed time base or correct the current standard time.
[0087] It should be noted that disabling the permissions to read timing information, perform reference calibration, and invoke time synchronization refers to disabling the relevant software permissions for the target timing source to participate in time calculations; it does not mean disconnecting the physical connection between the target timing source and the master clock node. The hardware link of the target timing source can remain connected, but the time data provided by the target timing source cannot enter the time calculation path of the master clock node.
[0088] One possible implementation involves setting a reference lock flag after storing the fixed time reference in the storage unit, causing the master clock node to enter a reference lock state. The initialization phase ends based on the reference lock flag, and the clock source interface is switched from the initial timing state to the locked operation state. In the locked operation state, the permissions for reading timing information, reference calibration, and time synchronization are kept disabled until the target power-on operation cycle ends.
[0089] The reference lock flag indicates that the fixed time reference corresponding to the current target power-on operation cycle has been determined. The reference lock flag can be stored in the control unit's status register, operating memory area, or non-volatile memory area.
[0090] Specifically, when the reference lock flag is in the unset state, the control unit can control the clock source interface to enter the initial timing state and perform operations such as target timing source selection, initial timing information reading, and fixed time reference determination. After the fixed time reference and initial local timing value are stored, the control unit updates the reference lock flag from the unset state to the set state.
[0091] Once the control unit detects that the reference lock flag is set, it can terminate the timing processing flow corresponding to the initialization phase and switch the clock source interface to the locked operation state. The locked operation state indicates that the clock source interface no longer provides time data from the target timing source to the current standard time calculation process.
[0092] In the event of a partial software reset, a single domain controller restart, or a sleep-wake-up scenario, the control unit can read the stored reference lock flag. While the reference lock flag remains set, the control unit maintains the locked state of the clock source interface and continues to use the fixed time reference corresponding to the current target power-on cycle.
[0093] When the vehicle is completely powered down or a hard reset of the entire vehicle ends the current target power-on operation cycle, the reference lock flag corresponding to the current target power-on operation cycle can be cleared or set to an invalid state. After the vehicle enters the next power-on operation cycle, the corresponding permissions are re-granted and a new fixed time reference is determined.
[0094] One possible implementation involves switching the clock source interface from the initialization timing state to the locked operation state, including: configuring the interface control register corresponding to the clock source interface; closing the data channel used to read timing information from the target timing source; stopping the scheduling of timing processing tasks used to read and parse timing information; and disabling the interface functions used to call the target timing source to perform reference calibration and time synchronization, so that the target timing source does not participate in the determination of the current standard time during the target power-on operation cycle.
[0095] The interface control register may include a data channel enable bit or an interface access control bit. The control unit can modify the data channel enable bit or the interface access control bit to stop the clock source interface from transmitting time data provided by the target time source to the time synchronization processing task.
[0096] A time synchronization processing task refers to a processing task used to read the target time synchronization source, parse time synchronization data, or perform external time synchronization. A time synchronization processing task can be a background task running according to a preset cycle. After the fixed time base is determined, the control unit can pause the time synchronization processing task, remove it from the task scheduling queue, or cancel the time synchronization processing task, so that the time synchronization processing task will no longer be scheduled for execution during the current target power-on operation cycle.
[0097] Interface functions can include timing information reading functions, reference calibration functions, and external time synchronization functions. The control unit can set corresponding function call interception flags, or cause the corresponding interface functions to return a call rejection result in a locked running state, thereby preventing other vehicle applications or background tasks from re-calling the target timing source through interface functions.
[0098] In this way, by forming multiple levels of permission isolation through interface control registers, time synchronization processing tasks, and interface functions, the target time synchronization source can be prevented from re-participating in the determination of the fixed time base or the current standard time after the initialization phase is completed.
[0099] Another possible implementation is that the clock source interface can retain a status monitoring function independent of the time synchronization data reading function. This status monitoring function can be used to obtain the physical connection status, signal abnormality flags, or device fault status of the target time synchronization source, but it does not read the time synchronization data used to determine the standard time, nor does it have reference calibration or time synchronization call permissions.
[0100] Specifically, when a signal interruption, signal recovery, or equipment malfunction is detected in the target time source, the master clock node can generate a corresponding time source status event and store the time source status event in the storage unit in association with the current standard time at the time of the event. This time source status event can be used for vehicle diagnostics or fault tracing, but it is not used as a trigger condition for switching the target time source, updating the fixed time reference, or correcting the current standard time.
[0101] It should be noted that during the target power-on operation cycle, even if other candidate time sources return to normal or provide time quality higher than the target time source selected during initialization, the master clock node still maintains the fixed time reference that has been determined and does not re-execute the time source selection. This avoids time jumps or rollbacks within the vehicle domain caused by time source switching or repeated calibration.
[0102] S303 determines the current standard time based on the initial local timing value, the fixed time base, and the current local timing value within the target power-on operation cycle.
[0103] The current local timing value refers to the timing value generated by the local timing component at the current moment within the target power-on operating cycle. The current standard time refers to the time determined by the master clock node based on a fixed time base and the local timing value, used to provide time synchronization to multiple slave clock nodes.
[0104] Specifically, the master clock node can determine the change in the current local time value relative to the initial local time value, and convert this change into the elapsed time from the time the initial time information was acquired to the current time, based on the timing parameters of the local timing component. The current standard time can be obtained by accumulating the elapsed time on the initial standard time represented by the fixed time base.
[0105] It should be noted that the current standard time is determined using only the fixed time base established during the initialization phase and the local timing value generated by the local timing component during the target power-on operation cycle. It is not necessary to reacquire the timing information provided by the target timing source.
[0106] One possible implementation involves a local timing component in the master clock node including a counter. The initial local timing value is the initial count value generated by the counter when initial timing information is acquired. The current local timing value is the current count value generated by the counter within the target power-on operating cycle. Based on the initial local timing value, a fixed time base, and the current local timing value within the target power-on operating cycle, the current standard time is determined, including: determining a count increment based on the current count value and the initial count value; determining a time increment based on the count increment and the counter's timing parameters; and determining the current standard time based on the fixed time base and the time increment.
[0107] The counter can be a unidirectional incrementing hardware counter. For example, the counter can be a 64-bit hardware counter. The timing parameters of the counter are used to represent the conversion relationship between the counter's count value and the time length, and can be determined based on the crystal oscillator frequency used to drive the counter, the frequency division factor, and the counting period.
[0108] Specifically, the master clock node can read the current count value generated by the counter according to a preset reading cycle, and calculate the difference between the current count value and the initial count value to obtain the cumulative count increment from the time of initial timing information acquisition to the current time. The master clock node converts the count increment into a time increment according to the timing parameters, and then adds the time increment to the initial standard time indicated by the fixed time base to obtain the current standard time.
[0109] For example, the preset read period can be from 1 millisecond to 10 milliseconds. The master clock node can read the current count value once in each preset read period and update the current standard time.
[0110] Another possible implementation is that the master clock node can determine the count increment between two adjacent reading moments, determine the corresponding local time increment based on each count increment, and then accumulate each local time increment to a fixed time base to obtain the current standard time.
[0111] In this way, the master clock node can continuously determine the time increment using a unidirectionally increasing hardware counter, without needing to directly modify the current standard time based on external time information, which is beneficial for maintaining the continuous increment of the current standard time.
[0112] In one possible implementation, the local timing component further includes a crystal oscillator for providing timing signals to the counter, and the master clock node further includes a temperature detection component. The time increment is determined based on the count increment and the counter's timing parameters, including: acquiring the crystal oscillator's temperature information through the temperature detection component; correcting the counter's timing parameters based on the temperature information and pre-stored drift compensation parameters; and determining the time increment based on the count increment and the corrected timing parameters.
[0113] The temperature information indicates the operating temperature of the crystal oscillator, and may include the ambient temperature of the crystal oscillator's location, the chip temperature of the master clock node, or the internal temperature of the crystal oscillator. The temperature detection component can be a temperature sensor located near the crystal oscillator, a chip temperature detection circuit located inside the master clock node, or a temperature acquisition interface connected to a vehicle ambient temperature sensor.
[0114] Drift compensation parameters are used to represent the frequency deviation of the crystal oscillator under different temperature conditions. Drift compensation parameters can be predetermined and stored in the memory unit during the vehicle production stage or the master clock node calibration stage.
[0115] Specifically, the actual output frequency of the crystal oscillator can be detected in multiple temperature ranges within a preset temperature range. Based on the deviation between the actual output frequency and the nominal output frequency, the drift compensation parameters for each temperature range can be determined. For example, the preset temperature range can be from -40 degrees Celsius to 85 degrees Celsius.
[0116] During vehicle operation, the temperature detection component acquires the crystal oscillator's temperature information according to a preset detection cycle. The master clock node determines the corresponding drift compensation parameters based on the temperature information and uses these parameters to correct the counter's timing parameters. The master clock node then determines the time increment based on the count increment and the corrected timing parameters.
[0117] It should be noted that the above drift compensation adjusts the conversion relationship between the local timing value and the time increment, without changing the fixed time base or using the target time source to recalibrate the current standard time.
[0118] For example, the local timing component can use a high-precision, low-temperature drift crystal oscillator with a nominal frequency accuracy of ±0.1 parts per million. Considering only the nominal frequency deviation mentioned above, the theoretical timing deviation generated by continuous vehicle operation for 8 hours is approximately ±2.88 milliseconds. In practical applications, crystal oscillator aging, temperature variations, and hardware errors can also be taken into account to control the cumulative timing error corresponding to the target power-on operation cycle of 1 to 8 hours within a preset allowable range, such as no more than 1 second.
[0119] In this way, local timing errors caused by temperature changes can be reduced without changing the fixed time base, so that the master clock node can continuously output the current standard time with accuracy that meets the vehicle's business needs during the target power-on operation cycle.
[0120] In one possible implementation, the local timing component also includes a backup crystal oscillator. The method further includes: when an abnormal operating state of the crystal oscillator is detected, switching the timing source used to provide the timing signal to the counter from the original crystal oscillator to the backup crystal oscillator. Recording the current standard time corresponding to the switching moment and the corresponding switching count value of the counter. Determining the count increment after the switch based on the current count value of the counter after the switch and the switching count value. Determining the time increment after the switch based on the count increment after the switch and the timing parameters corresponding to the backup crystal oscillator. Determining the current standard time after the switch based on the current standard time corresponding to the switching moment and the time increment after the switch.
[0121] Abnormal operating states of a crystal oscillator can include a stopped oscillator state, a crystal oscillator output frequency exceeding a preset frequency range, or a crystal oscillator hardware failure state. The master clock node can determine whether the crystal oscillator is in an abnormal operating state through a frequency detection circuit, a clock monitoring circuit, or a counting anomaly detection program.
[0122] Specifically, when the crystal oscillator is in normal working condition, it provides timing signals to the counter. When an abnormal working condition of the crystal oscillator is detected, the master clock node can control the backup crystal oscillator to take over providing timing signals to the counter and record the current standard time and switching count value corresponding to the switching moment.
[0123] After the timing source switch is completed, the master clock node can calculate the difference between the current count value and the switched count value to obtain the count increment after the switch, and determine the timing parameters corresponding to the backup crystal oscillator based on the frequency parameters and division parameters of the backup crystal oscillator. The master clock node determines the time increment after the switch based on the count increment after the switch and the timing parameters corresponding to the backup crystal oscillator, and then adds the time increment after the switch to the current standard time corresponding to the switch moment.
[0124] One possible implementation is that the master clock node can pre-store the frequency ratio between the crystal oscillator and the backup crystal oscillator. After switching the timing source to the backup crystal oscillator, the timing parameters corresponding to the backup crystal oscillator are corrected according to the frequency ratio, thereby reducing the timing deviation caused by the frequency difference between the master and backup crystal oscillators.
[0125] It should be noted that when the crystal oscillator malfunctions and switches to the backup crystal oscillator, only the timing source providing the timing signal to the counter is changed; the timing information provided by the target timing source is not reacquired, nor is the fixed time reference redefined. This allows local timing to continue even when the crystal oscillator experiences a hardware malfunction, and reduces the impact of timing source switching on the continuity of the current standard time.
[0126] S304 sends the current standard time to multiple slave clock nodes so that the multiple slave clock nodes can synchronize their local time according to the current standard time.
[0127] Local time synchronization refers to the process where a slave clock node adjusts its own local time based on the current standard time provided by the master clock node, so that multiple slave clock nodes use time information from the same source.
[0128] Specifically, the master clock node can generate a time synchronization message based on the current standard time and send it to multiple slave clock nodes via the vehicle communication network according to a preset sending period. Each slave clock node receives and parses the time synchronization message and adjusts its local time accordingly based on the current standard time carried in the message.
[0129] One possible implementation is that the master clock node selects the corresponding time synchronization protocol based on the network type of the vehicle communication network, and sends the current standard time to multiple slave clock nodes according to the selected time synchronization protocol.
[0130] Specifically, for slave clock nodes connected to the master clock node via in-vehicle Ethernet, the master clock node can send the current standard time using a generic precise time protocol or a time-sensitive network (TSN) time synchronization mechanism. For slave clock nodes connected to the master clock node via a controller area network (CAN), the master clock node can send the current standard time using a CAN time synchronization protocol.
[0131] For example, the master clock node can broadcast time synchronization messages at preset intervals of 20 milliseconds to 100 milliseconds. These time synchronization messages can carry the current standard time determined based on a fixed time base and local timing values, but do not carry external time synchronization information used to change the fixed time base. Multiple slave clock nodes perform local time synchronization solely based on the current standard time provided by the master clock node, without individually selecting an external time synchronization source.
[0132] One possible implementation involves the master clock node continuing to determine the current standard time based on a fixed time base and the current local time value when a communication interruption is detected between the master and slave clock nodes. The slave clock node uses the previously received current standard time as its local time starting point and maintains its local time based on the timing information generated by its local clock.
[0133] After communication is restored, the clock node re-receives the current standard time sent by the master clock node and resynchronizes its local time based on the current standard time. During communication interruption and restoration, the master clock node does not reacquire the time information provided by the target time source, nor does it change the fixed time base.
[0134] In this way, when the vehicular communication network is temporarily interrupted, the master clock node and each slave clock node can still maintain their own time operation. After the vehicular communication network is restored, each slave clock node can re-follow the current standard time provided by the master clock node, restoring time synchronization within the vehicle domain.
[0135] The above primarily describes the solutions provided in the embodiments of this application from the perspective of the device's working principle. It is understood that, in order to achieve the above functions, the in-vehicle time synchronization device includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the algorithm steps of the examples described in the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0136] This application embodiment can divide the vehicle-mounted time synchronization device into functional modules according to the above method example. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module.
[0137] It should be noted that the module division in this embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. When dividing functional modules according to their respective functions, Figure 4 A schematic diagram illustrating a possible configuration of the vehicle-mounted time synchronization device described above and in the embodiments is shown. Figure 3 As shown, the vehicle-mounted time synchronization device 300 may include: a determination module 401, a control module 402, and a transmission module 403.
[0138] The determining module 401 is used to support the execution of the on-board time synchronization device 400. Figure 3 S301 and S303 in the illustrated vehicle time synchronization method.
[0139] Control module 402 is used to support the execution of the on-board time synchronization device 400. Figure 3 S302 in the illustrated vehicle time synchronization method.
[0140] The sending module 403 is used to support the execution of the on-board time synchronization device 400. Figure 3 S304 in the illustrated vehicle time synchronization method.
[0141] One possible implementation includes a master clock node comprising a clock source interface, a local timing component, a storage unit, and a control unit. A determination module, used to determine the fixed time reference corresponding to the target power-on operation cycle based on initial timing information obtained from the target timing source and the locally stored initial local timing value, specifically performs the following: setting the clock source interface to the initial timing state; obtaining initial timing information from the target timing source through the clock source interface; obtaining the initial local timing value corresponding to the time of acquisition of the initial timing information through the local timing component; establishing the correspondence between the initial timing information and the initial local timing value through the control unit; determining the fixed time reference based on the correspondence; and storing the initial local timing value and the fixed time reference in the storage unit.
[0142] In one possible implementation, the vehicle-mounted time synchronization device provided in this application embodiment is further configured to: after storing the fixed time reference in the storage unit, set the reference locking flag to enable the master clock node to enter the reference locking state. The initialization phase ends based on the reference locking flag, and the clock source interface is switched from the initialization timing state to the locked operation state. In the locked operation state, the timing information reading permission, reference calibration permission, and time synchronization call permission are kept closed until the target power-on operation cycle ends.
[0143] One possible implementation involves a control module that, when switching the clock source interface from the initialization timing state to the locked operation state, specifically performs the following: configures the interface control register corresponding to the clock source interface; closes the data channel used to read timing information from the target timing source; stops scheduling timing processing tasks used to read and parse timing information; and disables the interface functions used to call the target timing source to perform reference calibration and time synchronization, so that the target timing source does not participate in the determination of the current standard time during the target power-on operation cycle.
[0144] One possible implementation involves a local timing component in the master clock node including a counter. The initial local timing value is the initial count value generated by the counter when initial timing information is acquired. The current local timing value is the current count value generated by the counter within the target power-on operating cycle. A determination module, used to determine the current standard time based on the initial local timing value, a fixed time base, and the current local timing value within the target power-on operating cycle, specifically performs the following: determining the count increment based on the current count value and the initial count value; determining the time increment based on the count increment and the counter's timing parameters; and determining the current standard time based on the fixed time base and the time increment.
[0145] In one possible implementation, the local timing component also includes a crystal oscillator for providing timing signals to the counter. The master clock node also includes a temperature detection component. The determination module, used to determine the time increment based on the count increment and the counter's timing parameters, specifically involves: acquiring the crystal oscillator's temperature information through the temperature detection component; correcting the counter's timing parameters based on the temperature information and pre-stored drift compensation parameters; and determining the time increment based on the count increment and the corrected timing parameters.
[0146] In one possible implementation, the local timing component further includes a backup crystal oscillator. The vehicle-mounted time synchronization device provided in this application embodiment is further configured to: switch the timing source used to provide timing signals to the counter from the original crystal oscillator to the backup crystal oscillator when an abnormal operating state of the crystal oscillator is detected; record the current standard time corresponding to the switching moment and the corresponding switching count value of the counter; determine the count increment after the switch based on the current count value of the counter after the switch and the switching count value; determine the time increment after the switch based on the count increment after the switch and the timing parameters corresponding to the backup crystal oscillator; and determine the current standard time after the switch based on the current standard time corresponding to the switching moment and the time increment after the switch.
[0147] It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0148] The vehicle-mounted time synchronization device 400 provided in this application embodiment is used to perform the above-mentioned... Figure 3 The vehicle time synchronization method shown can achieve the same effect as the vehicle time synchronization method described above.
[0149] This application also provides an in-vehicle time synchronization device, which can execute the in-vehicle time synchronization method and related steps in the above method embodiments.
[0150] This application also provides a computer-readable storage medium storing instructions thereon, which, when executed, perform the vehicle time synchronization method and related steps in the above method embodiments.
[0151] This application also provides a computer program product that, when run on a computer, causes the computer to execute the vehicle time synchronization method and related steps described in the above method embodiments.
[0152] In some embodiments, the methods shown in this application can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of art.
[0153] This application also provides an in-vehicle time synchronization system 100, such as... Figure 5 As shown, the vehicle time synchronization system 100 includes at least one processor 501 and at least one interface circuit 502.
[0154] As an example, when the in-vehicle time synchronization system 100 includes a processor and an interface circuit, the processor can be... Figure 5 The processor 501 shown in the solid box (or the processor 501 shown in the dashed box) can be an interface circuit. Figure 5 The interface circuit 502 is shown in the solid box (or the dashed box). When the on-board time synchronization system 100 includes two processors and two interface circuits, then the two processors include... Figure 5 The processor 501 shown in the solid box and the processor 501 shown in the dashed box, these two interface circuits include Figure 5 Interface circuit 502 is shown in both solid and dashed boxes. No limitations are imposed on this.
[0155] The processor 501 and the interface circuit 502 can be interconnected via a line. For example, the interface circuit 502 can be used to receive signals. Alternatively, the interface circuit 502 can be used to send signals to other devices (such as the processor 501). For instance, the interface circuit 502 can read computer instructions stored in memory and send those instructions to the processor 501. The processor 501 executes the instructions and, in conjunction with input / output devices, implements the various steps in the above embodiments, such as implementing... Figure 2 The methods illustrated are the steps performed in the embodiments shown. Of course, this on-board time synchronization system may also include other discrete components, and this application embodiment does not specifically limit this.
[0156] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0157] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0158] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0159] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0160] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to it, or all or part of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0161] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A vehicle-mounted time synchronization method, characterized in that, A master clock node is used in an on-board time synchronization system, the system further including multiple slave clock nodes communicatively connected to the master clock node; the method includes: During the initialization phase when the vehicle enters the target power-on operation cycle, the master clock node is granted permission to read the timing information of the target timing source. Based on the initial timing information obtained from the target timing source and the initial local timing value stored locally, the fixed time reference corresponding to the target power-on operation cycle is determined. After determining the fixed time reference, the master clock node is put into a reference lock state, and the time information reading permission, reference calibration permission and time synchronization call permission for the target time source are closed during the target power-on operation cycle, so as to maintain the fixed time reference. The current standard time is determined based on the initial local timing value, the fixed time reference, and the current local timing value within the target power-on operation cycle; The current standard time is sent to multiple slave clock nodes so that the multiple slave clock nodes can synchronize their local time according to the current standard time.
2. The method according to claim 1, characterized in that, The master clock node includes: a clock source interface, a local timing component, a storage unit, and a control unit; the step of determining the fixed time base corresponding to the target power-on operation cycle based on the initial timing information obtained from the target timing source and the locally stored initial local timing value includes: Set the clock source interface to the initial timing state, and obtain the initial timing information from the target timing source through the clock source interface; The local timing component is used to obtain the initial local timing value corresponding to the acquisition time of the initial timing information; The control unit establishes a correspondence between the initial time synchronization information and the initial local timing value. The fixed time reference is determined according to the correspondence, and the initial local timing value and the fixed time reference are stored in the storage unit.
3. The method according to claim 2, characterized in that, The method further includes: After storing the fixed time reference in the storage unit, the reference lock flag is set so that the master clock node enters the reference lock state; The initialization phase ends according to the reference lock flag, and the clock source interface is switched from the initial timing state to the locked operation state. In the locked operation state, the time information reading permission, the reference calibration permission, and the time synchronization call permission are kept closed until the target power-on operation cycle ends.
4. The method according to claim 3, characterized in that, Switching the clock source interface from the initial timing state to the locked operation state includes: Configure the interface control register corresponding to the clock source interface to close the data channel used to read the timing information of the target timing source; Stop scheduling time synchronization processing tasks used to read and parse the time synchronization information; The interface functions used to call the target time source to perform reference calibration and time synchronization are blocked, so that the target time source does not participate in the determination of the current standard time during the target power-on operation cycle.
5. The method according to claim 1, characterized in that, The local timing component in the master clock node includes a counter, wherein the initial local timing value is the initial count value generated by the counter when the initial timing information is acquired, and the current local timing value is the current count value generated by the counter within the target power-on operation cycle; The step of determining the current standard time based on the initial local timing value, the fixed time reference, and the current local timing value within the target power-on operation cycle includes: The count increment is determined based on the current count value and the initial count value; The time increment is determined based on the count increment and the timing parameters of the counter; The current standard time is determined based on the fixed time base and the time increment.
6. The method according to claim 5, characterized in that, The local timing component further includes a crystal oscillator for providing timing signals to the counter; the master clock node further includes a temperature detection component; determining the time increment based on the count increment and the timing parameters of the counter includes: The temperature information of the crystal oscillator is obtained through the temperature detection component; The timing parameters of the counter are corrected based on the temperature information and the pre-stored drift compensation parameters. The time increment is determined based on the count increment and the corrected timing parameters.
7. The method according to claim 6, characterized in that, The local timing component also includes a spare crystal oscillator; the method further includes: If the crystal oscillator is detected to be in an abnormal working state, the timing source used to provide timing signals to the counter will be switched from the crystal oscillator to the backup crystal oscillator; Record the current standard time corresponding to the switching moment and the switching count value corresponding to the counter; The count increment after the switch is determined based on the current count value of the counter after the switch and the switch count value. The time increment after switching is determined based on the count increment after switching and the timing parameters corresponding to the spare crystal oscillator; The current standard time after the switch is determined based on the current standard time corresponding to the switch time and the time increment after the switch.
8. A vehicle-mounted time synchronization device, characterized in that, A master clock node used in an on-board time synchronization system, the system further including multiple slave clock nodes communicatively connected to the master clock node; the device includes: The determination module is used to grant the master clock node permission to read the timing information of the target timing source during the initialization phase when the vehicle enters the target power-on operation cycle, and to determine the fixed time base corresponding to the target power-on operation cycle based on the initial timing information obtained from the target timing source and the initial local timing value stored locally. The control module is used to, after determining the fixed time reference, cause the master clock node to enter the reference locking state, and to disable the time information reading permission, reference calibration permission and time synchronization call permission for the target time source during the target power-on operation cycle, so as to maintain the fixed time reference. The determining module is further configured to determine the current standard time based on the initial local timing value, the fixed time reference, and the current local timing value within the target power-on operation cycle; The sending module is used to send the current standard time to multiple slave clock nodes so that the multiple slave clock nodes can synchronize their local time according to the current standard time.
9. A vehicle-mounted time synchronization device, characterized in that, The vehicle-mounted time synchronization device includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, and the processor executing the machine-executable instructions to implement the vehicle-mounted time synchronization method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the vehicle time synchronization method according to any one of claims 1 to 7.