Ethernet over EtherCAT (EoE) transparently tunnels standard Ethernet communication via EtherCAT. Tunneling allows the MainDevice to optimize Ethernet communication without affecting the process data communication. EoE enables communication with network devices. EoE is typically used for devices with TCP/IP stack, such as a web server, or for infrastructure devices such as switch ports, to which peripheral devices can be connected.
| Name | Size (Bit) | Description |
|---|---|---|
| Type | 4 | 0 = Frame Fragment Follows, 1 = Time Stamp Response Follows, 2 = IP Settings Request Follows, 3 = IP Settings Response Follows, 4 = MAC Filter Settings Request Follows, 5 = MAC Filter Settings Response Follows, 6-15 = Reserved |
| Port | 4 | Must be valid if LF=1. 0 = unspecified, 1 = Send/Received on Port 1, 2 = Send/Received on Port 2, 3..x = Send / Received on Port 3 .. x |
| LF | 1 | Last Fragment: Indicates the last fragment (Type=0 only) |
| TA | 1 | Time Stamp appended (only if LF=1) |
| TR | 1 | Time Stamp requested |
| Res | 5 | |
| FragmentNo | 6 | |
| Offset/CompleteSize | 6 | FragmentNo = 0: Contains needed buffer size, FragmentNo > 0: Offset of the fragment within the complete Ethernet Frame (Multiplied with 32) |
| FrameNo | 4 | Increments each new Ethernet Frame |
The EoE frame can contain different parts depending on the flags set in the header. The following diagram shows the possible combinations. Note that the fragment data is the same as the Ethernet frame, and it is always a multiple of 32 bits, except for the last fragment.
The motivation of the code snippets is to provide a better understanding of how to configure and transport the Ethernet frames. For a detailed overview please refer to the Webserver Example.
Register a function for network settings. The function is called when the EtherCAT MainDevice sends an EoE frame with the network device settings (IP address, Gateway, MAC address and DNS server). These parameters must be given then to the users virtual network interface.
This function registers a function which must be implemented by the user. The user defined function is called any time an EoE frame is received.
Use this function to send Ethernet frames over the EtherCAT network.
Enable Virtual Ethernet Switch and the TCP/IP Stack connection for the EtherCAT MainDevice on TwinCAT. Adapt the parameters to your needs, but make sure your application can handle them.
Enable Virtual Ethernet Port and set an IP address to the EtherCAT SubDevice. The default gateway must be the EtherCAT network interface IP address. These parameters will be given to the function registered to EC_API_SLV_EoE_cbRegisterReceiveHandler.
For troubleshooting, it is highly recommended to use Wireshark. Some useful filters for this purpose are:
For more filters please refer to the Wireshark EtherCAT Mailbox Filter Reference.