SimWB can act as an EtherCAT master using the low level driver and API provided by EtherLab®. That is, SimWB can be configured to act as a master to query EtherCAT remote I/O slave devices on the network.
The EtherCAT master runs on a standard Ethernet interface whose driver is provided by the Linux kernel.
Before running an EtherCAT master under SimWB, you must first install the package provided by EtherLab®.
N/A. Use system ethernet device.
N/A.
ICS-SWB-1250 : EtherCAT master license for 10 slaves.
ICS-SWB-1251 : EtherCAT master license for 10 additional slaves.
To install the EtherLab® package, use the following steps:
cd /usr/local/ccursim/etherlab
.install_ecatmaster.sh
script downloads the latest source code for the master, compiles and installs it. The script also dynamically builds a utility required by SimWB../install_ecatmaster.sh
.install_ecatmaster.sh
script and build the slavesdos
utility. /opt/etherlab/bin/ethercat slaves
0 3:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus) 1 3:1 PREOP + EL4001 1K. Ana. Ausgang 0-10V, 12bit 2 3:2 PREOP + EL2004 4K. Dig. Ausgang 24V, 0.5A 3 3:3 PREOP + EL2004 4K. Dig. Ausgang 24V, 0.5A 4 3:4 PREOP + EL2008 8K. Dig. Ausgang 24V, 0.5A 5 3:5 PREOP + EL4104 4Ch. Ana. Ausgang 0-10V, 16bit 6 3:6 PREOP + EL4102 2K. Ana. Ausgang 0-10V, 16bit 7 4:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus) 8 4:1 PREOP + EL3001 1K.Ana. Eingang +/-10V 9 4:2 PREOP + EL1004 4K. Dig. Eingang 24V, 3ms 10 4:3 PREOP + EL1014 4K. Dig. Eingang 24V, 10µs 11 4:4 PREOP + EL1018 8K. Dig. Eingang 24V, 10µs 12 4:5 PREOP + EL1859 8K. Dig. Eingang 24V, 3ms, 8K. Dig. Ausgang 24V, 0.5A 13 4:6 PREOP + EL1819 16K. Dig. Eingang 24V, 10µs 14 4:7 PREOP + EL3164 4K. Ana. Eingang 0-10V 15 4:8 PREOP + EL3162 2K. Ana. Eingang 0-10V
To optimize the EtherCAT bus performance, you can perform the following tuning. Append the /etc/rc.d/rc.local file with the commands that follow to invoke these optimizations every time the system reboots.
Note: The following instructions assume that eth1 is configured as the EtherCAT master.
Set RX/TX ring parameters to 0
Set coalesce options
Direct eth1-related IRQs to a shielded CPU. For example, CPU 2. To obtain a list of the relevant IRQs, type cat /proc/interrupts | grep eth1.
echo 4 >/proc/irq/125/smp_affinity
echo 4 >/proc/irq/126/smp_affinity
echo 4 >/proc/irq/127/smp_affinity
echo 4 >/proc/irq/128/smp_affinity
echo 4 >/proc/irq/129/smp_affinity
echo 4 >/proc/irq/130/smp_affinity
echo 4 >/proc/irq/131/smp_affinity
echo 4 >/proc/irq/132/smp_affinity
echo 4 >/proc/irq/133/smp_affinity
It is recommended that you dedicate an ethernet port for the EtherCAT bus to ensure real-time performance. Also, configure the Network Manager to not reset/auto-connect to this port.
Mapping the PDO (process data object) of EtherCAT slaves to RTDB items is a 3-step process.
Slave PDO list: |
|
Mailbox COE (CANOpen over EtherCAT): |
|
Mapping into Input & Output Domains: |
If you encounter unexpected behavior, the output of the following commands may help in debugging the issue:
Visit the EtherLab Master website to download the package.
Before you can build the EtherLab® EtherCAT modules, you must prepare the RedHawk kernel for module building with:
cd /lib/modules/`uname -r`/build (Notice the back ticks)
Once inside the kernel source folder, run:
./ccur-config -c -n (This must be run as root)
Download ethercat-1.5.2.tar.bz2 from the Download page into a folder of your choice.
cd into the download folder and extract the archive with:
tar xvjf ethercat-1.5.2.tar.bz2
cd ethercat-1.5.2
./configure --disable-8139too --disable-e100 --disable-e1000 --disable-e1000e --disable-r8169 --enable-hrtimer --disable-eoe --enable-sii-assign -with-devices=4
(Type configure --help for all the available configure options.)
Do not change the default installation location, because SimWB relies on the default installation to find the ethercat executable.
The options specified above ensure that the native EtherLab® ethernet drivers are not built by default. If you do not have the right combination of
kernel version and driver, configure will most likely fail when you try to build the native drivers.
The EtherLab® software always provides the 'generic' driver which uses the ethernet device via the driver provided by the kernel.
So the configure invocation above will make the 'generic' driver available.
After configure has completed successfully, build the package with:
make
make modules
and install it : (you must be root to install)
make modules_install install
depmod -ae
The package will be installed in /opt/etherlab.
The output of the command is similar to:
0 3:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus) 1 3:1 PREOP + EL4001 1K. Ana. Ausgang 0-10V, 12bit 2 3:2 PREOP + EL2004 4K. Dig. Ausgang 24V, 0.5A 3 3:3 PREOP + EL2004 4K. Dig. Ausgang 24V, 0.5A 4 3:4 PREOP + EL2008 8K. Dig. Ausgang 24V, 0.5A 5 3:5 PREOP + EL4104 4Ch. Ana. Ausgang 0-10V, 16bit 6 3:6 PREOP + EL4102 2K. Ana. Ausgang 0-10V, 16bit 7 4:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus) 8 4:1 PREOP + EL3001 1K.Ana. Eingang +/-10V 9 4:2 PREOP + EL1004 4K. Dig. Eingang 24V, 3ms 10 4:3 PREOP + EL1014 4K. Dig. Eingang 24V, 10µs 11 4:4 PREOP + EL1018 8K. Dig. Eingang 24V, 10µs 12 4:5 PREOP + EL1859 8K. Dig. Eingang 24V, 3ms, 8K. Dig. Ausgang 24V, 0.5A 13 4:6 PREOP + EL1819 16K. Dig. Eingang 24V, 10µs 14 4:7 PREOP + EL3164 4K. Ana. Eingang 0-10V 15 4:8 PREOP + EL3162 2K. Ana. Eingang 0-10V
Note: The libraries corresponding to the EtherLab® package are by default installed in the /opt/etherlab/lib directory, which is not in the default system path of dynamic libraries. You should make a link to the library with in the /usr/local/lib/ directory. cd /usr/local/lib/To update the dynamic linker run-time bindings, execute ldconfig. If the run-time linker is not updated, then you could run into the following error when you start the test:
ln -sf /opt/etherlab/lib/libethercat.so.1.0.0
ln -sf /opt/etherlab/lib/libethercat.so.1
ln -sf /opt/etherlab/lib/libethercat.so
elabecatm_in: error while loading shared libraries: libethercat.so.1: cannot open shared object file: No such file or directory