CN112152747A - Vehicle-mounted multi-controller time synchronization method and system - Google Patents

Vehicle-mounted multi-controller time synchronization method and system Download PDF

Info

Publication number
CN112152747A
CN112152747A CN202011096841.9A CN202011096841A CN112152747A CN 112152747 A CN112152747 A CN 112152747A CN 202011096841 A CN202011096841 A CN 202011096841A CN 112152747 A CN112152747 A CN 112152747A
Authority
CN
China
Prior art keywords
synchronization
controller
internal
time
external
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011096841.9A
Other languages
Chinese (zh)
Other versions
CN112152747B (en
Inventor
孟德远
胡庭波
安向京
张梦轩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changsha Xingshen Intelligent Technology Co Ltd
Original Assignee
Changsha Xingshen Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Changsha Xingshen Intelligent Technology Co Ltd filed Critical Changsha Xingshen Intelligent Technology Co Ltd
Priority to CN202011096841.9A priority Critical patent/CN112152747B/en
Publication of CN112152747A publication Critical patent/CN112152747A/en
Application granted granted Critical
Publication of CN112152747B publication Critical patent/CN112152747B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0644External master-clock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0682Clock or time synchronisation in a network by delay compensation, e.g. by compensation of propagation delay or variations thereof, by ranging
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)
  • Electric Clocks (AREA)

Abstract

The invention discloses a vehicle-mounted multi-controller time synchronization method and a device, wherein the method comprises the following steps: one controller in each controller to be synchronized is configured as a master synchronization controller, the rest controllers are configured as slave synchronization controllers, the master synchronization controller uses a GNSS clock to carry out external synchronization, the master synchronization controller calculates external synchronization time difference, the master synchronization controller carries out internal synchronization with each slave synchronization controller, the master controller generates internal synchronization signals according to internal time and sends the internal synchronization signals and the external synchronization information to each slave synchronization controller, each slave synchronization controller calculates the internal synchronization time difference after receiving the internal synchronization signals, and each slave synchronization controller realizes external synchronization with the GNSS clock according to the internal synchronization time difference and the received external synchronization information. The invention has the advantages of simple realization method, low cost, high synchronization precision, capability of preventing local time jump when controlling time synchronization and the like.

Description

Vehicle-mounted multi-controller time synchronization method and system
Technical Field
The invention relates to the technical field of time synchronization of vehicle-mounted equipment, in particular to a method and a system for time synchronization of vehicle-mounted multiple controllers.
Background
In a vehicle system, a plurality of different types of controllers, such as an industrial personal computer, a TX2, an Xavier, an FPGA, an MCU, etc., are generally required to be configured, internal times of the various types of controllers are different, and in the distributed system, a global time is often required to be used for determining occurrence sequence of various events in the system, coordinating transmission of various messages, etc., so as to control and monitor a state of the system, and thus, local times of various components in the system need to be unified, i.e., clock synchronization is performed.
The currently common distributed high-precision time synchronization methods mainly include the following methods:
1. GNSS clock synchronization
The GNSS clock synchronization is a process of synchronizing the local clock and the time on the GPS satellite by utilizing a GNSS synchronous satellite signal and using a receiver to receive 1pps and serial port time information. The accuracy of the GNSS clock synchronization is in the sub-microsecond range.
However, since the GNSS clock synchronization needs to receive satellite signals and an outdoor antenna needs to be installed, the synchronization cannot be performed in a GNSS signal-free area, and when the GNSS clock synchronization is applied to synchronization of a plurality of controllers, each controller needs to be separately connected with a receiver, which causes a problem that all controllers cannot be completely synchronized when interference exists.
2. NTP clock synchronization
The network Time protocol NTP (network Time protocol) is developed from a Time protocol, ICMP timestamp messages and IP timestamp options, and the NTP is used to synchronize the Time of a computer client or server with another server, using a hierarchical Time distribution model. When configured, NTP can utilize redundant servers and multiple network paths to achieve high accuracy and reliability in time. High accuracy time can be provided even if the client is unable to contact a time server for a long time. NTP-based synchronization time is generated at the NTP server protocol layer and is affected by local area network load, and the synchronization precision is millisecond level.
However, the NTP clock synchronization method has the following problems: firstly, NTP clock synchronization needs to be erected with an NTP server, and cost and wiring harness are increased; second, NTP clock synchronization precision is lower and influenced by the network load of the local area network; thirdly, NTP clock synchronization modifies the local time, which results in local time jumps or time period changes during synchronization.
3. PTP clock synchronization
The PTP (precision Time protocol) protocol is a precision clock synchronization protocol defined in IEEE-1588, and the PTP protocol is designed mainly for environments in which relatively localized and networked systems and subnets are good, and internal components are relatively stable. The PTP protocol is widely applied to a distributed system due to the advantages of simple implementation, small occupied network and computing resources and the like. The PTP protocol may be implemented by hardware or software. Sub-micron accuracy is achieved when implemented in hardware, and millisecond accuracy is typically achieved when implemented in software.
However, the PTP clock synchronization method has the following problems: firstly, PTP clock synchronization requires the erection of a PTP server, and the cost and wiring harness are increased; secondly, the network node (switch) is required to support the PTP protocol to realize the sub-microsecond precision time synchronization; thirdly, PTP clock synchronization can modify local time, and local time jump or time period change can be caused during synchronization.
And some controllers in the vehicle-mounted system may not support NTP and PTP protocols, and the NTP and PTP clock synchronization method is not suitable for clock synchronization of each controller in the vehicle-mounted system. When the method is applied to time synchronization among multiple controllers, the clock synchronization mode in the prior art is adopted to connect each controller with a receiver or a server respectively, so that all the controllers cannot be completely synchronized when interference exists, and the method is not suitable for application with high requirements on time synchronization precision, such as an unmanned vehicle system which needs to reach microsecond precision, local time jump may exist during time synchronization of the controllers, and the unmanned vehicle system has high requirements on time synchronization and needs to reach microsecond precision.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: aiming at the technical problems in the prior art, the invention provides the vehicle-mounted multi-controller time synchronization method and the vehicle-mounted multi-controller time synchronization system which are simple in implementation method, low in cost, high in synchronization precision and capable of preventing local time jump during control time synchronization.
In order to solve the technical problems, the technical scheme provided by the invention is as follows:
a vehicle-mounted multi-controller time synchronization method comprises the following steps: one controller in each controller to be synchronized is configured as a master synchronization controller, the rest are configured as slave synchronization controllers, the master synchronization controller uses a GNSS clock to perform external synchronization, the master synchronization controller calculates the time difference between the internal time of the master synchronization controller and the GNSS time to obtain an external synchronization time difference, the master synchronization controller performs internal synchronization with each slave synchronization controller, the master controller generates an internal synchronization signal according to internal time and sends the internal synchronization signal and the external synchronization information message containing the external synchronization time difference to each slave synchronization controller, after each slave synchronization controller receives the internal synchronization signal, and calculating the internal time difference between each slave synchronous controller and the master synchronous controller to obtain an internal synchronous time difference, and realizing external synchronization with the GNSS clock by each slave synchronous controller according to the internal synchronous time difference and the received external synchronous information message.
Further, when the master synchronization controller uses the GNSS clock to perform external synchronization, specifically and respectively receiving an external synchronization 1PPS signal and a GPRMC message sent by the GNSS receiver, and when the valid external synchronization 1PPS signal and GPRMC message are continuously received for a preset number of times, the master synchronization controller synchronizes with the GNSS clock to calculate the external synchronization time difference.
Further, the method comprises the step of setting a first external synchronization flag bit for identifying whether external synchronization between the master synchronization controller and GNSS time is completed or not, wherein when the master synchronization controller carries out external synchronization, the first external synchronization flag bit is initially set to be invalid, and when the external synchronization time difference is calculated, the first external synchronization flag bit is set to be valid.
Further, the specific step of the master synchronization controller using the GNSS time signal for external synchronization includes:
s11, waiting for an external synchronization 1PPS signal sent by the GNSS receiver, and jumping to the step S12 when receiving the external synchronization 1PPS signal;
s12, judging whether the external synchronization 1PPS signal is effective or not, if so, accumulating the number of times of the 1PPS signal effective number, and jumping to the step S13, otherwise, clearing 0 both the number of times of the 1PPS signal effective number and the number of times of the GPRMC message effective number, and returning to the step S11;
s13, judging whether the number of times of the 1PPS signal effective number and the number of times of the GPRMC message effective number are both larger than a preset value, if so, jumping to the step S14, otherwise, returning to the step S11;
s14, subtracting the GPRMC time received in the previous frame from the internal time maintained by the master synchronization controller after adding 1 second to obtain the external synchronization time difference, setting the external synchronization flag bit to be valid, and jumping to the step S15;
s15, waiting for a GPRMC message sent by the GNSS receiver, and if the GPRMC message is received and is valid, jumping to step S16; otherwise, clearing 0 times of the 1PPS signal valid number and the GPRMC message valid number, and then jumping to the step S11;
and S16, accumulating the effective number times of the GPRMC messages, and jumping to the step S11 to continuously wait for the next external synchronization 1PPS signal.
Further, when the master synchronization controller performs internal synchronization with each slave synchronization controller, specifically, the master synchronization controller generates an internal 1PPS signal and an internal GPRMC time based on its own internal time, and sends the generated internal 1PPS signal, the internal GPRMC time, and the external synchronization information to each slave synchronization controller, respectively.
Further, when each slave synchronization controller performs internal synchronization, each slave synchronization controller receives the internal 1PPS signal, the internal GPRMC message, and the external synchronization information message sent by the master controller, and when the internal 1PPS signal and the internal GPRMC message that are continuously received to be valid are stabilized and reach a preset number of times, each slave synchronization controller synchronizes with the master synchronization controller, calculates the internal synchronization time difference, and updates the external synchronization state of each slave synchronization controller using the external synchronization time difference in the external synchronization information message if the external synchronization information message is valid.
Further, the method comprises the steps of setting a second external synchronization zone bit for identifying whether external synchronization between the slave synchronization controller and GNSS time is completed or not and setting an internal synchronization zone bit for identifying whether internal synchronization between the slave synchronization controller and the master synchronization controller is completed or not, initially setting the second external synchronization zone bit and the internal synchronization zone bit to be invalid, setting the internal synchronization zone bit to be valid when calculating the internal synchronization time difference, and setting the second external synchronization zone bit to be valid when receiving the external synchronization information message and the external synchronization information message.
Further, the specific step of performing internal synchronization by the slave synchronization controller includes:
s21, waiting for an internal 1PPS signal sent by the master synchronization controller, and jumping to the step S22 when receiving the internal 1PPS signal;
s22, judging whether the internal 1PPS signal is effective or not, if so, jumping to the step S23, otherwise, returning to the step S21;
s23, accumulating the effective number of times of the internal 1PPS signals, and jumping to the step S24;
s24, judging whether the number of times of the effective number of the internal 1PPS signal and the count of the number of times of the effective number of the internal GPRMC are both larger than a preset value, if so, jumping to the step S25, otherwise, jumping to the step S21;
s25, subtracting the current autonomous time of the slave synchronization controller from the received GPRMC time of the previous frame by adding 1 second, calculating the internal synchronization time difference, setting the internal synchronization flag bit to be effective, and jumping to the step S26;
s26, waiting for the internal GPRMC message, and if the internal GPRMC message is received and valid, jumping to step S27; otherwise, clearing 0 both the number of the internal 1PPS signal valid number and the number of the internal GPRMC valid number, and then jumping to the step S21;
s27, accumulating the effective number of times of the internal GPRMC, and jumping to the step S28;
s28, waiting for the external synchronization information message, if the external synchronization information message is received and is valid, setting an external synchronization mark of the slave synchronization controller to be valid, and setting external synchronization time to be the received external synchronization time; the jump step S21 continues to wait for the next internal 1PPS signal.
A vehicle-mounted multi-controller time synchronization system comprises a plurality of controllers to be synchronized, each controller to be synchronized carries out time synchronization according to the synchronization method, one end of a master synchronization controller is connected with a GNSS receiver, and the other end of the master synchronization controller is connected with each slave synchronization controller.
Furthermore, the controller is provided with one or more of an IO interface, a serial interface, an SPI interface and a network interface.
Compared with the prior art, the invention has the advantages that:
1. the invention discloses a vehicle-mounted multi-controller time synchronization method and a device, wherein secondary synchronization time is adopted, a master synchronization controller uses a GNSS clock for synchronization, the time difference between internal time and external GNSS time is calculated, meanwhile, the master synchronization controller sends external synchronization information and an internal synchronization signal generated according to the internal time to each slave synchronization controller, and the slave controllers use simulated GNSS clock for synchronization, and calculate the time difference between autonomous time and the internal time.
2. According to the vehicle-mounted multi-controller time synchronization method and device, only the master synchronization controller is connected with the GNSS receiver, the master synchronization controller is synchronized by using the GNSS clock, each slave synchronization controller and the master synchronization controller are internally synchronized, the problem of local time jump cannot exist in the time synchronization process, and the problem of local time jump generated in the time synchronization of the traditional controller can be solved.
3. The vehicle-mounted multi-controller time synchronization method and the device have the advantages that the synchronization precision can reach microsecond level, and the requirements of unmanned vehicle systems and the like on time synchronization can be met.
Drawings
Fig. 1 is a schematic diagram illustrating an implementation principle of the vehicle-mounted multi-controller time synchronization method according to the embodiment.
Fig. 2 is a schematic diagram of the internal synchronization flow of the master synchronization controller in this embodiment.
Fig. 3 is a schematic diagram illustrating the principle of the internal synchronization signal issued by the master synchronization controller in an embodiment of the present invention.
Fig. 4 is a schematic flow chart illustrating the implementation of external synchronization of the master synchronization controller in an embodiment of the present invention.
Fig. 5 is a schematic flow chart of the implementation of internal synchronization from the synchronization controller in the embodiment of the present invention.
Detailed Description
The invention is further described below with reference to the drawings and specific preferred embodiments of the description, without thereby limiting the scope of protection of the invention.
As shown in fig. 1, the vehicle-mounted multi-controller time synchronization method of the present embodiment includes: one controller in each controller to be synchronized is configured as a master synchronization controller, the rest controllers are configured as slave synchronization controllers, the master synchronization controller uses a GNSS clock to carry out external synchronization, the master synchronization controller calculates the time difference between the internal time of the master synchronization controller and the GNSS clock to obtain an external synchronization time difference, the master synchronization controller carries out internal synchronization with each slave synchronization controller, the master controller generates an internal synchronization signal according to the internal time and sends the internal synchronization signal and an external synchronization information message containing the external synchronization time difference to each slave synchronization controller, each slave synchronization controller calculates the internal time difference between each slave synchronization controller and the master synchronization controller to obtain an internal synchronization time difference after receiving the internal synchronization signal, and each slave synchronization controller realizes external synchronization with the clock according to the internal synchronization time difference and the received external synchronization information message.
In this embodiment, by using the secondary synchronization time, dividing the time into the external GNSS time and the internal time, after each controller to be synchronized is configured as a master controller and a slave controller, the master synchronization controller synchronizes using a GNSS clock, and calculates the time difference between the internal time and the external GNSS time, and simultaneously, the master synchronization controller sends the external synchronization information and the internal synchronization signal generated according to the internal time to each slave synchronization controller, and the slave controller synchronizes using an analog GNSS clock, and calculates the time difference between the autonomous time and the internal time, then the mapping from the autonomous time of the current controller to the external GNSS time is: the external GNSS time is autonomous time + internal synchronization time difference + external synchronization time difference. According to the method, only the master synchronization controller is connected with the GNSS receiver, in the time synchronization process, the master synchronization controller only needs to maintain the internal time and the external synchronization time difference between the master synchronization controller and the GNSS, and each slave synchronization controller only needs to maintain the internal time and the internal synchronization time difference between the slave synchronization controller and the master synchronization controller, so that the problem of local time jump is avoided in the time synchronization process, and the controllers can be ensured to realize high-precision time synchronization.
In this embodiment, when the master synchronization controller uses the GNSS clock to perform external synchronization, the master synchronization controller specifically and respectively receives an external synchronization 1PPS signal and a GPRMC message sent by the GNSS receiver, and when valid external synchronization 1PPS signals and GPRMC messages are continuously received for a preset number of times, the master synchronization controller synchronizes with the GNSS clock to calculate an external synchronization time difference.
In this embodiment, when the master synchronization controller performs internal synchronization with each slave synchronization controller, specifically, the master synchronization controller generates an internal 1PPS signal and an internal GPRMC time based on its own internal time, and transmits the generated internal 1PPS signal, the internal GPRMC time, and the external synchronization information to each slave synchronization controller.
As shown in fig. 2, in this embodiment, the main controller specifically times with its internal time, and determines whether the current time of the main controller is a whole second, if so, generates an internal 1PPS signal and a GPRMC message, and sends the 1PPS signal through the IO port, and sends the GPRMC message and an external synchronization information message through the serial port; and if not, the master controller generates an internal 1PPS signal and an internal GPRMC message by taking the time of the master controller as a reference, and issues a 1PPS signal through an IO port connected with each slave controller, and issues a GPRMC message and an external synchronization information message through a serial port.
In this embodiment, when each slave synchronization controller performs internal synchronization, each slave synchronization controller receives an internal 1PPS signal, an internal GPRMC message, and an external synchronization information message sent by the master controller, and when an effective internal 1PPS signal and an effective internal GPRMC message are continuously received and stabilized for a preset number of times, each slave synchronization controller synchronizes with the master synchronization controller, calculates an internal synchronization time difference, and updates an external synchronization state of each slave synchronization controller using an external synchronization time difference in the external synchronization information message if the external synchronization information message is effective.
Referring to fig. 1, in this embodiment, a specific GNSS receiver is connected to a master synchronization controller, receives a 1PPS (Pulse Per Second) Pulse synchronization signal sent by the GNSS receiver from an IO port, receives a GPRMC message sent by the GNSS receiver from a serial port, synchronizes the master synchronization controller with an external time after the two external synchronization signals are stabilized, and calculates an external synchronization time difference; the master synchronization controller generates an internal 1PPS signal and internal GPRMC time by taking the internal time of the master synchronization controller as a reference, sends the same 1PPS signal through an IO port connected with each slave synchronization controller, sends an internal GPRMC message and an external synchronization information message to each slave controller through a serial port, receives the internal 1PPS signal sent by the master synchronization controller from the IO port of the slave synchronization controller, receives the internal GPRMC message and the external synchronization information message sent by the master controller from the serial port, synchronizes the slave synchronization controller with the internal time after the 1PPS signal and the GPRMC message are stabilized, calculates an internal synchronization time difference, and updates the external synchronization state of the slave synchronization controller if the external synchronization information message is valid. In a specific application embodiment, the internal synchronization signal issued by the main controller is shown in fig. 3, where Δ t represents the synchronization pulse error of the internal 1PPS signal.
In the embodiment, the master synchronization controller receives the 1PPS signal and the GPRMC signal of the GNSS receiver, the GNSS clock is used for synchronization, and simultaneously the same analog 1PPS signal, the internal time GPRMC message and the external synchronization information message are sent to each slave synchronization controller, so that the GNSS clock can be simulated for synchronization, the time synchronization among the controllers can be conveniently and quickly realized, and the local time hopping can be avoided.
The GPRMC message and the external synchronization message are not limited to serial transmission, and may be transmitted in the form of SPI, local area network, or the like.
In this embodiment, the method further includes setting a first external synchronization flag for identifying whether external synchronization between the master synchronization controller and the GNSS clock is completed, where the first external synchronization flag is initially set to be invalid when the master synchronization controller performs the external synchronization, and the first external synchronization flag is set to be valid when the external synchronization time difference is calculated. In this embodiment, false is used for the first external synchronization flag to be invalid and True is used to be valid, the first external synchronization flag is set to be false initially, and when the external synchronization time difference is calculated, the first external synchronization flag is set to be True.
In this embodiment, the method further includes setting a second external synchronization flag for identifying whether external synchronization between the slave synchronization controller and the GNSS clock is completed, and setting an internal synchronization flag for identifying whether internal synchronization between the slave synchronization controller and the master synchronization controller is completed, where the second external synchronization flag and the internal synchronization flag are initially set to be invalid, the internal synchronization flag is set to be valid when an internal synchronization time difference is calculated, and the second external synchronization flag is set to be valid when an external synchronization information message is received and the external synchronization information message is valid. In this embodiment, the second outer synchronization flag bit and the inner synchronization flag bit are respectively invalid and True valid by using false, the second outer synchronization flag bit and the inner synchronization flag bit are false initially, the inner synchronization flag bit is set to True when the inner synchronization time difference is calculated, and the second outer synchronization flag bit is set to True when the outer synchronization information message is received.
As shown in fig. 4, in a specific application of the present invention, the specific steps of the master synchronization controller using the GNSS time signal to perform the external synchronization include:
s11, waiting for an external synchronization 1PPS signal sent by the GNSS receiver, and jumping to the step S12 when the external synchronization 1PPS signal is received;
s12, judging whether the external synchronization 1PPS signal is effective, if so, accumulating the number of times of the 1PPS signal effective number (namely adding 1 to the count), and jumping to the step S13, otherwise, returning to the step S11 after clearing 0 the number of times of the 1PPS signal effective number and the number of times of the GPRMC message effective number;
s13, judging whether the number of times of the valid number of the 1PPS signal and the number of times of the valid number of the GPRMC message are both larger than a preset value, if so, jumping to the step S14, otherwise, returning to the step S11;
s14, subtracting the GPRMC time received in the previous frame from the internal time maintained by the main synchronous controller after adding 1 second to obtain an external synchronous time difference, setting the external synchronous flag bit to be effective, and jumping to the step S15;
s15, waiting for a GPRMC message sent by the GNSS receiver in a specified time period, and if the GPRMC message is received in the time period and is valid, jumping to step S16; otherwise, clearing 0 the number of times of the 1PPS signal valid number and the number of times of the GPRMC message valid number, and then jumping to the step S11;
and S16, accumulating the valid number of times of the GPRMC message (namely adding 1 to the count), and continuing to wait for the next out-sync 1PPS signal by jumping to the step S11.
When judging whether the 1PPS signal is valid, specifically judging whether the current time and the rising edge time of the previous 1PPS signal are in the range of [1- Δ t,1+ Δ t ], wherein Δ t represents the synchronous pulse error of the external synchronous 1PPS signal, if yes, judging that the signal is valid, otherwise, judging that the signal is invalid. That is, in step S12, if the external synchronization signal triggers an interrupt (1PPS rising edge), it is determined whether the current time and the last 1PPS rising edge time are within the range of [1- Δ t,1+ Δ t ], and if yes, the step S13 is skipped; otherwise, the step S11 is skipped after clearing 0 of both the count of 1pps signal valid times and the count of GPRMC valid times.
As shown in fig. 5, in this embodiment, the specific steps of performing internal synchronization from the synchronization controller in the present embodiment include:
s21, waiting for an internal 1PPS signal sent by the master synchronization controller, and jumping to the step S22 when receiving the internal 1PPS signal;
s22, judging whether the internal 1PPS signal is effective or not, if so, jumping to the step S23, otherwise, returning to the step S21;
s23, accumulating the number of times of the effective number of the internal 1PPS signals (namely adding 1 to the count), and jumping to the step S24;
s24, judging whether the number of times of the effective number of the internal 1PPS signal and the count of the number of times of the effective number of the internal GPRMC are both larger than a preset value, if so, jumping to the step S25, otherwise, jumping to the step S21;
s25, subtracting the current autonomous time of the slave synchronization controller from the received internal GPRMC time of the previous frame by adding 1 second, calculating an internal synchronization time difference, setting an internal synchronization flag bit to be effective, and jumping to the step S26;
s26, waiting for the internal GPRMC message, and if the internal GPRMC message is received and valid, jumping to step S27; otherwise, clearing 0 both the number of the internal 1PPS signal valid number and the number of the internal GPRMC valid number, and then jumping to the step S21;
s27, accumulating the effective number of times of the internal GPRMC (namely adding 1 to the count), and jumping to the step S28;
s28, waiting for the external synchronization information message in a specified time period, if the external synchronization information message is received in the time period and is valid, setting the external synchronization mark of the slave synchronization controller to be valid, and setting the external synchronization time to be the received external synchronization time; the jump step S21 continues to wait for the next internal 1PPS signal.
In step S22, specifically, if the internal synchronization signal triggers an interrupt (1PPS rising edge), it is determined whether the current time and the previous 1PPS rising edge time are within the range of [1- Δ t,1+ Δ t ], where Δ t represents an internal synchronization 1PPS pulse error, and is different depending on the model of the master synchronization controller (FPGA is 100us, MCU is 1ms, and high-precision clock synchronizer is 10ns), if the skip step S23 is satisfied; otherwise, the internal 1pps signal valid number count and the internal GPRMC valid number count are both cleared by 0, and then the process goes to step S21.
The embodiment also provides a vehicle-mounted multi-controller time synchronization system, which comprises a plurality of controllers to be synchronized, each controller to be synchronized performs time synchronization according to the time synchronization method, one end of the master synchronization controller is connected with the GNSS receiver, the other end of the master synchronization controller is connected with each slave synchronization controller, and the controllers are provided with an IO interface, a serial interface, an SPI interface, a network interface and the like, so as to be used for communication between the master synchronization controller and the GNSS receiver, and between the master synchronization controller and each slave synchronization controller.
The foregoing is considered as illustrative of the preferred embodiments of the invention and is not to be construed as limiting the invention in any way. Although the present invention has been described with reference to the preferred embodiments, it is not intended to be limited thereto. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical spirit of the present invention should fall within the protection scope of the technical scheme of the present invention, unless the technical spirit of the present invention departs from the content of the technical scheme of the present invention.

Claims (10)

1. A vehicle-mounted multi-controller time synchronization method is characterized by comprising the following steps: one controller in each controller to be synchronized is configured as a master synchronization controller, the rest are configured as slave synchronization controllers, the master synchronization controller uses a GNSS clock to perform external synchronization, the master synchronization controller calculates the time difference between the internal time of the master synchronization controller and the GNSS time to obtain an external synchronization time difference, the master synchronization controller performs internal synchronization with each slave synchronization controller, the master controller generates an internal synchronization signal according to internal time and sends the internal synchronization signal and the external synchronization information message containing the external synchronization time difference to each slave synchronization controller, after each slave synchronization controller receives the internal synchronization signal, and calculating the internal time difference between each slave synchronous controller and the master synchronous controller to obtain an internal synchronous time difference, and realizing external synchronization with the GNSS clock by each slave synchronous controller according to the internal synchronous time difference and the received external synchronous information message.
2. The vehicle-mounted multi-controller time synchronization method according to claim 1, characterized in that: the method comprises the steps that when the master synchronization controller uses a GNSS clock to carry out external synchronization, an external synchronization 1PPS signal and a GPRMC message sent by a GNSS receiver are specifically and respectively received, and when the effective external synchronization 1PPS signal and the effective GPRMC message are continuously received for a preset number of times, the master synchronization controller is synchronized with the GNSS clock to calculate the external synchronization time difference.
3. The on-vehicle multi-controller time synchronization method according to claim 2, further comprising setting a first external synchronization flag for identifying whether external synchronization between the master synchronization controller and the GNSS time is completed, wherein when the master synchronization controller performs the external synchronization, the first external synchronization flag is initially set to be invalid, and when the external synchronization time difference is calculated, the first external synchronization flag is set to be valid.
4. The on-board multi-controller time synchronization method according to claim 3, wherein the step of using the GNSS time signal to perform external synchronization by the master synchronization controller comprises:
s11, waiting for an external synchronization 1PPS signal sent by the GNSS receiver, and jumping to the step S12 when receiving the external synchronization 1PPS signal;
s12, judging whether the external synchronization 1PPS signal is effective or not, if so, accumulating the number of times of the 1PPS signal effective number, and jumping to the step S13, otherwise, clearing 0 both the number of times of the 1PPS signal effective number and the number of times of the GPRMC message effective number, and returning to the step S11;
s13, judging whether the number of times of the 1PPS signal effective number and the number of times of the GPRMC message effective number are both larger than a preset value, if so, jumping to the step S14, otherwise, returning to the step S11;
s14, subtracting the GPRMC time received in the previous frame from the internal time maintained by the master synchronization controller after adding 1 second to obtain the external synchronization time difference, setting the external synchronization flag bit to be valid, and jumping to the step S15;
s15, waiting for a GPRMC message sent by the GNSS receiver, and if the GPRMC message is received and is valid, jumping to step S16; otherwise, clearing 0 times of the 1PPS signal valid number and the GPRMC message valid number, and then jumping to the step S11;
and S16, accumulating the effective number times of the GPRMC messages, and jumping to the step S11 to continuously wait for the next external synchronization 1PPS signal.
5. The vehicle-mounted multi-controller time synchronization method according to any one of claims 1 to 4, wherein when the master synchronization controller performs internal synchronization with each slave synchronization controller, specifically, the master synchronization controller generates an internal 1PPS signal and an internal GPRMC time based on its internal time, and sends the generated internal 1PPS signal, internal GPRMC time and the external synchronization information to each slave synchronization controller respectively.
6. The vehicle-mounted multi-controller time synchronization method according to claim 5, wherein each slave synchronization controller receives the internal 1PPS signal, the internal GPRMC message and the external synchronization information message sent by the master controller when performing internal synchronization, and synchronizes with the master synchronization controller when the internal 1PPS signal and the internal GPRMC message which are valid are continuously received and stabilized for a preset number of times, calculates the internal synchronization time difference, and updates the external synchronization state of each slave synchronization controller by using the external synchronization time difference in the external synchronization information message if the external synchronization information message is valid.
7. The on-vehicle multi-controller time synchronization method according to claim 6, further comprising setting a second external synchronization flag for identifying whether external synchronization between the slave synchronization controller and the GNSS time is completed, and an internal synchronization flag for identifying whether internal synchronization between the slave synchronization controller and the master synchronization controller is completed, initially setting both the second external synchronization flag and the internal synchronization flag to be invalid, setting the internal synchronization flag to be valid when the internal synchronization time difference is calculated, and setting the second external synchronization flag to be valid when the external synchronization information message is received and the external synchronization information message is valid.
8. The vehicle-mounted multi-controller time synchronization method according to claim 7, wherein the specific step of performing internal synchronization by the slave synchronization controller comprises the following steps:
s21, waiting for an internal 1PPS signal sent by the master synchronization controller, and jumping to the step S22 when receiving the internal 1PPS signal;
s22, judging whether the internal 1PPS signal is effective or not, if so, jumping to the step S23, otherwise, returning to the step S21;
s23, accumulating the effective number of times of the internal 1PPS signals, and jumping to the step S24;
s24, judging whether the number of times of the effective number of the internal 1PPS signal and the count of the number of times of the effective number of the internal GPRMC are both larger than a preset value, if so, jumping to the step S25, otherwise, jumping to the step S21;
s25, subtracting the current autonomous time of the slave synchronization controller from the received GPRMC time of the previous frame by adding 1 second, calculating the internal synchronization time difference, setting the internal synchronization flag bit to be effective, and jumping to the step S26;
s26, waiting for the internal GPRMC message, and if the internal GPRMC message is received and valid, jumping to step S27; otherwise, clearing 0 both the number of the internal 1PPS signal valid number and the number of the internal GPRMC valid number, and then jumping to the step S21;
s27, accumulating the effective number of times of the internal GPRMC, and jumping to the step S28;
s28, waiting for the external synchronization information message, if the external synchronization information message is received and is valid, setting an external synchronization mark of the slave synchronization controller to be valid, and setting external synchronization time to be the received external synchronization time; the jump step S21 continues to wait for the next internal 1PPS signal.
9. An on-vehicle multi-controller time synchronization system, comprising a plurality of controllers to be synchronized, wherein each controller to be synchronized performs time synchronization according to the synchronization method as claimed in any one of claims 1 to 8, one end of the master synchronization controller is connected with a GNSS receiver, and the other end of the master synchronization controller is respectively connected with each slave synchronization controller.
10. The vehicle-mounted multi-controller time synchronization system according to claim 9, characterized in that: the controller is provided with one or more of an IO interface, a serial interface, an SPI interface and a network interface.
CN202011096841.9A 2020-10-14 2020-10-14 Time synchronization method and system for vehicle-mounted multi-controller Active CN112152747B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011096841.9A CN112152747B (en) 2020-10-14 2020-10-14 Time synchronization method and system for vehicle-mounted multi-controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011096841.9A CN112152747B (en) 2020-10-14 2020-10-14 Time synchronization method and system for vehicle-mounted multi-controller

Publications (2)

Publication Number Publication Date
CN112152747A true CN112152747A (en) 2020-12-29
CN112152747B CN112152747B (en) 2023-07-21

Family

ID=73953036

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011096841.9A Active CN112152747B (en) 2020-10-14 2020-10-14 Time synchronization method and system for vehicle-mounted multi-controller

Country Status (1)

Country Link
CN (1) CN112152747B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1910900A1 (en) * 2005-07-27 2008-04-16 Selex Sensors and Airborne Systems Limited System and method for determining the time difference between two platforms
CN101895383A (en) * 2010-07-07 2010-11-24 中国人民解放军国防科学技术大学 External clock synchronization system and control flow thereof
CN103401672A (en) * 2013-07-24 2013-11-20 福建星网锐捷网络有限公司 Time synchronization device, equipment and system
US20190222407A1 (en) * 2018-01-17 2019-07-18 Mitsubishi Electric Corporation Master control device and synchronous communication system using same
CN110113127A (en) * 2019-06-05 2019-08-09 深圳市英特瑞半导体科技有限公司 A kind of method and its system based on 1588 agreement passing times

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1910900A1 (en) * 2005-07-27 2008-04-16 Selex Sensors and Airborne Systems Limited System and method for determining the time difference between two platforms
CN101895383A (en) * 2010-07-07 2010-11-24 中国人民解放军国防科学技术大学 External clock synchronization system and control flow thereof
CN103401672A (en) * 2013-07-24 2013-11-20 福建星网锐捷网络有限公司 Time synchronization device, equipment and system
US20190222407A1 (en) * 2018-01-17 2019-07-18 Mitsubishi Electric Corporation Master control device and synchronous communication system using same
CN110113127A (en) * 2019-06-05 2019-08-09 深圳市英特瑞半导体科技有限公司 A kind of method and its system based on 1588 agreement passing times

Also Published As

Publication number Publication date
CN112152747B (en) 2023-07-21

Similar Documents

Publication Publication Date Title
US9606219B2 (en) Systems and methods for locating a target in a GPS-denied environment
CA2824550C (en) Transfer of synchronization in a hybrid global navigation satellite packet network system
US20110090925A1 (en) Method for synchronization in networks
US20090086764A1 (en) System and method for time synchronization on network
EP3629499A1 (en) Gnss-based multi-modal clock correction
CN110267200A (en) A kind of base station positioning method based on precise synchronization network
CN112929122A (en) Time synchronization method and device, terminal equipment and computer readable storage medium
WO2020043181A1 (en) Clock synchronization method and apparatus, system, storage medium, and electronic device
JP2000148286A (en) Time value distribution system
US20010023464A1 (en) Time synchronization of units in a system
US20170214479A1 (en) Method for transmitting time synchronization messages in a communication network, network component, and communication network
US6983160B2 (en) Base site and method for GPS-based regional time synchronization
CN110620630B (en) Time synchronization method, device, network equipment and computer readable storage medium
CN105634641A (en) Precise timing system and method based on cascade network communication of switching architecture
CN110572231A (en) Time synchronization method, device and equipment
CN112152747B (en) Time synchronization method and system for vehicle-mounted multi-controller
CN116545568A (en) System and method for adding ultra-high precision time stamp of short wave signal
JP6674400B2 (en) Time synchronization system and time synchronization method
WO2023044802A1 (en) Time synchronization method and related apparatus
CN112583513A (en) Cloud platform clock time service method and system
CN112468254B (en) Reconfigurable distributed node high-precision time service synchronization system and method
Baumgartner et al. Implementation and transition concepts for IEEE 1588 precision timing in IEC 61850 substation environments
CN116455498B (en) Time service method, system and intelligent driving equipment
CN219287537U (en) Clock synchronization device and mobile terminal
KR20080101503A (en) Node apparatus for clock synchronization in distributed system and method for clock synchronization

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant