EtherCAT SubDevice role
An EtherCAT segment has exactly one MainDevice (master). Usually the logiccloud EtherCAT connection is that MainDevice: it sends the frames and reads and writes the devices on the bus.
With the SubDevice role, logiccloud is a device in the segment of another master instead, for example a PLC with TwinCAT or an acontis EC-Master. The other master keeps running the bus. logiccloud reads the values that the master writes to it and supplies values that the master reads.
When to use it
Section titled “When to use it”| Situation | Role |
|---|---|
| logiccloud is the only controller on the EtherCAT segment, for example an EK1000 with terminals | MainDevice |
| A PLC already runs the EtherCAT segment and logiccloud must exchange values with it | SubDevice |
A third option needs no SubDevice role: a bridge terminal (for example Beckhoff EL6692 or EL6695) connects two segments, each with its own master. logiccloud is then the MainDevice of its own segment.
How it works
Section titled “How it works”The software in the logiccloud connector works like the EtherCAT chip of a real device:
- The frame of the master arrives on the IN interface.
- The connector reads the values addressed to it, writes its own values into the frame and counts the frame (working counter).
- The connector passes the frame on: to the OUT interface when a device follows, or back through IN when logiccloud is the last device.
- Frames that return on OUT go back through IN unchanged.
There are two topologies:
| Topology | Interfaces | Example |
|---|---|---|
| End of the line | IN only | master → logiccloud |
| Middle of the line | IN and OUT | master → logiccloud → EK1000 → terminals |
Limits
Section titled “Limits”- Distributed clocks (DC): not supported. A software device cannot timestamp frames on the wire. The generated ESI file declares no DC.
- Cycle time: plan with 4 ms or more on the master. Tested with a 4 ms master cycle (acontis EC-Master) on a Raspberry Pi 4 class device (aarch64): 5 min 42 s in OP, 114,372 frames, none lost or malformed. Check shorter cycles on your own device before you use them.
- Mailbox: CoE only, read-only: identity (0x1018), device name (0x1008), sync manager types (0x1C00), PDO assignment (0x1C12, 0x1C13) and PDO mapping (0x1600, 0x1A00). An SDO download is refused with abort code 0x06010002 (read only) or 0x06020000 (object does not exist).
- Process image: at most 768 bytes written by the master and 3072 bytes read by the master.
- Middle of the line: when the connector stops or the device restarts, the devices after logiccloud lose the bus, as with a powered-off real device.
- Transport: layer 2 only. The connector needs the capability CAP_NET_RAW, as for a layer-2 MainDevice.
Creating a SubDevice connection
Section titled “Creating a SubDevice connection”Prerequisites:
- A runtime on a Linux device with one free network interface for IN (two for the middle of the line).
- The PLC variables to exchange, declared in the program: read-only variables (for example
{ IN }) for values that the master writes, writable variables (for example{ OUT }) for values that the master reads.
Steps:
- In the project tree, open the menu of the runtime and select Add connection. Select EtherCAT, then Create new.
- On the General tab, enter the connection name and set Role to SubDevice: logiccloud is a device in the segment of another master. The dialog adds the tabs Device and Process data. The transport is layer 2.
- On the Bus tab, enter the IN interface, for example
eth0. Leave OUT interface empty when logiccloud is the last device; otherwise enter the second interface, for exampleeth1. Set PLC exchange cycle (ms): how often the values are copied between the SubDevice and the PLC. Set Master silence timeout (ms): the connection counts as disconnected when the master sends no frame for this time (at least three exchange cycles). - On the Device tab, enter the Device name. Keep or change Vendor ID, Product code and Revision (decimal or
0xhex). The master tool shows these values. - On the Process data tab, under Written by the master, add one value per item that the master writes. Choose the data type and the read-only PLC variable that receives it.
- Under Read by the master, add one value per item that the master reads. Choose the data type and the writable PLC variable that supplies it.
- Select Save. A tab with an invalid value shows a red !: open it and correct the value.
Expected result: the connection appears under EtherCAT. Its mapping node says that the values are edited in the connection dialog.
How the values travel
Section titled “How the values travel”- SubDevice (this page): the other master sends the frames. Every frame passes through logiccloud. logiccloud copies each value that the master wrote into its PLC variable and puts the values of all mapped PLC outputs into the frame, which then goes on to the next device or back to the master.
- MainDevice: logiccloud sends the frames. Every cycle it sends one frame with the values of all mapped PLC outputs, reads all mapped inputs from the returned frame into their PLC variables, and starts the next frame with the latest outputs.
Importing the ESI file into the master tool
Section titled “Importing the ESI file into the master tool”- Select the connection, then Edit.
- On the Device tab, select Download ESI file. The browser saves
<device name>.xml. - Copy the file into the ESI folder of the master tool, for example
C:\TwinCAT\3.1\Config\Io\EtherCATfor TwinCAT 3, and reload the device descriptions. - Scan the bus in the master tool, or add the device by hand at its position.
- Activate the configuration of the master.
Expected result: the master shows the logiccloud device with its name and process data, and brings it to OP.
Download the ESI file again after every change of the process data, and update the device in the master tool.
Deploying and checking
Section titled “Deploying and checking”- Deploy the runtime to the device.
- Open the log of the EtherCAT connector on the device.
Expected log lines:
EtherCAT SubDevice waiting for the masterafter the start, with the interfaces and the identity.EtherCAT SubDevice connected: the master runs the device in OPwhen the master reaches OP.EtherCAT SubDevice statisticsevery 60 s, with frame counters (framesIn,forwarded,returned,passedBack,malformed,sendErrors).
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause and action |
|---|---|
Log: Cannot open the layer-2 transport: the connector needs the capability CAP_NET_RAW | The connector may not open raw sockets. Install the EtherCAT connector with the device installer, which grants CAP_NET_RAW. |
Log: the network interface does not exist | The IN or OUT interface name is wrong. Check the name with ip -br link on the device. |
Log: EtherCAT SubDevice disconnected: the master left OP or sends no frames | The master stopped, the cable is unplugged, or the master cycle is longer than the silence timeout. Increase the timeout or check the master. |
| The master does not find the device | Check the cable to the IN interface. In the middle of the line, check that the master is connected to IN, not to OUT. |
| The master stays in PREOP or SAFEOP | The configuration in the master tool does not match the device. Download the ESI file again and update the device in the master tool. |
malformed grows in the statistics | Frames arrive that are not valid EtherCAT frames. Make sure the interface carries only the EtherCAT segment. |