This is a light implementation of an ethercat slave for linux. It is used to test etherlab master and gain experience.
This implementation was tested with two slaves in OP state using etherlab master.
Ecslave comes in two flavors, user space and kernel space module.
ECSLAVE AS USER SPACE
Linux , 32/64 bit.
1. automake
2. libcap
3. libpthread.
$ autoreconf
$ automake --add-missing
$ sh configure
$ make
$ sudo ./ec_slave ethX <nr slaves=""></nr>
ethX is the network interface receiving data from master
NR SLAVES is the number of slaves you wish to simulate
ECSLAVE AS KERNEL MODULE
Linux kernel headers for the target kernel.
$ cd ecslave/kernel
$ make
$ insmod ecslave.ko rxmac=XX:XX:XX:XX:XX:XX txmac=XX:XX:XX:XX:XX:XX
if it is last slave in the chain, use only the rxmac module parameter.
Example : OP MODE:
This slave reaches OP mode. but to do so one needs to compile it in the etherlab suite.
so:
1. Copy the directory virtual_drive into the examples directory in etherlab.
2. Fix configure.ac in etherlab folder and fix the Makefile.am in etherlab-1.5.1/examples direcory.
3. make all
4. Execute examples/virtual_drive/.libs/libix_example in the the master's machine.
My setup is as constructed from 3 machines, master + 2 slaves.
The master is etherlab 1.5.1 on a intel core i5.
slave 0: Laptop . intel dual core i3. Input interface is realtek interface.
Output interface is usbnet adapter.
slave 1: laptop. intel dual core Pentium. input interface is realtek. 8139
Propagation delay: 250us
Slave 0 : vortex + two network interfaces.
Input interface realtek 8139
Output interface is RDC r6040
slave 1: Raspberry pi. Interface is usb based. drive is smsc95xx.ko
Propagation delay:208us
Slave 0 : vortex + two network interfaces.
Input interface : realtek 8139
Output interface : RDC r6040
slave 1: laptop. intel dual core Pentium. input interface is realtek. 8139
Propagation delay: 53us
Conclusions
USB to NET is worst for performance. comparing test 1 to test 3 proves that using ethernet over usb network devices is extremely slow.
TODO
Improve timer accuracy.