EtherCAT Get Notifications

Collect notifications from the EtherCAT bus

  • Library:
  • Simulink Real-Time / EtherCAT


Collects notifications from the EtherCAT® stack and presents them to the output as a 21-element vector of int32. At each time step, the block outputs what it has accumulated and clears itself for the next time step.

The vector contains the number of notifications in element 1, followed by up to 20 notification codes. The maximum number of notifications is 20. If the bus presents more than 20 notifications to the output, the block discards the newest notifications and presents the first 20 that were received.



expand all

  • Length (020) — the number of notifications in the vector.

  • Notification — a composite of a notification type and a specific value. The types are:

    • EC_NOTIFY_GENERIC [0x00000000 (0)] — Represents state changes, such as:0x00000001 (1) — EtherCAT operational state change.

    • EC_NOTIFY_ERROR [0x00010000 (65536)] — Represents error states, such as 0x00010001 (65537):cyclic command: working counter error. Some describe changes in error state.

    • EC_NOTIFY_SCANBUS [0x00030000 (3*65536)] — Represents ScanBus error states, such as 0x00030002 (196610):ScanBus mismatch.

    • EC_NOTIFY_HOTCONNECT [0x00040000 (4*65536)] — Represents hot connect states, such as 0x00040005 (262149):Slave disappears.

To print the valid notification values and descriptions, call SimulinkRealTime.etherCAT.filterNotifications without an argument.

Data Types: int32


expand all

To associate a block with an EtherCAT network, copy the Device index value from the EtherCAT Init block representing that network into the Device index for the block.

Programmatic Use

Block Parameter: device_id

Enter the base sample time or a multiple of the base sample time. Use the EtherCAT task sample time.

Programmatic Use

Block Parameter: sample_time


To collect notifications:

  1. Add the EtherCAT Get Notifications block to your model.

  2. Connect the EtherCAT Get Notifications block to an Outport block. If possible, make this Outport block Outport block 1. If the EtherCAT Get Notifications block is connected to the first Outport block, the 21 notification signals appear in the first 21 columns tg.OutputLog matrix. Otherwise, you must specify the columns with an offset.

  3. Increase the value of Signal logging data buffer size in doubles by at least a factor of 100 in the Simulink Real-Time Options pane. The EtherCAT Get Notifications block can quickly increase the size of the output log.

  4. To print the notifications for this model, pass the relevant 21 columns into the SimulinkRealTime.etherCAT.filterNotifications function.

Introduced in R2017a