Menu

Howto

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

PREREQUISITES

Linux , 32/64 bit.
1. automake
2. libcap
3. libpthread.

BUILD

$ autoreconf
$ automake --add-missing
$ sh configure
$ make

EXECUTION

$ sudo ./ec_slave ethX <NR SLAVES="">

ethX is the network interface receiving data from master
NR SLAVES is the number of slaves you wish to simulate

        ECSLAVE AS KERNEL MODULE

PREREQUISITES

Linux kernel headers for the target kernel.

BUILD

$ cd ecslave/kernel
$ make

EXECUTION

$ 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.

MASTER'S SIDE

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.

Propagation Delay Benchmarks

My setup is as constructed from 3 machines, master + 2 slaves.
The master is etherlab 1.5.1 on a intel core i5.

test 1

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

test 2

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

test 3

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
  1. 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
    
  2. Improve timer accuracy.

  3. Find cheap hardware that can be used linux slave.
    The hardware is required to:
    1. Send signals to a scope.
    2. Programmable hardware timer.
    3. Replace kernel with preempt rt kernel.
  4. fix etherlan and eslave to work over udp.