ReferenceDevice driversEtherCATRead task

EtherCAT read task

Learn how to acquire data from EtherCAT devices with Synnax.

This task follows the standard task lifecycle.

Before creating a read task, configure your EtherCAT devices and identify the TxPDOs (input PDOs) to read from each one.

All channels in a task must use devices connected to the same network interface. Create separate tasks for devices on different EtherCAT networks.

Task configuration reference

Parameter Type Required Default Description
sample_rate number 10 Samples per second (Hz)
stream_rate number 5 Rate data is streamed to Synnax (Hz), must be ≤ sample_rate
channels array - List of input channel configurations

Channel configuration

Each channel reads one TxPDO entry at its CoE index and sub-index. The Driver gets the size of the entry from the device, so the data type of the channel must be the same size.

Entry channel

Reads one TxPDO entry.

Parameter Type Required Default Description
type string - Must be "entry"
device string - Device key
index number - CoE object index (e.g., 0x6041)
sub_index number - CoE object sub-index
data_type string - Synnax data type, the same size as the entry
channel number - Synnax channel key

The Console lists each entry the device reports, with its address. In code, find the address of an entry by name with ethercat.find_entry in Python or ethercat.findEntry in TypeScript.

A task from an earlier release can hold an "unresolved" channel: one that named an entry the device does not have, or has more than once. Pick an entry for it in the Console before the task runs.

CoE (CAN over EtherCAT) addressing uses a 16-bit index and 8-bit subindex. Common servo drive objects include status word (0x6041), position actual (0x6064), and velocity actual (0x606C).

Important rules

  • Network constraint -> All channels must use devices on the same network interface.
  • Hardware timing -> EtherCAT timing is deterministic. The sample rate sets how often the task takes a sample from the bus. See how the Driver runs a network.
  • Stream rate -> For sample rates under 50 Hz, set the stream rate equal to the sample rate. Above that, keep the stream rate under 50 Hz.
  • Timestamps -> Each sample has the time of the bus cycle that read it. If a device on the network has a distributed clock (DC), the SOEM master measures that time with the DC, so the timestamps show when the frame passed the devices, without the jitter of the host clock. They stay aligned with the host clock. When the host computer is busy, a cycle can still run late, and its timestamp shows the delay.

How-to