CN102195769A - Clock synchronization method for automobile CAN (Control Area Network) - Google Patents
Clock synchronization method for automobile CAN (Control Area Network) Download PDFInfo
- Publication number
- CN102195769A CN102195769A CN2011101468373A CN201110146837A CN102195769A CN 102195769 A CN102195769 A CN 102195769A CN 2011101468373 A CN2011101468373 A CN 2011101468373A CN 201110146837 A CN201110146837 A CN 201110146837A CN 102195769 A CN102195769 A CN 102195769A
- Authority
- CN
- China
- Prior art keywords
- node
- host node
- message
- former
- network
- 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.)
- Pending
Links
Images
Landscapes
- Small-Scale Networks (AREA)
- Synchronisation In Digital Transmission Systems (AREA)
Abstract
The invention provides a clock synchronization method for an automobile CAN (Control Area Network) and provides a corresponding 'prior consultation' synchronous algorithm. In the method, a synchronization major node can be determined by consulting with other nodes according to the priority of a major node priority list when a current synchronization major node fails, so that the problem of redundant load caused by periodic consultation is solved effectively. Due to the adoption of the method, high reliability is achieved, single point failure can be prevented, a small quantity of messages needs to be transmitted, the bandwidth utilization rate is high, high synchronization accuracy can be achieved, and a good method for realizing high-accuracy clock synchronization of the automobile CAN network is provided.
Description
Technical field
The present invention relates to the clock synchronization field, be specially a kind of clock synchronizing method that is used for the automobile CAN network.
Background technology
Along with electric-control system on the automobile (ECU) number is on the increase, automotive networking changes into the trend for the automotive electronics development.Because automotive electronics is typical safety-critical real-time system, accurate clock reference is one of highly reliable operation key factor of automotive networking system.Therefore, study most widely used general CAN bus and the same problem of clock thereof in the present automobile, set up low-cost, high accuracy and highly reliable clock synchronizing method and have important practical significance.
At present, aspect clock synchronization, obtained a large amount of achievements both at home and abroad, mainly proposed based on the CAN bus clock synchronized algorithm of principal and subordinate configuration and consult method such as clock synchronizing method.Great advantage based on the CAN bus clock synchronized algorithm of principal and subordinate configuration is to save bandwidth resources, clock host node in each heavy synchronizing cycle is as long as send the clock synchronization that a synchronization message can guarantee all nodes in the network, and its shortcoming is to hold the single point failure of clock host node.Consult clock synchronizing method and can effectively avoid single point failure, the realization distributed fault-tolerance, but the normal node of all working all must periodically participate in consulting in the network, selects the clock synchronization host node synchronously for weigh next time, increase the Network Synchronization expense, reduced bandwidth availability ratio.
Summary of the invention
The purpose of this invention is to provide a kind of clock synchronizing method that is used for the automobile CAN network, to solve the single point failure and the excessive problem of network redundancy load of existing C AN bus clock method for synchronous.
In order to achieve the above object, the technical solution adopted in the present invention is:
A kind of clock synchronizing method that is used for the automobile CAN network is characterized in that: be negotiation algorithm in a kind of early stage, described early stage, negotiation algorithm may further comprise the steps:
(1) initialization CAN controller and register, CAN network Central Plains host node presets to put start-up time at certain and periodically sends synchronization message to each from node, each that successfully receives described synchronization message restarts clock from node, and recorder is constantly separately; After former host node received described synchronizing information certainly, former host node sent the Follow_up message to each from node, and each Follow_up message that sends according to former host node from node calculates local clock t separately respectively
sMaster clock t with former host node
mBetween instant deviation | t
s-t
m|;
(2) mistake occurs when network, cause the part synchronization message successfully not received from node by all, if this moment is certain instant deviation from node | t
s-t
m|>ρ (Δ Γ
Tight+ C
f+ J
g)+δ then should start error counter from node, and in the formula: Δ Γ tight sends the maximum time difference that successful synchronization message is received from node by two differences, and ρ is the clock drift rate from node, and δ is the error that uncertain interference causes, C
fBe the worst transmission time of Follow_up message, J
gFor former host node sends the time interval of Follow_up message Zi receiving synchronizing information to former host node;
When this when node error counter counting reaches set point, should judge former host node timeliness from node, and synchronous scanning host node priority list, should from node described host node priority list, select former next order priority of host node from node as candidate's host node, and broadcasting selection information notifies other from node, after other receive described selection message from node, each self-scanning host node priority list of difference, judge described candidate's host node whether be former next order priority of host node from node, then admit described candidate's host node in this way respectively, each sends confirmation to described candidate's host node respectively from node subsequently;
(3) described candidate's host node judges whether receive each affirmation message from node, if receive acknowledge message, then judge and whether comprise the message that former host node sends in the confirmation, if comprise the message that former host node sends, prove that then former host node is normal, candidate's host node is abandoned, former host node continues operation, if do not comprise the message that former host node sends, prove that then former host node lost efficacy, and started candidate's host node.
Described a kind of clock synchronizing method that is used for the automobile CAN network is characterized in that: in the described step (3), if in the stipulated time, candidate's host node is not received acknowledge message, judges candidate's host node fault, closes voluntarily, and former host node continues operation.
Described a kind of clock synchronizing method that is used for the automobile CAN network is characterized in that: described early stage, negotiation algorithm must satisfy following hypothesis:
(1) to arrive the time-delay of each node be definite value to frame, and promptly the CAN network must be a broadcast type network, and can approach 0 time of delay, or a normal value;
(2) from send or receiving data frames to the time of delay that recipient's interrupt service routine is handled this frame be a definite value;
(3) time interval of continuous two effective synchronization messages must be less than the maximum time interval of two effective synchronization messages;
Described a kind of clock synchronizing method that is used for the automobile CAN network, it is characterized in that: the information that described host node priority list is provided according to other nodes by each node in the CAN network is set up or self upgrades, and it is used for reflecting each node priority order.
Described a kind of clock synchronizing method that is used for the automobile CAN network is characterized in that: synchronization message is former host node cycle transmission in the described step (1), is used for synchronously respectively the message from node and former host node clock.
The present invention has provided corresponding synchronization algorithm analyzing from synchronously, consulting to have proposed " the consult early stage " clock synchronizing method based on the state information table on method existing problems such as synchronous and the synchronous characteristics of the CAN network clocking basis." consult early stage " clock synchronizing method reliability height can prevent single point failure, and required message transfer number is few, and the bandwidth availability ratio height can reach the higher synchronous accuracy, provides good solution thinking synchronously for realizing automobile CAN network high precision clock.
Description of drawings
Fig. 1 is the inventive method principle schematic.
Fig. 2 is the inventive method flow chart.
Fig. 3 is the inventive method principle flow chart.
Embodiment
As Fig. 1, Fig. 2, shown in Figure 3.The present invention carries out as follows:
(1) initialization CAN controller and register, former host node presets property transmission dot cycle start-up time synchronization message at certain.In this stage: the CAN control register may be set up or automatic repeating transmission of message is under an embargo
(2) all that successfully receive synchronization message restart clock from node, and recorder constantly.Former host node behind receiving synchronous information, send the Follow_up message to each from node, each Follow_up message that sends according to former host node from node calculates each t since node respectively
sT with host node
mBetween instant deviation | t
s-t
m|.
If a certain from node | t
s-t
m|≤ρ (Δ Γ
Tight+ C
f+ J
g)+δ,, then
Error counter does not start, otherwise starts this error counter M=M+1 from node, t=t+ Δ j,
(3) because mistake may appear in network, cause the part synchronization message successfully not received from node by all,
For do not receive at the appointed time synchronization message from node, start error counter M=M+1, simultaneously local clock t=t+ Δ
jIf certain from node error counter counting M 〉=3, judges that then former host node lost efficacy.Should be from node scan host node priority list, what select former next order priority of host node is candidate's host node from node, message (vote message) is selected in broadcasting.After each node is received vote message, scanning host node priority list, judge candidate's host node select whether correct, promptly candidate's host node whether be former next order priority of host node from node, as correctly then to candidate's host node transmission acknowledge message.
(4) candidate's host node judges whether receive acknowledge message.If receive acknowledge message, whether judgement comprises the message that former host node sends, if comprise, then former host node is normal, and former host node continues operation, otherwise former host node lost efficacy startup candidate host node.
(5) if in the stipulated time, candidate's host node is not received acknowledge message, judges from node failure, closes voluntarily, and former host node continues normal operation.
In the above-mentioned steps:
Be the time that receives synchronization message from node i for the k time,
Be the time that former host node receives synchronizing information for the k time certainly, be from the k time instant deviation between node i and host node
Δ Γ tight sends the maximum time difference that successful synchronization message is received from node by two differences, and ρ is the clock drift rate from node, and δ is the error that uncertain interference causes, C
fBe the worst transmission time of Follow_up message, J
gFor host node Zi receiving synchronizing information to the time interval of sending the Follow_up message, t is the real-time moment of each node, ts be from node at t timestamp constantly, tm be host node at t timestamp constantly, M is from the node error count.
Specific embodiment: 7 ECU network nodes with CAN network in the hybrid vehicle are example, wherein VCU (car load ECU (Electrical Control Unit)) is responsible for providing global clock as initial clock synchronization host node, EMS (engine management system), TCU (automatic gear-box control unit), ABS (brake anti-blocking unit), TCS (tractive effort control unit), conduct such as BMS (battery management unit) and DB (instrument pack) is from node.
When 2.193112s, host node (VCU) sends sync message (being synchronizing information), synchronously respectively from the message of node and host node clock.Respectively from node EMS (engine management system), TCU (automatic gear-box control unit), ABS (brake anti-blocking unit), TCS (tractive effort control unit), BMS (battery management unit) and DB (instrument pack) receive message in the following time respectively: 2.193115s, 2.193113s, 2.193113s, 2.193113s, 2.193115s, 2.193114s.The time that host node (VCU) receives synchronous sync information and sending Follow_up message is 2.193118s, Follow_up message comprises the time 2.193116s that host node (VCU) receives sync message, respectively be respectively from the time that node receives Follow_up message: 2.193120s, 2.193121s, 2.193119s, 2.193120s, 2.193119s, 2.193120s.
Get host node VCU and be that example illustrates this synchronized algorithm from node EMS.| t
s-t
m|=3 * 10
-6S, ρ (Δ Γ
Tight+ C
f+ J
gρ among the)+δ=1 * 10
-5, Δ Γ
Tight,=2 * 10
-6S, C
f=2 * 10
-6S, J
g=2 * 10
-6S gets δ=1 * 10
-5S, through relatively getting | t
s-t
m|≤ρ (Δ Γ
Tight+ C
f+ J
g)+δ, then former host node is working properly.
When 2.421226s, host node VCU sends sync message, receives message from node EMS constantly at 2.421238s, so | and t
s-t
m|=1.2 * 10
-5>ρ (Δ Γ
Tight+ C
f+ J
g)+δ will start error counter M=M+1.2.510331 o'clock M>2 o'clock, judge that then host node lost efficacy, it is candidate's host node that scan-synchronized host node priority list is selected next order node EMS.When 2.511231s, node EMS sends sync message as candidate's host node, respectively from node TCU, and ABS, TCS, BMS and DB receive message in the following time respectively: 2.510333s, 2.510332s, 2.510334s, 2.510336s, 2.510333s.The time that candidate's host node EMS receives synchronous sync information and sending Follow_up message is 2.510335s, Follow_up message comprises the time 2.510331s that candidate's host node EMS receives sync message, the time that node receives Follow_up message is respectively: 2.510336s, 2.510336s, 2.510338s, 2.510337s, 2.510336s.Through relatively getting | t
s-t
m|≤ρ (Δ Γ
Tight+ C
f+ J
g)+δ, then candidate's host node EMS becomes host node.
To sum up analyze as can be seen: " consult early stage " method for synchronous is synchronously close with " later stage negotiation " method for synchronous at synchronization accuracy and existing principal and subordinate, but has littler network redundancy load under the same conditions, can effectively prevent single point failure, the requirement in the time that the automobile CAN network implementation can better being satisfied.
Claims (5)
1. clock synchronizing method that is used for the automobile CAN network is characterized in that: be negotiation algorithm in a kind of early stage, described early stage, negotiation algorithm may further comprise the steps:
(1) initialization CAN controller and register, CAN network Central Plains host node presets to put start-up time at certain and periodically sends synchronization message to each from node, each that successfully receives described synchronization message restarts clock from node, and recorder is constantly separately; When former host node after receive described synchronizing information, former host node sends the Follow_up message to each from node, each Follow_up message that sends according to former host node from node calculates each respectively since node
With host node
Between instant deviation
(2) mistake occurs when network, cause the part synchronization message successfully not received from node by all, if this moment is certain instant deviation from node
>
(
+ C
f+ J
g)+δ then should start error counter from node, and in the formula: Γ tight sends the maximum time difference that successful synchronization message is received from node by two differences, and ρ is the clock drift rate from node, and δ is the error that uncertain interference causes, C
fBe the worst transmission time of Follow_up message, J
gFor former host node sends the time interval of Follow_up message Zi receiving synchronizing information to former host node;
When this when node error counter counting reaches set point, should judge former host node timeliness from node, and synchronous scanning host node priority list, should from node described host node priority list, select former next order priority of host node from node as candidate's host node, and broadcasting selection information notifies other from node, after other receive described selection message from node, each self-scanning host node priority list of difference, judge described candidate's host node whether be former next order priority of host node from node, then admit described candidate's host node in this way respectively, each sends confirmation to described candidate's host node respectively from node subsequently;
(3) described candidate's host node judges whether receive each affirmation message from node, if receive acknowledge message, then judge and whether comprise the message that former host node sends in the confirmation, if comprise the message that former host node sends, prove that then former host node is normal, candidate's host node is abandoned, former host node continues operation, if do not comprise the message that former host node sends, prove that then former host node lost efficacy, and started candidate's host node.
2. a kind of clock synchronizing method that is used for the automobile CAN network according to claim 1 is characterized in that: in the described step (3), if in the stipulated time, candidate's host node is not received acknowledge message, judge candidate's host node fault, close voluntarily that former host node continues operation.
3. a kind of clock synchronizing method that is used for the automobile CAN network according to claim 1 is characterized in that: described early stage, negotiation algorithm must satisfy following hypothesis:
(1) to arrive the time-delay of each node be definite value to frame, and promptly the CAN network must be a broadcast type network, and can approach 0 time of delay, or a normal value;
(2) from send or receiving data frames to the time of delay that recipient's interrupt service routine is handled this frame be a definite value;
(3) time interval of continuous two effective synchronization messages must be less than the maximum time interval of two effective synchronization messages.
4. a kind of clock synchronizing method that is used for the automobile CAN network according to claim 1, it is characterized in that: the information that described host node priority list is provided according to other nodes by each node in the CAN network is set up or self upgrades, and it is used for reflecting each node priority order.
5. a kind of clock synchronizing method that is used for the automobile CAN network according to claim 1 is characterized in that: synchronization message is former host node cycle transmission in the described step (1), is used for synchronously respectively the message from node and former host node clock.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2011101468373A CN102195769A (en) | 2011-06-02 | 2011-06-02 | Clock synchronization method for automobile CAN (Control Area Network) |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2011101468373A CN102195769A (en) | 2011-06-02 | 2011-06-02 | Clock synchronization method for automobile CAN (Control Area Network) |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102195769A true CN102195769A (en) | 2011-09-21 |
Family
ID=44603197
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2011101468373A Pending CN102195769A (en) | 2011-06-02 | 2011-06-02 | Clock synchronization method for automobile CAN (Control Area Network) |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102195769A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104618199A (en) * | 2014-12-26 | 2015-05-13 | 珠海格力电器股份有限公司 | Automatic node access identification method and device based on CAN communication and air conditioner |
CN104639598A (en) * | 2013-11-11 | 2015-05-20 | 现代摩比斯株式会社 | Synchronization apparatus and method between AVN system and digital clock of vehicle |
CN106301953A (en) * | 2016-09-20 | 2017-01-04 | 中国科学院计算技术研究所 | It is applicable to distributed fault-tolerant clock synchronous method and the system of Time Triggered Ethernet |
CN108469747A (en) * | 2018-02-28 | 2018-08-31 | 北京智行鸿远汽车有限公司 | Communication management method, system and computer readable storage medium |
CN111049607A (en) * | 2019-11-15 | 2020-04-21 | 中国第一汽车股份有限公司 | Clock synchronization method, device and system for vehicle and storage medium |
CN111095827A (en) * | 2017-09-26 | 2020-05-01 | Abb瑞士股份有限公司 | Clock synchronization in a device |
CN114978875A (en) * | 2021-02-23 | 2022-08-30 | 广州汽车集团股份有限公司 | Vehicle-mounted node management method and device and storage medium |
CN115250159A (en) * | 2022-07-18 | 2022-10-28 | 重庆长安汽车股份有限公司 | Time synchronization method, device, electronic equipment, storage medium and program product |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101383693A (en) * | 2007-09-07 | 2009-03-11 | 西门子公司 | Method for transmitting synchronisation messages in a communications network |
-
2011
- 2011-06-02 CN CN2011101468373A patent/CN102195769A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101383693A (en) * | 2007-09-07 | 2009-03-11 | 西门子公司 | Method for transmitting synchronisation messages in a communications network |
Non-Patent Citations (2)
Title |
---|
《电子测量与仪器学报》 20110228 张利 等 "汽车CAN网络时钟同步方法研究" , * |
张利 等: ""汽车CAN网络时钟同步方法研究"", 《电子测量与仪器学报》, 28 February 2011 (2011-02-28) * |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104639598A (en) * | 2013-11-11 | 2015-05-20 | 现代摩比斯株式会社 | Synchronization apparatus and method between AVN system and digital clock of vehicle |
CN104618199A (en) * | 2014-12-26 | 2015-05-13 | 珠海格力电器股份有限公司 | Automatic node access identification method and device based on CAN communication and air conditioner |
CN106301953A (en) * | 2016-09-20 | 2017-01-04 | 中国科学院计算技术研究所 | It is applicable to distributed fault-tolerant clock synchronous method and the system of Time Triggered Ethernet |
CN106301953B (en) * | 2016-09-20 | 2019-05-14 | 中国科学院计算技术研究所 | Distributed fault-tolerant clock synchronous method and system suitable for time trigger Ethernet |
CN111095827A (en) * | 2017-09-26 | 2020-05-01 | Abb瑞士股份有限公司 | Clock synchronization in a device |
CN111095827B (en) * | 2017-09-26 | 2022-04-29 | Abb瑞士股份有限公司 | Clock synchronization in a device |
CN108469747A (en) * | 2018-02-28 | 2018-08-31 | 北京智行鸿远汽车有限公司 | Communication management method, system and computer readable storage medium |
CN111049607A (en) * | 2019-11-15 | 2020-04-21 | 中国第一汽车股份有限公司 | Clock synchronization method, device and system for vehicle and storage medium |
CN114978875A (en) * | 2021-02-23 | 2022-08-30 | 广州汽车集团股份有限公司 | Vehicle-mounted node management method and device and storage medium |
CN115250159A (en) * | 2022-07-18 | 2022-10-28 | 重庆长安汽车股份有限公司 | Time synchronization method, device, electronic equipment, storage medium and program product |
CN115250159B (en) * | 2022-07-18 | 2024-07-30 | 重庆长安汽车股份有限公司 | Time synchronization method, device, electronic equipment, storage medium and program product |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102195769A (en) | Clock synchronization method for automobile CAN (Control Area Network) | |
CN105577308B (en) | The method and apparatus of In-vehicle networking time synchronization is provided using redundancy master clock | |
EP3540982B1 (en) | Delay management for distributed communications networks | |
CN104272664B (en) | gateway, node and method for vehicle | |
RU2445222C1 (en) | Time synchronisation system and method of time synchronisation in railway car | |
US20160149658A1 (en) | Method and device for detecting fault in synchronization link | |
CN111030909B (en) | Method for time synchronization among CAN bus multi-master device communication | |
CN103188064A (en) | Clock synchronization method and clock synchronization device | |
CN110149260A (en) | A kind of starting of time trigger bus cluster and method for restarting and device | |
CN111708296A (en) | Synchronous control and data voting method based on two-channel safety PLC | |
US7848361B2 (en) | Time-triggered communication system and method for the synchronization of a dual-channel network | |
CN106688207A (en) | Method for determining a propagation time of a telegram in a communication network, and corresponding network components | |
EP3656077B1 (en) | Cross domain synchronization in a communication network | |
Obermaisser | Reuse of CAN-based legacy applications in time-triggered architectures | |
CN107666360B (en) | Train system time synchronization control method and device | |
US20230155806A1 (en) | Method and System for Performing Time-Synchronization Between Units of a Communication Bus System | |
CN110988599B (en) | Distributed wave recording high-precision synchronization method for power distribution fault indicator | |
CN114258126A (en) | Data processing method and device | |
CN112865906B (en) | Method, device and storage medium for realizing precision time protocol synchronous message | |
CN102983959B (en) | Method for realizing one-step mode and two-step mode for PTP (precision time synchronization protocol) in a plurality of MAC | |
CN112820092B (en) | Method for collecting electricity consumption data, terminal equipment and storage medium | |
CN112511255B (en) | Time synchronization method and device | |
CN109981204B (en) | Multi-machine synchronization method of BMS (battery management system) simulation system | |
CN111049607B (en) | Clock synchronization method, device and system for vehicle and storage medium | |
CN115136517A (en) | Method and system for performing time synchronization |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20110921 |