Overview
First, read this short article to get an overview over the Acontis EtherCAT stack. The software consists of the precompiled library, necessary kernel module, library and demo programs (source code) and has to be downloaded from the Acontis website. The necessary kernel module, can be found in a public Github repository.
The Acontis Stack (Class B) and the DCM Add On (Class A) can be placed anywhere. In this documentation the placeholders <classB_path> and <classA_path> are used.
<classB_path> Path to the Class B EtherCAT Stack (i.e. /home/username/acontisStack/EC-Master-V2.9-Linux_x64-Eval)
<classA_path> Path to the Class A AddOn (i.e. /home/username/acontisStack/EC-Master-ClassA-AddOn-V2.9)
LinkLayer Module
The EC LinkLayer module (kernel module) has to be compiled against the installed linux kernel. If the kernel changes, the module has to be rebuilt and reloaded.
The loaded standard Ethernet driver (the driver is a Linux kernel module has to be unloaded after boot.The EC LinkLayer has to be loaded after boot.
Build Module
ec-master_classb.pdf 2.3.5.1
Compile nativeClone Repository
| Codeblock |
|---|
|
git clone https://github.com/acontis/atemsys.git |
The readme in the GitHub repository describes how to build the kernel module. If neccessary, install kernel header files
| Codeblock |
|---|
|
sudo apt-get install linux-headers-$(uname -r) |
Compile native
| Codeblock |
|---|
|
cd cd <classB_path>/Sources/LinkOsLayer/Linux/atemsys
make modules
sudo make modules_install |
Cross-Compile
| Codeblock |
|---|
|
cd <classB_path>/Sources/LinkOsLayer/Linux/atemsys
export ARCH=<…>
export CROSS_COMPILE=<…>
cd Sources/atemsys
make modules KERNELDIR=<path to target kernel dir> |
Possible problems
The module may refuse to build and displays an error message like this:
| Codeblock |
|---|
|
error: unknown type name 'wait_queue_t' |
This is because the stack version is not compatible with the installed kernel.
The Acontis stack V2.9 is compatible with the linux kernel v4.4 but not mit kernel v4.14.
Unload standard Ethernet driver
Identify Network Card
Search for your Ethernet controller. For example: 00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I218-LM (rev04)
The number on the left is the Instance-ID. In this example 00:19.0
List all PCI devices in verbose mode:
Unbind standard driver
| Codeblock |
|---|
|
echo "<Instance-ID>" | sudo tee -a /sys/bus/pci/drivers/<driver-name>/unbind
echo "0000:00:19.0" | sudo tee -a /sys/bus/pci/drivers/e1000e/unbind |
Load LinkLayer module
| Codeblock |
|---|
|
sudo modprobe atemsys |
Automate unbind driver and load module
To automate unbinding the standard driver and loading the EC LinkLayer module you can add the following lines to the .bashrc file:
| Codeblock |
|---|
|
echo "<Instance-ID>" | sudo tee -a /sys/bus/pci/drivers/<driver-name>/unbind
modprobe atemsys |
Libraries
Copy the following library to your working folder (where you want to run your application).