Skip to content

EtherCAT devices and mapping

An EtherCAT connection needs the list of the devices (slaves) on the bus, in bus order, with their process data (PDO entries). Then you map PDO entries to PLC variables.

Open the menu (⋮) of the connection and select Available items. The same dialog opens from the list icon in the toolbar of the Mappings tab. It shows the devices of the connection and has four actions:

Menu of the connection with Available items, Edit, Export and Delete

Available items of a new connection: Scan bus, Import ENI file, Import ESI file and Add device

ActionWhen to use itResult
Import ENI fileYou have a TwinCAT project of the bus (recommended)All devices with the PDO assignment and start-up commands of TwinCAT
Scan busThe bus is connected and you imported the ESI files of the devicesThe devices found on the bus, matched with the ESI catalogue
Add deviceNo bus at hand, or you want to compose the bus by handOne device from the ESI catalogue at a position
Import ESI fileBefore a bus scan or Add deviceDevice types in the ESI catalogue of your organization

Import ENI file, Scan bus and Add device replace devices of the connection. A mapping is removed when its device or its PDO entry no longer exists. The result lists every removed mapping.

The ENI file (EtherCAT Network Information) describes the bus as TwinCAT configured it.

  1. In TwinCAT, select the EtherCAT master of the EK1000, open the EtherCAT tab and select Export Configuration File…. Save the XML file.

  2. In logiccloud, open Available items of the connection and select Import ENI file. Select the file and select Import.

    Import ENI file dialog with the selected file ek1000-el2008-el3182.eni.xml

Expected result: Slaves imported: N, and a list of removed mappings if there were any.

Import result: Slaves imported 3, and a warning that the EL9011 end cap is not imported

Available items now lists every device with its position, identity and PDO entries:

Available items with Term 1 (EK1000), Term 2 (EL2008) and Term 3 (EL3182) and their PDO entries

  • The connector uses the slave identities, the PDO assignment and the start-up commands (InitCmds, including CoE SDO downloads) of the file. Start-up commands for registers that the master sets itself are not replayed (log line Init command not replayed: the master owns these registers).
  • Terminals without an EtherCAT slave controller, for example the EL9011 end cap, are not imported. The import shows a warning for each.
  • The file can be up to 20 MB.
  • The order of the terminals in the file must be the order on the bus. When the terminals are wired in another order than in the TwinCAT project, the connector stays in PREOP and logs Topology mismatch. Correct the wiring, or export the file again from a TwinCAT project that matches the wiring.

An ESI file (EtherCAT Slave Information) describes the device types of one vendor. Use the original files of the vendor, for example Beckhoff EL2xxx.xml from the TwinCAT folder Config\Io\EtherCAT or from the vendor’s website.

  1. Open Available items of the connection and select Import ESI file. You can also use Import ESI file on the EtherCAT node.
  2. Select the file and import it.

Expected result: Created: n, Updated: n, Skipped: n. The device types are available for all EtherCAT connections of your organization.

The scan runs on the device: the runtime with this connection must be installed on a device, and no other master may run the segment.

  1. Open Available items of the connection and select Scan bus. The scan starts at once and takes up to 45 seconds.
  2. Check the result table: position, name, vendor ID, product code, revision, and Matched or Not matched in the ESI column.

A device with Not matched has no device type in the ESI catalogue and cannot be mapped. Import the ESI file of its vendor and scan again, or import an ENI file.

  1. Open Available items of the connection and select Add device.
  2. Search the device type, for example EL1008, and select it.
  3. Enter Position on the bus (1 is the first device after the master). A device at this position is replaced.
  4. Select Add.

At start-up the connector checks that the device at each position has the configured vendor ID, product code and revision. Additional devices at the end of the bus are allowed.

  1. Declare the PLC variables in the program: read-only variables (for example { IN }) for inputs, writable variables (for example { OUT }) for outputs. Save the program, then open Configurations > your configuration (for example my_config) > Inputs/Outputs and select Refresh: only variables in this list can be mapped.

  2. Open the node <connection name> Mappings under the connection.

  3. Add a row per value: with the add icon (Add mapping) one row at a time, or with Advanced fill, which adds one row per selected variable. In each row, select the PLC variable and the EtherCAT item (a PDO entry of a device). Type part of the label, for example 0x7000:1 or MasterLock, to filter the list. The Direction follows from the entry. The Type is preset from the device description.

    EtherCAT item list of a mapping row: entries with position, device, PDO, entry name, index, width and direction

  4. Save with the save icon (Save all) in the toolbar. One save replaces all mappings of the connection.

Mappings tab with 14 mappings of the example: EK1000 inputs, EL2008 outputs and EL3182 inputs

Import mappings reads a CSV file with the columns of the grid: PLC variable, EtherCAT item and Type. Use Export mappings to get a file in this format. The EtherCAT item is the key <position>:<PDO index>:<entry index>:<sub-index> in decimal, for example 2:5632:28672:1 for 0x1600 / 0x7000:1 of the device at position 2. The type is read without regard to case (BOOL or Bool). A row whose item is not on this connection is marked, and the save is blocked with The PDO entry ... is not on this connection: select the item again.

DirectionData flowPLC variable
Inputdevice to PLC (TxPDO)read-only
OutputPLC to device (RxPDO)writable

The data type must be as wide as the PDO entry:

Entry widthData types
1 bitBOOL
8 bitsBYTE, SINT, USINT
16 bitsWORD, INT, UINT
32 bitsDWORD, DINT, UDINT, REAL
64 bitsLWORD, LINT, ULINT, LREAL

A row with an invalid value blocks the save. The message names the row, for example The type INT does not fit a PDO entry of 32 bit(s).

  1. Build the project and deploy the runtime to the device.
  2. Open the log of the EtherCAT connector on the device.

Expected log lines within about 10 s:

  • EtherCAT scan finished with the number of slaves.
  • EtherCAT master state with state=OP and the number of slaves.

Then check the values in the debug view or the HMI: inputs change with the process, and outputs written by the PLC appear on the terminals (for example the LEDs of an EL2008).

If the connector stays in PREOP or reconnects, see Troubleshooting.

Select the connection, then Export, to save it as a file. Use Import EtherCAT connection on the EtherCAT node to add it to another runtime.