IgH EtherCAT Master Stack¶
The EtherCAT master stack by IgH is being used for open source projects for automation of systems such as ROS (Robot Operating System) and Linux CNC Applications of an open source–based EtherCAT master system not only reduces cost, but also makes application program development flexible. Based on the native, Intel made the following optimizations:
Support Linux Kernel 4.x
Support Xenomai 3 and Preempt RT
Migrate Operation thread to cobalt
Migrate latest igb driver to stack
This section describes how to run IgH EtherCAT Master Stack on Edge Controls for Industrial(ECI).
EtherCAT Master Setup¶
Dependencies¶
Native EtherCAT Device Driver – IGB (high performance)
Only support igb device(example: intel i210/i211 NICs)
One networking driver for EtherCAT and non-EtherCAT devices.
Driver gets more complicated, as it must handle EtherCAT and non-EtherCAT devices
- Generic EtherCAT Device Driver – generic (low performance)
Any ethernet hardware, that is covered by a Linux Ethernet driver can be used for EtherCAT
Performance is a little worse than the native approach, because the frame data have to traverse the lower layers of the network stack
Note: If the target system does not support the IGB device driver, the generic EtherCAT device driver may be selected instead.
System Integration¶
The following section is applicable to:

EtherCAT Init Script¶
The EtherCAT master init script is installed to /etc/init.d/ethercat
.
EtherCAT Sysconfig File¶
The init script uses a sysconfig file installed to /etc/sysconfig/ethercat
, that is mandatory for the init script. The sysconfig file contains all configuration variables need to operate one or more masters. The documentation is inside the file and included below:

- Set REBIND_NICS
Use lspci to query net devices, one may be specified as an EtherCAT Network interface.

- Fill MAC for MASTER0_DEVICE
Get MAC address of the Network Interface Controllers selected for EtherCAT

- Modify DEVICE_MODULES
Option 1: IGB device as EtherCAT driver(High performance)
DEVICE_MODULES="igb"
Option 2: generic driver as EtherCAT driver(low performance)
DEVICE_MODULES="generic"
Starting the Master as a service¶
After the init script and the sysconfig
file are ready to configure and placed into the right location, the EtherCAT master can be inserted as a service. The init script can be used for manually starting and stopping the EtherCAT master. It has to be executed with one of the parameters start, stop, restart or status.
Start EtherCAT Master
# /etc/init.d/ethercat start
Stop EtherCAT Master
# /etc/init.d/ethercat stop
Restart EtherCAT Master
# /etc/init.d/ethercat restart
Status for EtherCAT Master
# /etc/init.d/ethercat status
Multi-Axis Synchronization System (MASS)¶

This system setup includes motion controller, servo driver, motors and software. The Motion Controller is intel-based system with ECI enabled. The Motion Controller connects 8x Servo Drivers. The System runs a program to control 6 servos motor simultaneously through EtherCAT, which are paired every two to control pencil leads to rotate and move horizontally and vertically.

Another two servos are controlled to simultaneously through EtherCAT to draw a circle.
Test binary will be released in /opt/ighethercat/examples/ec_multi_axis_example
EtherCAT Control Loop and Time Measurement¶

EtherCAT Sanity-Check testing¶
The following section is applicable to:

Sanity-Check #1: EtherCAT Master Start¶
Step 1: EtherCAT Master Start
# /etc/init.d/ethercat start

Step 2: Check Master information
# ethercat master
Expected output

Sanity-Check #2: EtherCAT Master Scan¶
The following section is applicable to:

Step 1: EtherCAT Master Start
# /etc/init.d/ethercat start
Step 2: Scan EtherCAT Slave
# ethercat rescan
Step 3: Check slaves on the bus
# ethercat slaves
Expected output

Sanity-Check #3: MASS platform performance collection¶
Step 1: Use EtherCAT network cable to interconnect the MASS platform and Controller in specify EtherCAT network interface, power up the MASS platform.
Step 2: EtherCAT Master Start
# /etc/init.d/ethercat start
Step 3: Check EtherCAT bus to confirm 8 ethercat slaves are scan and stay on PREOP status.
# ethercat slaves
Expected output

Step 4: Start /opt/ighethercat/examples/ec_multi_axis_example -r
to collect real-time performance
# /opt/ighethercat/examples/ec_multi_axis_example -r
Expected output

Tip
useful command parameters:
-r Motor start running -t Set measure time for minutes, default is no time limitation
EtherCAT Analysis with Wireshark¶
Hardware Setup¶
1. Using KUNBUS TAP CURIOUS¶
Overview

Refer to TAP CURIOUS Quick Start Guide
https://www.kunbus.com/files/media/bedienungsanleitungen/Quickstart-EN.pdf
And more details can be seen in
https://www.kunbus.com/files/media/bedienungsanleitungen/DO0280_EN.pdf
Application Example

Software Setup¶
Step 1: Start IgH ethercat master stack
Step 2: Start EtherCAT IO sample code
# /opt/ighethercat/examples/ec_ecatdio_example -t 100
Note: useful command parameters:
-t Set horse light cycle tick
Capture ethercat packages with wireshark¶
Step 1. All available Ethernet interfaces are listed in the main window. Click on the required Ethernet interface to select it.
Step 2. It is possible to use Wireshark to analyze the data.
– Note: if ECAT packets cannot be captured, please disable security software.
![]()
Step 3. I/O graph can be shown as below.
Jitter analysis by wireshark¶
Step 1. Find the timestamp in KUNBUS TAP and apply it as column.
Step 2. Filter the packages from master.
Step 3. Export the data as .csv format.
Step 4. Open the data file by Excel and find the timestamp column. Fetch the last 9 digits (in ns) and then calculate the delta time between two cycles.
Step 5. Plot the delta time graph and we can see the jitter +/-4us within 1ms per cycle
EtherCAT Enablekit¶
EtherCAT Enablekit Overview¶
Ecat EnableKit provides tools that simplify the process of customizing the configurations of EtherCAT master, slave, and network topology. It provides APIs to develop EtherCAT application programs easily. With Ecat EnableKit, developers can focus on what is truly important and leave the tedious configuration process to the system.
EtherCAT EnablekitFeatures¶
Based on this version, the following features are included:
Based on IgH EtherCAT Master Stack
Support Preempt-RT and Xenomai
Provide functions to parse EtherCAT Network Information (ENI)
Provide functions to parse EtherCAT Slave Information (ESI)
Provide APIs to develop EtherCAT application program easily
Provide example code to driver EtherCAT IO slaves
Provide example code to driver EtherCAT CoE slaves (SOE is not currently supported)
EtherCAT Enablekit Code Sample¶
EtherCAT Enablekit Requirements¶
The software can run on commodity PC or Server. Because the software is developed primarily in C language, it should be straightforward to port to other operating systems.
EtherCAT Enablekit Sanity-Check testing¶
The following section is applicable to:

Sanity-Check #1: ESI Parsing¶
Step 1: Navigate to the directory: /opt/ecat-enablekit
# cd /opt/ecat-enablekit
Step 2: Test the ESI file, e.g. esi_xxx.xml
, with option -s
# ./test-motion -s esi_xxx.xml
Expected output

Sanity-Check #2: ENI Parsing¶
Step 1: Navigate to the directory /opt/ecat-enablekit
# cd /opt/ecat-enablekit
Step 2: Test the ENI file, e.g. eni_xxx.xml
, with option -n
# ./test-motion -n eni_xxx.xml
Expected output
