EtherCAT Master Software on Linux
EtherCAT and Linux
Today, EtherCAT has become one of the most popular real-time Ethernet solutions in the world. The EtherCAT Technology Group (ETG) is responsible for keeping the EtherCAT technology open for all potential users. The ETG is the fieldbus organization with the largest number of members in the world. The list of members can be found on its homepage.
While on x86 PCs, the dominating operating system is still Microsoft© Windows©, the operating systems used in Embedded Systems are much more numerous and varied. Over the past several years as high end ARM-based microcontrollers have become more and more complex, this diversification has been significantly reduced, and today Real-time Linux is by far the most popular real-time operating system (RTOS) for such embedded MCUs. See also how the usage of operating system has changed for acontis' EtherCAT customers here.
Given the trends it is clear that running an EtherCAT Master on Linux has become essential in many applications, but using Linux presents some challenges that must be overcome. While considerations must be made for GPL (GNU General Public License) that come up when using the patented EtherCAT technology, performance is the still the key technical challenge.
acontis EC-Master EtherCAT master stack for Linux
The acontis EtherCAT Master stack software architecture has been approved by the OSADL (Open Source Automation Development Lab) as conforming to GPL rules given that all software runs in user mode and thus no patent conflicts arise. Furthermore, this architecture in conjunction with real-time user mode drivers guarantees the highest possible deterministic real-time performance.
The EtherCAT Master Software EC-Master supports the Linux architectures x86, x64, ARM, AArch64/ARM64 and PowerPC. Complemented by supporting many different CPUs and Ethernet Controllers, acontis offers out-of-the-box Linux EtherCAT solutions for many different controllers.
Due to it´s scalability and modular design EC-Master may run on low-end systems like a Cortex-M7 controller, as well as on high-end CPUs, like Intel® Core™-i7.
The master code is designed to run solely in the Linux User Space. This enables a fast and convenient development process and also conforms to the GNU General Public License (GPL). To achieve the extremely fast high update rates (short cycle times) that EtherCAT is known for the implementation doesn't require any blocking kernel functions (APIs) in the cyclic part.
Architecture 1: Linux Network Driver
The EC-Master stack communicates with the slave devices by sending and receiving EtherCAT frames using a standard Ethernet network adapter (MAC). The Linux operating system includes network drivers for the different adapters made by different manufacturers. These Linux network drivers can be used by an application like the EC-Master stack via an abstracted independent raw socket interface called SOCK_RAW
to send and receive frames, although the performance may be poor, and real-time constraints are typically not possible to be maintained because the Linux network stack inclusion and driver code is not optimized for high performance cyclical operations.
Due to the raw socket interface typically being available on every Linux distributions’ kernel, the pre-compiled demo application included with EC-Master (EcMasterDemo
) supports SOCK_RAW
and can therefore be used for evaluation of the EC-Master library‘s general functionality without compiling any files for the host system.
For certain slave devices, like those that implement and utilize Distributed Clocks, real-time constraints must be kept. In this case the raw socket option is most likely not able to send and receive frames fast enough and the EtherCAT devices will not operate correctly. Therefore, SOCK_RAW
should only be used for initial evaluation purposes and be replaced with the acontis real-time driver as explained below.
Architecture 2: acontis Real-time Driver
The acontis Real-time Driver replaces the standard Linux Ethernet network adapter (MAC) driver for real-time EtherCAT usage. The driver runs in User Space and handles the MAC directly for high performance cyclic operation. The driver requires direct access to the MAC that is made possible by Kernel Module called atemsys
which is available under GPL. The atemsys
Kernel module must be compiled to match the running Kernel. To compile the Kernel module you can refer to the available methods found in the Linux Distribution‘s documentation, and additionally acontis includes a build recipe for Yocto Linux.
The Real-time Driver is not available under GPL and must be licensed from acontis. It needs the atemsys
kernel module loaded on the Linux target to be able to run. Once this is in place the driver is granted access to the MAC hardware and the driver is able to operate very quickly on sending and receiving frames because it completely bypasses the Linux network stack. Note that it is not possible to use the standard Linux network adapter driver at the same time on the same interface as the acontis Real-time Driver. It is necessary to unbind the network adapter instance by removing the driver from the system and unbinding the instance using the virtual sys-fs
, or by modifying the Linux Device Tree if using an embedded system.
The atemsys
is shipped with EC-Master and is updated when EC-Master is updated.
Architecture 3: acontis Real-time Driver with Linux Device Support
The Linux operating system provides drivers for most common Ethernet controllers and the related physical transceivers (PHY). The manufacturer specific PHY circuit is handled by an dedicated kernel driver.
To make use of this infrastructure, the acontis kernel module atemsys has to be included in the Linux device tree as an official driver for the Ethernet controller. As a result atemsys can interact with Linux drivers.
Depending on the hardware architecture, atemsys can grants access to the MDIO bus to the Linux drivers, or request MDIO operations by Linux drivers.
The PHY “OS Driver” functionality is configured exclusively through the Linux device tree and doesn’t required any additional configuration at the application level.
Real-time Ethernet Drivers (Link Layers)
- Linux network driver (emllSockRaw): x86, x64, ARM, AArch64, PPC
- Intel Pro/100 (emllI8255x): x86
- Intel Pro/1000 (emllI8254x): x86, x64, ARM, AArch64
- Intel Cyclone V (emllDW3504): ARM
- Realtek 100MBit (emllRTL8139): x86
- Realtek Gigabit (emllRTL8169): x86, x64, ARM, AArch64
- Texas Instruments AM33xx, AM43xx, AM57xx (emllCPSW): ARM
- Texas Instruments AM33xx, AM57xx (emllICSS): ARM
- NXP TSEC/eTSEC controller, LS1021A (emllETSEC): ARM, PPC
- NXP i.MX6, i.MX7, i.MX8 (emllFslFec): ARM
- Renesas RZ/G1E (emllSHEth): ARM
- Xilinx Zynq-7000 , UltraScale (emllGEM): ARM, AArch64
- Beckhoff CCAT (emllCCAT): x86, x64, ARM
- Nvidia, Jetson TX2 (emllI8254x): AArch64
- STMicroelectronics STM32MP1 (emllDW3504): ARM
Kernel versions and distributions
The EC-Master can be used with any recent Linux distribution supporting custom Kernel module compilation like Ubuntu, Debian, etc. The Kernel Module atemsys handles legacy Kernel versions down to 2.6.18. Especially drives typically need real-time support which must be supported by the hardware and Kernel (CONFIG_PREEMPT_RT or Xenomai).
More Information
- EtherCAT Master Main Page
- Features Overview
- Linux Kernel Module atemsys
- EC-Master vs Open Source
- Data sheets and evaluation versions are available in the download area.