The present invention discloses a method for
clock synchronization between multiple
EtherCAT network segments, including: Step 1, synchronize the clocks of multiple slave stations within each of the multiple
EtherCAT network segments; Step 2, the MCU generates a pulse
signal LATCH; Step 3, when ESC1 and ESC5 detect the rising edge of the LATCH
signal, latch the local
system time, which are T1 and T5 respectively; Step 4, the MCU reads the time T1 of the rising edge of the LATCH latched by ESC1 and writes T1 into ESC5; Step 5, ESC5 compares T5 and T1, if T5 > T1, slow down the local time; if T5 < T1, speed up the local time; Step 6, the MCU periodically generates the LATCH
signal, reads T1 and writes T1 into ESC5; Step 7, ESC5 periodically adjusts the local
system time to achieve
clock synchronization with ESC1, realizing
clock synchronization of multiple network segments.
Timestamp latching and time adjustment are both implemented by ESC, and the MCU
software only responsible for
data transmission and does not participate in clock adjustment, so clock errors will not be introduced.