Time synchronization method of EtherCAT-TSN network

Through the hybrid networking method of EtherCAT and TSN, the gPTP synchronization protocol and ARMW/FRMW instructions are used to realize the rapid time synchronization of the EtherCAT-TSN network, solving the problem that existing solutions require adding devices or modifying the protocol stack, simplifying the synchronization process and speeding up.

CN120049991APending Publication Date: 2025-05-2758TH RES INST OF CETC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510234341.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The existing EtherCAT-TSN networking scheme requires additional equipment or modification of the synchronization protocol stack of the EtherCAT master station when performing time synchronization, and the propagation delay and time offset values ​​of each slave link need to be remeasured, which is not conducive to the promotion of EtherCAT-TSN networking applications.

Method used

Through the hybrid networking method of EtherCAT and TSN, the gPTP synchronization protocol is used to realize the time synchronization between the EtherCAT reference clock slave and the TSN network domain master clock. The EtherCAT master recalculates the time offset value of each slave, and updates it to each slave, and completes the slave time synchronization through the ARMW/FRMW instruction.

Benefits of technology

The steps to measure link propagation delay and time offset values ​​in the current DC method are saved, the synchronization process is simplified, and the time synchronization speed of the EtherCAT-TSN network is accelerated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120049991A_ABST
    Figure CN120049991A_ABST
Patent Text Reader

Abstract

The invention discloses a time synchronization method of an EtherCAT-TSN network, which comprises the following steps: after an EtherCAT reference clock slave station and a TSN master clock are synchronized, an EtherCAT master station recalculates the time offset of each EtherCAT slave station and updates the time offset to each slave station, and the synchronization of EtherCAT equipment is completed through distributed clock synchronization. According to the time synchronization method, under the hybrid networking mode of the EtherCAT and the TSN, synchronization can be implemented only by recalculating the new time offset value of each slave station link, a DC synchronization mechanism is compatible, and the EtherCAT-TSN network synchronization process is accelerated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technologies, and particularly to a time synchronization method for an EtherCAT-TSN network. Background Art

[0002] EtherCAT (Ethernet for Control Automation Technology) is a real-time industrial Ethernet fieldbus protocol applied to the fields of factory automation and process automation. Through the "On the fly" technology, data frames can be processed and forwarded simultaneously, obtaining a smaller delay and improving the real-time performance of the communication system. Through DC (Distributed Clock), clock synchronization accuracy at the nanosecond level can be achieved, and communication jitter at the microsecond level can be maintained. EtherCAT has become one of the most popular industrial Ethernet solutions globally.

[0003] In the current context where big data and cloud computing have entered the industrial control field and require the integration of IT (Information Technology) and OT (Operational Technology), the EtherCAT fieldbus protocol is difficult to meet the IT-OT integrated network with diverse service types and complex networking situations.

[0004] TSN (Time Sensitive Networking) is a brand-new industrial communication technology actively promoted by the international industrial community. Through technologies such as time synchronization, traffic shaping, and bandwidth reservation, it provides deterministic message transmission, ensuring low latency, deterministic latency, and reliability of the network. Combining TSN technology with EtherCAT technology extends industrial network communication beyond a single department or workshop to all departments.

[0005] The EtherCAT over TSN solution developed by the EtherCAT working group can be networked by connecting an external dedicated EtherCAT-TSN adapter or directly networking. However, after the generalized precise time protocol (gPTP) in the TSN domain is synchronized in the existing solution, the clock of the dedicated EtherCAT-TSN adapter or the clock of the EtherCAT master station is used as the reference clock, and then time synchronization is completed in the EtherCAT link through the DC method. This requires additional equipment or modification of the EtherCAT master station synchronization protocol stack, and the link propagation delay and time offset values of each EtherCAT slave station need to be re-measured, which is not conducive to the popularization of EtherCAT-TSN networking applications.

[0006] Therefore, it is urgent to explore a time synchronization method for EtherCAT-TSN networks that can complete synchronization quickly while being compatible with existing EtherCAT synchronization methods. Summary of the Invention

[0007] The purpose of the present invention is to provide a time synchronization method for EtherCAT-TSN networks to solve the problems in the background technology.

[0008] To solve the above technical problems, the present invention provides a time synchronization method for EtherCAT-TSN networks, including:

[0009] In the mixed networking mode of EtherCAT and TSN, through the gPTP synchronization method, the time synchronization between the EtherCAT reference clock slave station and the master clock of the TSN network domain is realized; among them, the reference clock slave station refers to the first slave station with DC function connected to the EtherCAT master station, gPTP refers to the Generalized Precision Time Protocol, and DC refers to the Distributed Clock;

[0010] Within the EtherCAT network, through the DC synchronization method, the time synchronization among the EtherCAT master station, EtherCAT slave stations, and the EtherCAT reference clock slave station is realized;

[0011] After each synchronization between the EtherCAT reference clock slave station and the TSN domain master clock, the EtherCAT master station recalculates the time offset between each EtherCAT slave station and the EtherCAT reference clock slave station, and updates the time offset value of each EtherCAT slave station;

[0012] The EtherCAT master station uses the ARMW / FRMW instructions to read the reference clock, that is, the system time, from the EtherCAT reference clock slave station, write it to all subsequent EtherCAT slave stations, and trigger each slave station to adjust its local time to complete the time synchronization of all slave stations; where ARMW represents the Single Read Multiple Write Sequential Addressing Instruction, and FRMW represents the Single Read Multiple Write Set Addressing Instruction.

[0013] In one embodiment, the mixed networking mode of EtherCAT and TSN includes:

[0014] The EtherCAT master station, EtherCAT reference clock slave station, and EtherCAT slave stations jointly form an EtherCAT link, where the EtherCAT reference clock slave station is simultaneously connected to the TSN network domain.

[0015] In one embodiment, after the EtherCAT reference clock slave synchronizes with the TSN domain master clock each time, the EtherCAT master recalculates the time offset between each EtherCAT slave and the EtherCAT reference clock slave, and updating the time offset value of each EtherCAT slave includes:

[0016] After the EtherCAT reference clock slave synchronizes with the TSN master clock, it latches the clock correction value of the TSN synchronization message. The EtherCAT master starts the EtherCAT link time offset measurement, calculates the new link time offset between each EtherCAT slave and the EtherCAT reference clock slave, and updates the offset value t in the system time deviation register of each slave. offset (n).

[0017] In one embodiment, calculating the new link time offset between each EtherCAT slave and the EtherCAT reference clock slave includes:

[0018] The EtherCAT master uses the read data instruction to obtain the clock correction value t of the gPTP synchronization of the EtherCAT reference clock slave. correction and uses the broadcast read instruction to obtain the current offset value t in the system time deviation register of each EtherCAT slave. offset-pre (n), and calculates the new link time offset t. correction +t offset-pre (n).

[0019] In one embodiment, the EtherCAT master uses the ARMW / FRMW instruction to read the reference clock, that is, the system time, from the EtherCAT reference clock slave, writes it to each EtherCAT slave, and triggers each slave to adjust the local time to complete the time synchronization of all slaves, including:

[0020] During periodic synchronization, the EtherCAT master uses the ARMW / FRMW instruction to extract the system time t from the EtherCAT reference clock slave. sys_ref and sends it to each EtherCAT slave;

[0021] Each EtherCAT slave latches the local time t local (n) when the SOF of the ARMW / FRMW instruction frame arrives, and respectively obtains the time delay value t delay (n) and t offset (n) from the system time delay register and the system time deviation register of its own station; where SOF represents the frame preamble.

[0022] Each EtherCAT slave calculates the local time drift Δt. If Δt is greater than 0, the slave clock is slowed down. If Δt is less than 0, the slave clock is speeded up, thus completing the time synchronization of the EtherCAT slave.

[0023] In one embodiment, the local time drift Δt is expressed as:

[0024] Δt = t local (n) - t offset (n) - t delay (n) - t sys_ref

[0025] where Δt is the time difference between the local time of EtherCAT slave n and the system time of the EtherCAT reference clock slave, t local (n) is the local time when EtherCAT slave n receives the ARMW / FRMW instruction, t sys_ref is the system time when the EtherCAT reference clock slave receives the ARMW / FRMW instruction, t offset (n) is the time deviation between EtherCAT slave n and the EtherCAT reference clock slave, t delay (n) is the time delay between EtherCAT slave n and the EtherCAT reference clock slave.

[0026] A time synchronization method for an EtherCAT-TSN network provided by the present invention. In the hybrid networking mode of EtherCAT and TSN, after the EtherCAT reference clock slave completes synchronization with the TSN domain master clock, the EtherCAT master station only needs to re-read the clock correction value and the link offset time value of each slave, calculate the new time offset value and write it back to each slave, saving the steps of measuring the EtherCAT link propagation delay and the time offset value in the current DC method, and can accelerate the synchronization process. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 is a schematic diagram for distinguishing EtherCAT and TSN frame types.

[0028] Figure 2 is the time synchronization flow chart of the EtherCAT-TSN network provided by the embodiment of this aspect. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0029] The following further elaborates on a time synchronization method for an EtherCAT-TSN network proposed by the present invention in conjunction with the accompanying drawings and specific embodiments. According to the following description, the advantages and features of the present invention will be clearer. It should be noted that the accompanying drawings are all in a very simplified form and use non-precise scales, only for conveniently and clearly assisting in explaining the purpose of the embodiments of the present invention.

[0030] As Figure 1 shown, by comparing the gPTP synchronization frames used in the TSN domain and the DC synchronization frames used in the EtherCAT domain, it is found that the gPTP synchronization frames and the DC synchronization frames have the same frame header structure: the destination address, source address, and VLAN Tag fields are all the same, and only in the frame type field, 0x88A4 is used to represent the EtherCAT frame, and 0x88F7 is used to represent the TSN synchronization frame. This enables the current frame recognition mechanism in EtherCAT and TSN to directly recognize the frame header and obtain the frame data without format conversion, thus providing the feasibility for the EtherCAT domain reference clock slave to access the TSN domain and synchronize with the TSN master clock.

[0031] The present invention provides a time synchronization method for an EtherCAT-TSN network, and its process is as Figure 2 shown, including the following steps:

[0032] S1: The EtherCAT domain reference clock slave obtains the correction value of the deviation from the TSN domain master clock through the gPTP synchronization mechanism, denoted as t correction and stores it locally, compensates the local time, and completes the TSN domain clock synchronization;

[0033] S2: The EtherCAT master station obtains the correction value from the reference clock slave through the read instructions APRD or FPRD or LRD, and obtains the time offset value t offset-pre (n) from each slave through the broadcast read BRD instruction, and recalculates the time offset value t offset (n) = t correction + t offset-pre (n);

[0034] S3: The EtherCAT master station writes the updated time offset value t offset (n) of each slave back into the time offset value register of each slave through the broadcast write BWR instruction;

[0035] S4: The EtherCAT master station uses ARMW or FRMW to read the reference clock time t sys_ref and transfers it to each slave;

[0036] S5: Each EtherCAT slave station completes the adjustment and compensation of the local time through the DC synchronization algorithm to achieve synchronization, that is, each slave station latches the local time t when the SOF (frame preamble) of the ARMW or FRMW instruction frame arrives. local (n), and obtains the time delay value t delay (n) and the time offset value t offset (n) from the system time delay register and the system time deviation register of its own station respectively. Each slave station calculates the local time drift Δt:

[0037] Δt = t local (n) - t offset (n) - t delay (n) - t sys_ref

[0038] If Δt is greater than 0, the slave station clock is slowed down; if Δt is less than 0, the slave station clock is speeded up to complete the slave station time synchronization.

[0039] S6: If the time of the EtherCAT reference clock slave station changes after synchronization with the TSN master clock, jump to S2 to recalculate the time offset value of each slave station;

[0040] If the time of the EtherCAT reference clock slave station does not change after synchronization with the TSN master clock, jump to S4 to execute the DC synchronization mechanism.

[0041] In the time synchronization method of the EtherCAT-TSN network described in the embodiments of the present invention, when considering the calculation of the link delay t delay(n) = [(t4 - t1) - (t3(n) - t2(n))] / 2, t1 refers to the local clock value when the reference clock slave station receives the master station message, t4 refers to the local clock value when the reference clock slave station receives the return message. t2(n) refers to the local clock value when slave station n receives the master station message, and t3(n) refers to the local clock value when slave station n receives the return message. In gPTP synchronization, the two have the same correction value. Therefore, when the link topology structure remains unchanged, the link delay remains unchanged and there is no need to recalculate. Only the new time offset value needs to be calculated and written back to each slave station, saving the steps of measuring the EtherCAT link propagation delay and the time offset value in the current DC method and accelerating the synchronization process.

[0042] The above description is only a description of the preferred embodiments of the present invention, and does not limit the scope of the present invention in any way. Any changes and modifications made by those of ordinary skill in the art of the present invention according to the above disclosure shall fall within the protection scope of the claims.

Claims

1. A time synchronization method for an EtherCAT-TSN network, characterized in that: include: In the hybrid networking mode of EtherCAT and TSN, the time synchronization between the EtherCAT reference clock slave and the master clock of the TSN network domain is achieved through the gPTP synchronization method; the reference clock slave refers to the first slave with DC function connected to the EtherCAT master, gPTP refers to the generalized precise time synchronization protocol, and DC refers to distributed clock; The EtherCAT network uses DC synchronization to achieve time synchronization between the EtherCAT master, EtherCAT slave, and EtherCAT reference clock slave. After each synchronization between the EtherCAT reference clock slave and the TSN domain master clock, the EtherCAT master recalculates the time offset between each EtherCAT slave and the EtherCAT reference clock slave, and updates the time offset value of each EtherCAT slave; The EtherCAT master uses the ARMW / FRMW instruction to read the reference clock, that is, the system time, from the EtherCAT reference clock slave, and writes it into all subsequent EtherCAT slaves, triggering each slave to adjust the local time and completing the time synchronization of all slaves; among them, ARMW represents the single-read multiple-write sequential addressing instruction, and FRMW represents the single-read multiple-write set addressing instruction.

2. The time synchronization method of the EtherCAT-TSN network according to claim 1, characterized in that: The EtherCAT and TSN hybrid networking method includes: The EtherCAT master station, the EtherCAT reference clock slave station, and the EtherCAT slave station together constitute the EtherCAT link, among which the EtherCAT reference clock slave station is simultaneously connected to the TSN network domain.

3. The time synchronization method of the EtherCAT-TSN network as claimed in claim 2, characterized in that: After each synchronization between the EtherCAT reference clock slave and the TSN domain master clock, the EtherCAT master recalculates the time offset between each EtherCAT slave and the EtherCAT reference clock slave, and updates the time offset value of each EtherCAT slave, including: After the EtherCAT reference clock slave is synchronized with the TSN master clock, the TSN synchronization message clock correction value is latched, and the EtherCAT master starts the EtherCAT link time offset measurement, calculates the new link time offset between each EtherCAT slave and the EtherCAT reference clock slave, and updates the offset value t in the system time deviation register of each slave. offset (n).

4. The time synchronization method of the EtherCAT-TSN network as claimed in claim 3, characterized in that: The calculation of the new link time offset between each EtherCAT slave and the EtherCAT reference clock slave comprises: The EtherCAT master uses the read data instruction to obtain the clock correction value t of the gPTP synchronization of the EtherCAT reference clock slave. correction , use the broadcast read command to obtain the current offset value t in the system time deviation register of each EtherCAT slave station offset-pre (n), calculate the new link time offset t correction +t offset-pre (n).

5. The time synchronization method of the EtherCAT-TSN network as claimed in claim 4, characterized in that: The EtherCAT master uses the ARMW / FRMW instruction to read the reference clock, that is, the system time, from the EtherCAT reference clock slave, write it into each EtherCAT slave, trigger each slave to adjust the local time, and complete the time synchronization of all slaves, including: The EtherCAT master station uses the ARMW / FRMW instruction to extract the system time t from the EtherCAT reference clock slave station during periodic synchronization. sys_ref , and send it to each EtherCAT slave station; The local time t when each EtherCAT slave latches the arrival of the SOF of the ARMW / FRMW command frame local (n), respectively obtain the time delay value t from the system time delay register and system time deviation register of this station delay (n) and t offset (n); wherein SOF represents a frame preamble; Each EtherCAT slave calculates the local time drift Δt. If Δt is greater than 0, the slave clock is slowed down. If Δt is less than 0, the slave clock is accelerated to complete the EtherCAT slave time synchronization.

6. The time synchronization method of the EtherCAT-TSN network according to claim 5, characterized in that: The local time drift Δt is expressed as: Δt=t local (n)-t offset (n)-t delay (n)-t sys_ref Where Δt is the time difference between the local time of EtherCAT slave n and the system time of the EtherCAT reference clock slave, t local (n) is the local time when EtherCAT slave n receives the ARMW / FRMW command, t sys_ref The system time when the EtherCAT reference clock slave receives the ARMW / FRMW command, t offset (n) is the time deviation between EtherCAT slave n and the EtherCAT reference clock slave, t delay (n) is the time delay between EtherCAT slave n and the EtherCAT reference clock slave.