[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN115085851B - Vehicle-mounted ECU time synchronization method and device, vehicle-mounted ECU and storage medium - Google Patents

Vehicle-mounted ECU time synchronization method and device, vehicle-mounted ECU and storage medium Download PDF

Info

Publication number
CN115085851B
CN115085851B CN202210850010.9A CN202210850010A CN115085851B CN 115085851 B CN115085851 B CN 115085851B CN 202210850010 A CN202210850010 A CN 202210850010A CN 115085851 B CN115085851 B CN 115085851B
Authority
CN
China
Prior art keywords
time
synchronization
slave unit
correction
local
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.)
Active
Application number
CN202210850010.9A
Other languages
Chinese (zh)
Other versions
CN115085851A (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.)
Shenzhen Xugang Electronics Co ltd
Original Assignee
Shenzhen Xugang Electronics 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 Shenzhen Xugang Electronics Co ltd filed Critical Shenzhen Xugang Electronics Co ltd
Priority to CN202210850010.9A priority Critical patent/CN115085851B/en
Publication of CN115085851A publication Critical patent/CN115085851A/en
Application granted granted Critical
Publication of CN115085851B publication Critical patent/CN115085851B/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/0682Clock or time synchronisation in a network by delay compensation, e.g. by compensation of propagation delay or variations thereof, by ranging
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C5/00Registering or indicating the working of vehicles
    • G07C5/08Registering or indicating performance data other than driving, working, idle, or waiting time, with or without registering driving, working, idle or waiting time
    • G07C5/0841Registering performance data
    • G07C5/085Registering performance data using electronic data carriers
    • 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/0685Clock or time synchronisation in a node; Intranode synchronisation

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

The embodiment of the invention discloses a vehicle-mounted ECU time synchronization method and device, a vehicle-mounted ECU and a storage medium. The method comprises the following steps: the master unit records the current local time as the synchronization time, sends a synchronization start signal to the slave unit through a connected IO interface, simultaneously sends the synchronization time to the slave unit through the communication interface, and then sends a synchronization completion signal to the slave unit through the IO interface; when receiving a synchronization start signal transmitted by the master unit, the slave unit records the local time at that time as a first correction time, and when receiving the synchronization time, records the local time at that time as a second correction time; the slave unit corrects the current local time based on the synchronization time, the first correction time, and the second correction time, and completes time synchronization once. It is not dependent on special interface and communication protocol, and has wide application range.

Description

Vehicle-mounted ECU time synchronization method and device, vehicle-mounted ECU and storage medium
Technical Field
The invention relates to the field of time synchronization, in particular to a vehicle-mounted ECU time synchronization method and device, a vehicle-mounted ECU and a storage medium.
Background
With the increase of the demand of the computing power of the vehicle-mounted ECU, the complexity of the architecture of the ECU is increased day by day, and not only time synchronization is needed among different vehicle-mounted ECUs, but also time synchronization is needed among a plurality of modules in the ECU. The traditional time synchronization scheme aims at the scheme among different ECUs. Because the timing precision of the hardware timer in each module is different, the time difference measured by each module is larger along with the longer time of the timing, and in order to solve the problem, the execution time synchronization of each module in the ECU is needed.
Disclosure of Invention
In view of this, the present application provides a vehicle-mounted ECU time synchronization method, including a master unit and at least one slave unit, where the master unit and each slave unit are connected through a communication interface and an IO interface respectively; the method comprises the following steps:
the master unit records the current local time as the synchronization time, sends a synchronization start signal to the slave unit through the connected IO interface, simultaneously sends the synchronization time to the slave unit through the communication interface, and then sends a synchronization completion signal to the slave unit through the IO interface;
the slave unit records the local time as a first correction time when receiving the synchronization start signal sent by the master unit, and records the local time as a second correction time when receiving the synchronization time;
the slave unit corrects the local time based on the synchronization time, the first correction time, and the second correction time.
Further, in the case that the number of time synchronizations is greater than 1, when the slave unit corrects the local time, the method further includes:
calculating a current deviation ratio between the slave unit and the master unit according to the synchronization time and the first correction time generated in the current time synchronization and the last time synchronization respectively;
and correcting the local time according to the current deviation rate, the current synchronization time and the current first correction time.
Further, the method also comprises the following steps:
calculating the deviation ratio between the slave unit and the master unit once after each time of performing the time synchronization for a preset number of times, for correcting the current local time.
Further, the deviation ratio is calculated by the following formula:
Rrc N =(Tm N -Tm N-1 )/(Ts 2*N -Ts 2*N-2 );
in the formula, rrc N Is the deviation rate of the (N + 1) th time synchronization, N is more than or equal to 0 N Is the synchronization time, tm, of the N +1 th time synchronization N-1 Synchronization time, ts, for N time synchronizations 2*N At the time of N +1First correction time of inter-synchronization, ts 2*N-2 Is the first correction time of the Nth time synchronization.
Further, a calculation formula for performing the correction of the local time according to the current deviation ratio, the current synchronization time, and the current first correction time is as follows:
T now =Tm N +( Ts now -Ts 2*N )*Rrc N
in the formula, T now For corrected local time, ts now For the local time of the slave unit when making corrections, rrc N Is the deviation ratio, tm, at the time of the N +1 time synchronization N Is the synchronization time, ts, of the N +1 th time synchronization 2*N Is the first correction time at the time of the (N + 1) th time synchronization.
Further, the slave unit corrects the local time according to the calculation formula of the synchronization time, the first correction time, and the second correction time, which is:
T now =Tm+(Ts 2 -Ts 1 )
in the formula, T now Represents corrected local time, ts 2 Represents the second correction time, ts 1 Represents the first correction time, and Tm is the synchronization time;
if the time when the local time correction is performed is after the second correction time, a calculation formula for performing the local time correction is as follows:
T now =Tm+( Ts now -Ts 1 )
in the formula, ts now To the local time of the slave unit when making corrections.
Further, the communication interface is Uart;
the synchronization start signal and the synchronization completion signal are both a level state change signal;
when the slave unit receives the synchronization starting signal, recording the local time at the time as first correction time;
when the slave unit detects that the IO interface changes from low level to high level or from high level to low level, recording the current local time as a first correction time.
Further, the present application also provides a vehicle-mounted ECU time synchronization apparatus, including:
the synchronous time sending module is used for recording the current local time as synchronous time by the main unit, sending a synchronous starting signal to the slave unit through the connected IO interface, sending the synchronous time to the slave unit through the communication interface, and sending a synchronous finishing signal to the slave unit through the IO interface;
the synchronous time recording module is used for recording the local time as a first correction time when the slave unit receives the synchronous start signal sent by the master unit and recording the local time as a second correction time when the synchronous time is received;
and the synchronous time correction module is used for correcting the local time by the slave unit according to the synchronous time, the first correction time and the second correction time.
Further, the present application also provides an in-vehicle ECU, which includes a processor and a memory, where the memory stores a computer program, and the computer program executes the time synchronization method of the in-vehicle ECU in any one of the above embodiments when running on the processor.
Further, the present application also provides a readable storage medium, which stores a computer program, where the computer program, when executed on a processor, executes the vehicle-mounted ECU time synchronization method described in any one of the above embodiments.
The embodiment of the invention discloses a vehicle-mounted ECU time synchronization method, a device, a vehicle-mounted ECU and a storage medium, wherein the vehicle-mounted ECU time synchronization method comprises a main unit and at least one slave unit, wherein the main unit is connected with each slave unit through a communication interface and an IO interface; the method comprises the following steps: the master unit records the current local time as synchronous time, sends a synchronous starting signal to the slave unit through IO, simultaneously sends the synchronous time to the slave unit through the communication interface, and then sends a synchronous finishing signal to the slave unit through IO; when the slave unit receives a synchronization start signal transmitted by the master unit, recording the local time at the moment as a first correction time, and when the slave unit receives the synchronization time, recording the local time at the moment as a second correction time; and the slave unit corrects the current local time according to the synchronous time, the first correction time and the second correction time to finish time synchronization once. The system does not depend on a special interface and a communication protocol, uses less resources and has wide application range, so that each unit module in the vehicle-mounted ECU can carry out time synchronization through a simple structure.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings required to be used in the embodiments will be briefly described below, and it should be understood that the following drawings only illustrate some embodiments of the present invention, and therefore should not be considered as limiting the scope of the present invention. Like components are numbered similarly in the various figures.
FIG. 1 is a schematic diagram illustrating an internal structure of a vehicle ECU according to the present application;
FIG. 2 is a flow chart of a vehicle ECU time synchronization method of the present application;
FIG. 3 is a flow chart of yet another on-board ECU time synchronization method of the present application;
FIG. 4 shows a timing diagram of an onboard ECU time synchronization method of the present application;
FIG. 5 shows a schematic diagram of an in-vehicle ECU time synchronization apparatus of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present invention, are only intended to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present invention belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments of the present invention.
The technical solution of the present application is explained with specific examples.
Example 1
In the present embodiment, a plurality of functional modules are arranged in the vehicle-mounted ECU system, and time synchronization is required between the modules, and in the present application, time synchronization between the main unit and a plurality of slave units is realized by selecting one main unit, specifically, the main unit and each slave unit are connected through a communication interface and an IO interface, for example, the communication interface may be a Uart (universal asynchronous receiver transmitter) or other interface capable of transmitting data.
The specific connection relationship is shown in fig. 1. In a vehicle-mounted ECU, a main unit can be connected with three slave units through the mode, a UART serves as a data transmission channel, an IO interface serves as a transmission channel of an interrupt signal, and the two-channel mode enables a signal of the time which passes synchronization and the signal of the start of sending synchronization to be sent out almost synchronously, so that the signal transmission delay in the synchronization process is reduced.
The master unit may be a single module unit dedicated to time synchronization, and the other slave units may be specific functional units, such as functional modules in the vehicle-mounted ECU system, such as a driving module, a display module, and a suspension module.
The application provides a time synchronization method in an on-board ECU system, and the steps of the method are shown in FIG. 2.
And S100, the master unit records the current local time as the synchronization time, sends a synchronization start signal to the slave unit through IO, simultaneously sends the synchronization time to the slave unit through the communication interface, and then sends a synchronization completion signal to the slave unit through IO.
The time synchronization can be performed according to a preset cycle period, when the internal module of the ECU is just powered on, the main unit and the slave unit start internal hardware timers to time, and then the first synchronization can be performed. When the first synchronization is performed, the master keeps track of the current time and sends a synchronization start signal from the IO interface to the slave, which may be a level signal, e.g. high or low, and if the IO interface of the slave is low at the time of the non-synchronization, the synchronization start signal is high, which generates a level change by pulling the IO level of the slave high. Similarly, if the IO interface of the slave unit is at a high level when the slave unit is not synchronized, the synchronization start signal is at a low level.
Since the interface for transmitting the synchronization start signal and the synchronization time is different, when the cycle is reached, the synchronization start signal is transmitted, and at the same time, the current local time recorded by the master unit is transmitted, and the current local time is transmitted as the synchronization time to the slave unit, and the synchronization time is recorded as Tm.
After the synchronization time is transmitted, the task of the master unit is finished, and the IO interface level of the slave unit needs to be reset, so that a synchronization completion signal needs to be transmitted, the synchronization completion signal is opposite to the synchronization start signal, and the synchronization start signal is at a high level, and the synchronization completion signal is at a low level. And meanwhile, the starting signal is in a low level, and the synchronization completion signal is in a high level.
Step S200, when receiving the synchronization start signal sent by the master unit, the slave unit records the local time at that time as a first correction time, and when receiving the synchronization time, the slave unit records the local time at that time as a second correction time.
When the slave unit receives a synchronization start signal at an IO interface, the slave unit immediately records a local time Ts1 as a first correction time, and when receiving a synchronization time Tm, records a current local time Ts2 as a second correction time.
It can be seen that, the first calibration time and the synchronization time omit the signal transmission delay of the IO interface, which should be the same time point theoretically, and the synchronization time is transmitted through the communication interface and has a certain transmission delay, so that the accuracy of the synchronization time can be ensured by recording the delay obtained by the second calibration time.
And step S300, the slave unit corrects the current local time according to the synchronous time, the first correction time and the second correction time, and completes time synchronization once.
After the synchronization time is obtained, the local time of the slave unit can be corrected after the first correction time and the second correction time are obtained, so that time synchronization is completed once, and a specific correction formula is as follows:
Tnow=Tm+(Ts2-Ts1)
where Tnow represents the corrected local time, ts2 represents the second corrected time, and Ts1 represents the first corrected time.
The local time calculated by the above equation is the master time corresponding to the slave unit at the second correction time, so as to obtain the corrected local time, and if the time when the local time correction is performed is after the second correction time, the calculation equation for performing the correction of the local time is as follows:
Tnow=Tm+( Tsnow -Ts1)
where Tsnow is the local time of the slave unit when the correction is made.
Specifically, tsnow is any sampling local time after time synchronization is completed, and Tnow obtained through calculation is the master device time corresponding to the slave unit at Tsnow time point.
The local time of the slave is corrected by summing the difference between the synchronization time and the two correction times to obtain a more accurate Tnow.
Further, time synchronization is required at intervals to ensure time accuracy between different modular devices, so that when at least a second event cycle is reached, the calibrated time Tnow can be ensured to be more accurate by calculating a deviation ratio.
Therefore, as shown in fig. 3, in the time synchronization method of the present application, when the time synchronization number is greater than 1, the slave unit further includes the following steps when correcting the current local time:
step S301, the slave unit calculates a current deviation ratio with the master unit according to the synchronization time and the first correction time generated in the current time synchronization and the last time synchronization, respectively.
As can be seen from the timing diagram of fig. 4, each time synchronization is performed, one synchronization time is generated at the master unit, and two correction times are generated at the slave unit, where the synchronization time is Tm0 when the first time synchronization is performed, and the first calibration time and the second calibration time are Ts0 and Ts1, respectively, so that when the (N + 1) th time synchronization is performed, there are the synchronization time TmN, and the first correction time Ts2 × N and the second correction time Ts2 × N +1.
When at least the second time of time synchronization is carried out, tnow can be calculated directly by means of the formula recorded above, and also the deviation ratio can be calculated to further refine the calculation of Tnow, wherein the calculation formula of the deviation ratio is as follows:
RrcN=(TmN-TmN-1)/(Ts2*N-Ts2*N-2);
in the formula, rrcN is the deviation rate of the N +1 time synchronization, N is more than or equal to 0, tmN is the synchronization time of the N +1 time synchronization, tmN-1 is the synchronization time of the N time synchronization, ts 2N is the first correction time of the N +1 time synchronization, and Ts 2N-2 is the first correction time of the N time synchronization.
As can be seen from the above formula, the calculation method of the deviation ratio requires calculation of the first correction time generated by the current time synchronization, the first correction time generated when the synchronization time is synchronized with the previous time, and the synchronization time, and therefore the calculation can be performed as long as the time synchronization is performed twice next to each other, specifically, when the second time synchronization is performed, the deviation ratio Rrc1 at the time of the second time synchronization can be calculated from the time of the second time synchronization and the first time synchronization, and when the third time synchronization is performed, the deviation ratio Rrc2 at the time of the third time synchronization can be calculated from the parameter generated by the third time synchronization and the parameter of the second time synchronization. From this, it is understood that when the N +1 th time synchronization is performed, the current deviation ratio is RrcN.
Considering that the deviation ratio is calculated every time from the second time synchronization, a large amount of calculation resources may be occupied, and simultaneously, the calculation power and the power consumption of the computer are also occupied, so that the deviation ratio may be calculated in different steps, and the calculation of the deviation ratio may be performed again every time synchronization with a preset number of times, for example, the deviation ratio is calculated only when the second, fourth and sixth times of synchronization are performed, so as to obtain the deviation ratio RrcN. For the sake of uniformity, when the deviation ratio calculation is performed using the interval time synchronization, the subscript N of the deviation ratio and the synchronization time TmN are kept coincident. That is, rrcN represents the deviation ratio at the time of the N +1 th time synchronization.
Specifically, the deviation ratio may be calculated once after two or three time synchronizations.
Step S302, the local time is corrected according to the current deviation rate, the current synchronization time and the current first correction time.
After obtaining the deviation ratio, the formula for calculating Tnow by the deviation ratio is:
the positive calculation formula is:
Tnow=TmN+( Tsnow -Ts2*N)*RrcN
in the formula, tnow is a corrected local time, tsnow is a local time of the slave unit when correction is performed, rrcN is a deviation rate at the time of the N +1 th time synchronization, tmN is a synchronization time at the time of the N +1 th time synchronization, and Ts2 × N is a first correction time at the time of the N +1 th time synchronization.
It can be seen that the deviation ratio is used to calculate whether the time difference between the first calibration time and the second calibration time is accurate or not, so as to obtain a more accurate transmission delay of the synchronization time, and thus, when the local time is calibrated after the second calibration time, the deviation ratio can also be used to reduce or even eliminate the error, so as to obtain a more accurate Tnow through calculation. Likewise, the local time is the master time corresponding to the slave unit at the second calibration time.
This application carries out time synchronization control to all slave units through a main unit, and connect through IO and communication interface's double interface connection mode between main unit and the slave unit, make synchronous start signal and synchronizing time can send the slave unit to almost simultaneously, and the slave unit is through calculating two correction times, come to rectify the synchronizing time of transmitting coming, eliminate communication delay, make the synchronization result more accurate, and when carrying out at least second time synchronization, can also calculate the deviation rate, with the accuracy of further guaranteeing synchronizing time, guarantee the validity of synchronization result, the time synchronization between inside each unit module of on-vehicle ECU system has been realized.
Example 2
An embodiment of the present application further provides a vehicle-mounted ECU time synchronization device, as shown in fig. 5, the device includes:
and a synchronization time sending module 10, configured to record a current local time as a synchronization time by the master unit, send a synchronization start signal to the slave unit through an IO, send the synchronization time to the slave unit through the communication interface, and send a synchronization completion signal to the slave unit through the IO.
A synchronization time recording module 20, configured to record, when the slave unit receives the synchronization start signal sent by the master unit, the local time at that time as a first correction time, and when the slave unit receives the synchronization time, record the local time at that time as a second correction time.
A synchronization time correction module 30, configured to correct the local time by the slave unit according to the synchronization time, the first correction time and the second correction time.
Further, the present application also provides an in-vehicle ECU, which includes a processor and a memory, where the memory stores a computer program, and the computer program executes the time synchronization method of the in-vehicle ECU in any one of the above embodiments when running on the processor.
Further, the present application also provides a readable storage medium storing a computer program, which when executed on a processor performs the vehicle-mounted ECU time synchronization method described in any of the above embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part of the technical solution that contributes to the prior art in essence can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention.

Claims (9)

1. The vehicle-mounted ECU time synchronization method is characterized by comprising a main unit and at least one slave unit, wherein the main unit and each slave unit are respectively connected through a communication interface and an IO interface; the method comprises the following steps:
the master unit records the current local time as the synchronization time, sends a synchronization start signal to the slave unit through the connected IO interface, simultaneously sends the synchronization time to the slave unit through the communication interface, and then sends a synchronization completion signal to the slave unit through the IO interface;
when the slave unit receives a synchronization start signal transmitted by the master unit, recording the local time at the moment as a first correction time, and when the slave unit receives the synchronization time, recording the local time at the moment as a second correction time;
the slave unit corrects the local time according to the synchronization time, the first correction time and the second correction time;
in the case that the time synchronization times are larger than 1, when the slave unit corrects the local time, the slave unit calculates the current deviation rate between the slave unit and the master unit according to the synchronization time and the first correction time generated in the current time synchronization and the last time synchronization respectively;
and correcting the local time according to the current deviation ratio, the current synchronization time and the current first correction time.
2. The in-vehicle ECU time synchronization method according to claim 1, characterized by further comprising:
calculating the deviation ratio between the slave unit and the master unit once after each time synchronization is performed a preset number of times for correcting the current local time.
3. The on-vehicle ECU time synchronization method according to claim 1, characterized in that the calculation formula of the deviation ratio is:
Rrc N =(Tm N -Tm N-1 )/(Ts 2*N -Ts 2*N-2 );
in the formula, rrc N Is the deviation ratio of the N +1 time synchronization, N is more than or equal to 0 N Is the synchronization time, tm, at the time of the N +1 time synchronization N-1 Synchronization time, ts, for N time synchronizations 2*N First correction time, ts, for the N +1 th time synchronization 2*N-2 Is the first correction time of the Nth time synchronization.
4. The in-vehicle ECU time synchronization method according to claim 1, characterized in that a calculation formula for performing correction of the local time based on the current deviation ratio, the current synchronization time, and the current first correction time is:
T now =Tm N +( Ts now -Ts 2*N )*Rrc N
in the formula, T now For corrected local time, ts now For the local time of the slave unit when making corrections, rrc N Is the deviation ratio, tm, at the time of the N +1 time synchronization N Is the synchronization time, ts, at the time of the N +1 time synchronization 2*N Is the first correction time of the N +1 time synchronization.
5. The in-vehicle ECU time synchronization method according to claim 1, characterized in that a calculation formula of the slave unit performing correction of local time according to the synchronization time, the first correction time, and the second correction time is:
T now =Tm+(Ts 2 -Ts 1 )
in the formula, T now Represents corrected local time, ts 2 Represents the second correction time, ts 1 Represents the first correction time, and Tm is the synchronization time;
if the time when the local time correction is performed is after the second correction time, a calculation formula for performing the local time correction is as follows:
T now =Tm+( Ts now -Ts 1 )
in the formula, ts now To the local time of the slave unit when the correction is made.
6. The vehicle-mounted ECU time synchronization method according to claim 1, wherein the communication interface is Uart;
the synchronization start signal and the synchronization completion signal are both a level state change signal;
when the slave unit receives the synchronization starting signal, recording the local time at the time as first correction time;
when the slave unit detects that the IO interface changes from low level to high level or from high level to low level, recording the current local time as a first correction time.
7. An on-vehicle ECU time synchronizer, characterized by that, including main unit and at least one slave unit, said main unit and each said slave unit are connected through communication interface and an IO interface respectively, this apparatus includes:
the synchronous time sending module is used for recording the current local time as synchronous time by the master unit, sending a synchronous starting signal to the slave unit through the connected IO interface, sending the synchronous time to the slave unit through the communication interface, and sending a synchronous finishing signal to the slave unit through the IO interface;
the synchronous time recording module is used for recording the local time as first correction time when the slave unit receives a synchronous start signal sent by the master unit and recording the local time as second correction time when the slave unit receives the synchronous time;
a synchronization time correction module for the slave unit to correct the local time according to the synchronization time, the first correction time and the second correction time; in the case that the time synchronization times are larger than 1, when the slave unit corrects the local time, the slave unit calculates the current deviation rate between the slave unit and the master unit according to the synchronization time and the first correction time generated in the current time synchronization and the last time synchronization respectively; and correcting the local time according to the current deviation ratio, the current synchronization time and the current first correction time.
8. An in-vehicle ECU comprising a processor and a memory, the memory storing a computer program which, when run on the processor, performs the in-vehicle ECU time synchronization method of any one of claims 1 to 6.
9. A readable storage medium characterized in that it stores a computer program that, when run on a processor, executes the in-vehicle ECU time synchronization method of any one of claims 1 to 6.
CN202210850010.9A 2022-07-20 2022-07-20 Vehicle-mounted ECU time synchronization method and device, vehicle-mounted ECU and storage medium Active CN115085851B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210850010.9A CN115085851B (en) 2022-07-20 2022-07-20 Vehicle-mounted ECU time synchronization method and device, vehicle-mounted ECU and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210850010.9A CN115085851B (en) 2022-07-20 2022-07-20 Vehicle-mounted ECU time synchronization method and device, vehicle-mounted ECU and storage medium

Publications (2)

Publication Number Publication Date
CN115085851A CN115085851A (en) 2022-09-20
CN115085851B true CN115085851B (en) 2022-12-20

Family

ID=83258814

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210850010.9A Active CN115085851B (en) 2022-07-20 2022-07-20 Vehicle-mounted ECU time synchronization method and device, vehicle-mounted ECU and storage medium

Country Status (1)

Country Link
CN (1) CN115085851B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102142954A (en) * 2010-11-30 2011-08-03 中兴通讯股份有限公司 Time synchronization method and equipment in rack
CN102546071A (en) * 2011-12-23 2012-07-04 北京北方烽火科技有限公司 Clock synchronization method and system
CN112821974A (en) * 2020-11-23 2021-05-18 北京经纬恒润科技股份有限公司 High-precision time synchronization method and device for vehicle-mounted ECU

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013093655A (en) * 2011-10-24 2013-05-16 Toyota Motor East Japan Inc In-vehicle communication system
US10581543B2 (en) * 2017-01-10 2020-03-03 Infineon Technologies Ag Synchronization mechanism for high speed sensor interface
CN108924383B (en) * 2018-07-23 2021-01-12 惠州市德赛西威汽车电子股份有限公司 Vehicle-mounted multi-sensor synchronous triggering device and triggering method thereof
EP3863199A1 (en) * 2020-02-07 2021-08-11 Renesas Electronics Corporation Time synchronisation
US11968639B2 (en) * 2020-11-11 2024-04-23 Magna Electronics Inc. Vehicular control system with synchronized communication between control units

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102142954A (en) * 2010-11-30 2011-08-03 中兴通讯股份有限公司 Time synchronization method and equipment in rack
CN102546071A (en) * 2011-12-23 2012-07-04 北京北方烽火科技有限公司 Clock synchronization method and system
CN112821974A (en) * 2020-11-23 2021-05-18 北京经纬恒润科技股份有限公司 High-precision time synchronization method and device for vehicle-mounted ECU

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"多缸柴油机主-从ECU分布式控制系统研究";宋雪桦;《中国博士学位论文全文数据库信息科技辑》;20120615;3.1.2主-从ECU时间同步 *
宋雪桦."多缸柴油机主-从ECU分布式控制系统研究".《中国博士学位论文全文数据库信息科技辑》.2012, *

Also Published As

Publication number Publication date
CN115085851A (en) 2022-09-20

Similar Documents

Publication Publication Date Title
CN103988453B (en) Method for synchronizing clocks in nodes of a vehicle network and node designed to perform the method
JP3902592B2 (en) Node synchronization method and synchronization unit for distributed system for real-time processing
US10863469B2 (en) System and method for accurate timestamping of virtual reality controller data
CN110492965B (en) Method and device for synchronizing time of serial messages in master-slave system
CN109981206B (en) Time synchronization method, device, system, terminal equipment and storage medium
EP2064822B1 (en) Network and method for clock synchronization of clusters in a time triggered network
EP2811672A1 (en) Communication apparatus, communication system, and communication method for time synchronization
CN113037415A (en) TSN (time delay network) clock synchronization method, system and equipment based on vehicle-mounted Ethernet transmission
CN111030909B (en) Method for time synchronization among CAN bus multi-master device communication
US8566632B2 (en) Multi-rate sampling for network receiving nodes using distributed clock synchronization
KR20150143801A (en) Timestamp generating method, device and system
CN111130676A (en) Time synchronization correction method and device applied to master clock and slave clock
CN102594741A (en) Communication circuit and method of adjusting sampling clock signal
US20160065358A1 (en) Synchronization method, intermediate node, and slave node of communication network system
CN113037416B (en) Time synchronization method and device, vehicle-mounted equipment and storage medium
CN112448874B (en) Vehicle-mounted communication device and time synchronization method thereof
CN115080495B (en) Time synchronization method and system for standard peripheral extension interface equipment
US7761634B2 (en) Method, device and system for exchanging data via a bus system
CN115085851B (en) Vehicle-mounted ECU time synchronization method and device, vehicle-mounted ECU and storage medium
KR101880925B1 (en) Network synchronization method between devices in tatical data link
JP2007060400A (en) Communication timing control method and communication timing control system
CN112765073A (en) Data sampling method, system, storage medium and computer equipment
JP6400553B2 (en) Numerical control system with synchronous control function between units
KR101379248B1 (en) Ethernet communication system and time synchronization method
CN113839734B (en) Time synchronization method and device, electronic equipment, storage medium and vehicle

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