1 Example project
There is not no EoE Example availebleavailable. Take the source from ECS simpleConfig Example and Socket Interface Example
...
ptConfigReq->tData.tBasicCfg.ulComponentInitialization |= ECAT_SET_CONFIG_DEVICEINFO | ECAT_SET_CONFIG_EOE;
3 ESI
Add in the following EoE parameters to the ESI the EoE , in the Mailbox area:
<Mailbox DataLinkLayer="1">
...
Install the new ESI in TwinCAT.
Now the EoE can be seen in TwinCAT in the advanced settings.
...
The MAC and IP settings will be written to the slave with the following startup parameter.
There is no other way to set the IP to the EtherCAT Slave.
5
...
Application
To use the EoE in the application the socket API is necessary. Go to the Socket Interface Example for more application sourcecode:
netX 90 - Ethernet Interface - Examples
copy the Socket folder to the ECS project
and change the wscript
and activate the ethernet interface channel 1
Bring the ECS Slave to Pre-Operational state. TwinCAT writes EoE startup parameter (MAC and IP) in the statechange form Init to Pre-Operational to the ECS Slave. After that EoE is ready.
The example demonstrates the TCP/UDP server and client ability of the socket interface. For the opposite part, any TCP/UDP server respectively client can be used, for example Socket Test shown below.
https://sourceforge.net/projects/sockettest/
use the same IP like in TwinCAT
The configuration of the socket interface is done by hSockCtrl[] table in AppSockIf_DemoApplicationFunctions.c. Several instances may be created, thus an amount of combination of TCP/UDP servers and clients can be implemented, the limitation of the instances is given by BACKLOG define, the bigger the BACKLOG, the fewer instances are possible.