EtherCAT: All you need to know
Summary
Github
https://github.austin.utexas.edu/rh43278/EcApp
Setup
Install atemsys kernel module:
git clone https://github.com/acontis/atemsys.git
sudo apt-get install linux-headers-$(uname -r)
cd atemsys
make CC=x86_64-linux-gnu-gcc-13 modules
sudo mkdir -p /lib/modules/$(uname -r)/extra
sudo cp atemsys.ko /lib/modules/$(uname -r)/extra/
sudo depmod
sudo vim /etc/modules-load.d/atemsys.conf
add this line "atemsys"Make the intelGBE library available to application:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/EcApp/bin/
sudo chmod +x bin/libemllIntelGbe.so
sudo cp bin/libemllIntelGbe.so /usr/lib/
sudo ldconfigUnbind the active eth driver if needed:
If you get the error: ioctl ATEMSYS_IOCTL_PCI_CONF_DEVICE failed: Device or resource busy confirms that the Linux kernel is still managing the NIC (Network Interface Controller) at PCI address 0000:00:1f.6 with its default driver (likely e1000e). Your PCI address may be different.
Identify the active driver:
$ lspci -k -s 00:1f.6
0000:00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (17) I219-LM (rev 11)
Subsystem: Dell Ethernet Connection (17) I219-LM
Kernel driver in use: e1000e
Kernel modules: e1000eUnbind the NIC from the Linux Driver
$ echo "0000:00:1f.6" | sudo tee /sys/bus/pci/drivers/e1000e/unbindBind the NIC to atemsys kernel object
echo "0000:00:1f.6" | sudo tee /sys/bus/pci/drivers/atemsys_pci/bindBuild and Run
cd EcApp/
make
sudo ./ecAppThread Table
Thread Name | Function | Real-Time? | CPU Core | Priority |
Main | State Management | No (Standard) | 21 | 39 |
TimingTask | Cyclic Trigger | Yes | 21 | 99 |
doCycle | EtherCAT I/O | Yes | 21 | 98 |
Logging | Message Writing | No (Low Prio) | 0 | 29 |
Link Layer | NIC Polling | Yes | 21 | N/A |
Action Items
Write a udev rule or bootup script to load atemsys.ko and bind to eth interface, @Reed Hamilton
Use ECEngineer to generate an eni.xml for the expected EtherCAT network, @Reed Hamilton
Integrate shared memory writes into myAppWorkpd() function, @Reed Hamilton
Move github repo to appropriate location, @Reed Hamilton
Test EtherCAT application on networked test environment, @Reed Hamilton
Create a clean build process for EcApp builds, version control them, deploy them etc. @Reed Hamilton