Internal and external EtherCAT synchronization

In a machine control with distributed components (I/O, drives, several masters) it may be useful for the components to operate with a close time link to each other. The components must therefore have a local “time”, to which the component (e.g. an I/O terminal) has access at all times.


Associated requirements may include:

  1. Several outputs in a control system have to be set simultaneously, irrespective of when the respective station receives the output data.
  2. Drives/axes in a control system must read their axis positions synchronized, irrespective of the topology or cycle time.

    Both requirements necessitate a synchronization mechanism between the local times of the components of a control system.
  3. If inputs affect the control system, the (absolute) time must be recorded. This can be helpful for subsequent analysis, if such an analysis is required for determining the sequence of events in functional chains.
    This means that time running in the components must be coupled to a globally valid time, e.g. Greenwich world time or a network clock.
  4. tasks on different controllers should run synchronous and without phase shift.

The terms “close temporal reference” or “simultaneous” can be interpreted depending on requirements: for a “simultaneity” in the 10 ms range a serial communication structure may be adequate, while in other ranges 100 ns or less are required.

Internal and external EtherCAT synchronization 1:
Simple I/O topology

Fig. Simple I/O topology shows a simple EtherCAT topology consisting of a master, several I/Os and an axis. A local time is to be applied in different components. The tasks
- synchronization of local clocks
- coupling to a higher-level reference time
- task synchronization

are discussed below.

Requirement 1 + 2: synchronization

In an EtherCAT system the distributed clocks concept (DC) is used for synchronization of local clocks in the EtherCAT components. Further information can be found in the separate  documentation.

Synchronization of local EtherCAT devices

General:

Master:

Slave:

Internal and external EtherCAT synchronization 2:
mapping of DC to the topology

In Fig. Mapping of DC to the topology the 3rd EtherCAT slave was selected as DC reference clock as a sample. The local time of this slave is now used to adjust all other distributed clocks, i.e. all other EtherCAT slaves and the clock of the EtherCAT master. This is achieved through synchronization datagrams, which the EtherCAT master sends cyclically.

This procedure ensures that all devices supporting DC always have local access to a time that is identical (within the DC synchronization precision) in all devices.

The system now operates based on the timebase of the selected DC reference clock and its local clock generator/quartz with TDC. Due to production tolerances this timebase is rarely the same as the official sidereal time/coordinated world time UTC TUTC or another reference time. This means that 1 msUTC is never exactly 1 msDC, TDC≠ TUTC. Over longer periods also drift processes may also change the ratio. As long as DC is used for relative processes within the EtherCAT system, the deviation from the UTC is irrelevant. However, if the DC time is to be used for data logging with a global timebase, for sample, the DC timebase must be synchronized with the UTC timebase. This is described in section Requirement 3.

Requirement 3: higher-level global time, absolute time

If the timebase TDC is to be adjusted based on a higher-level timebase, the timebase and the associated procedure must be selected. Generally common synchronization protocols are used for the synchronization. Samples for time sources and synchronization procedures are listed below.

The following synchronization precisions can be achieved (depending on the hardware)

The following two control aims must be achieved:

Internal and external EtherCAT synchronization 3:

External EtherCAT synchronization

External synchronization sources (e.g. EL6688, EL6692) can only be used from TwinCAT 2.11 used. In older versions of TwinCAT such EtherCAT slaves have no meaningful function.

If a higher-level master clock is integrated in an EtherCAT system, a special EtherCAT device is generally used for the physical connection. The device monitors both timebases and is therefore able to determine the time difference.

Please refer to www.beckhoff.de for suitable products currently available for this purpose.

Internal and external EtherCAT synchronization 4:
EtherCAT topology with external reference clock

The different timebases can be arranged hierarchically, so that at the start of the respective system the current absolute time is taken from the subordinate system. If necessary top-down synchronization is used, if external timebases or DC components are present in the system.

Readjustment of local time vs. higher-level absolute time

For the purpose of synchronization the local DC time is not adjusted based on the higher-level absolute time, but only to a constant offset. This offset is made available to the user as a process data. The offset is corrected by ±½ cycle time to ensure both tasks run in phase.

TwinCAT system behavior

External reference clock outage

If the external reference clock signal fails, both timebases will naturally drift apart again. Once the signal is available again, the system will once again be controlled based on the previous offset values.

TwinCAT can start without external clock signal. In this case the offset is calculated and maintained as described above, as soon as a stable external reference clock signal is received.

Settings in TwinCAT 2.11

External synchronization via EtherCAT is supported from TwinCAT 2.11. The synchronization direction can be set in the associated dialog.

Distributed clock timing settings

Internal and external EtherCAT synchronization 5:
TwinCAT 2.11 distributed clock settings - Sample for EL6688 in PTP slave mode as time reference for the local EtherCAT system

Process data settings

TwinCAT 2.11 can display the current offsets in [ns] in the EtherCAT master info data.

Sample: tEL1252 timestamp channel 1, absolute time = tEL1252 timestamp channel 1, local DC time + tExtToDcOffset

Internal and external EtherCAT synchronization 6:
display current offsets
Internal and external EtherCAT synchronization 7:
Current offsets