EK9300 - CoE data access over PROFINET

Description

CoE means Can over EtherCAT. It enables access to all parameters of an EtherCAT device. The CoE data model is based on the principles of CANopen and uses index and subindex for reading from and writing to parameters, if the corresponding access is enabled.

Further information can be found here: System Documentation

Task

Parameters of an EtherCAT device can generally be set and parameterized via the parameters of the GSDML file. However, in some applications it is necessary to change certain parameters at runtime or to carry out optimizations during operation.

Solution

The CoE data are sent via acyclic PROFINET services (PROFINET index 0x200F). The position of the EtherCAT device is specified via the slot number. The CoE data are then entered in the record data. During reading they consist of CoE index and CoE subindex, during writing they consist of CoE index, CoE subindex and the data to be sent.

Reading/writing sample

For reading, a WriteReq record must be sent first. This includes the CoE index and CoE subindex. After the WriteRsp a ReadReq has to be sent in order to retrieve the data, which are then contained in the ReadRsp.

Writing takes place in the same way, except that WriteReq includes the data, and ReadRsp serves as acknowledgement to indicate whether writing was successful.

CoE data access over PROFINET, read/write sample

Getting Started - Reading

PROFINET record data (write request)

Value

Meaning

Slot

Position of the EtherCAT device (1...255)

Slot number, position of the EtherCAT device

SubSlot

1

Sub-slot number, always "1"

Index

0x200F

PROFINET index number

Length

4

Length of the following data

Data

Bytes 1 and 2 SDO index
Byte 3 CoE subindex
Byte 4 "0" reserve

CoE data

Delay time, we recommend 100..250 ms until the read request is sent, which includes an acknowledgment of error-free writing.

PROFINET record data (read request)

Value

Meaning

Slot

Position of the EtherCAT device (1...255)

Slot number, position of the EtherCAT device

SubSlot

1

Sub-slot number, always "1"

Index

0x200F

PROFINET index number

Length

Write
4

Answer
4 bytes + x bytes

Length of the following data

Data

Write
Byte 1 "1"
Byte 2 "0"
Byte 3 "0"
Byte 4 "0"

Answer
Bytes 1..4 ADS error
Bytes 4..x CoE data value

CoE data

The response to the read request, i.e. the read response, includes the data. The first 4 bytes contain the error code. This is "0" if the response is error-free. The error code is an ADS error code. Further information can be found under the following link.

http://infosys.beckhoff.com/content/1031/tcsample/html/ads_returncodes.htm

Wireshark sample for reading (Download file)

Getting Started - Writing

PROFINET record data (write request)

Value

Meaning

Slot

Position of the EtherCAT device (1...255)

Slot number, position of the EtherCAT device

SubSlot

1

Sub-slot number, always "1"

Index

0x200F

PROFINET index number

Length

4

Length of the following data

Data

Bytes 1..2 SDO index
Byte 3 SDO subindex
Byte 4 "1" constant
Bytes 5..8 length as DWORD
Bytes 9..x CoE data value

CoE data

Delay time, we recommend 250..500 ms until the read request is sent, which includes an acknowledgment of error-free writing.

PROFINET record data (read request)

Value

Meaning

Slot

Position of the EtherCAT device (1...255)

Slot number, position of the EtherCAT device

SubSlot

1

Sub-slot number, always "1"

Index

0x200F

PROFINET index number

Length

Write
0

Answer
4

Length of the following data

Data

Write
-

Write
ADS error code

CoE data

The response to the read request, i.e. the read response, includes confirmation that writing was successful. The first 4 bytes contain the error code; "0" indicates error-free response. The error code is an ADS error code. Further information can be found under the following link (system documentation).

Wireshark sample for writing (Download file)

EK9300 - CoE data access over PROFINET 1:

Observe data format

During reading and writing, observe the data size and the format of the corresponding SDO parameters. We recommend reading the SDO data first, then interpret them and use the read data format also for writing the CoE data (perhaps swap High/Low BYTE/WORD).

EK9300 - CoE data access over PROFINET 2:

Start-up parameters overwrite CoE data

CoE data are typically not stored in the EtherCAT device. Ensure that start-up parameters (GSDML) overwrite the CoE data during startup of the EK9300.