Running EtherCAT in Real-Time on Linux

A Practical Guide to EC-Master on Linux

Introduction

EtherCAT is one of the most demanding industrial fieldbus protocols in terms of timing requirements. Running a high-performance EtherCAT MainDevice (Master) stack on a general-purpose operating system like Linux presents real challenges — but with the right approach, Linux can deliver the deterministic behavior that industrial automation demands. This article walks through how to optimize a Linux system for EtherCAT communication using the acontis EC-Master stack, what Ethernet driver architectures are available, and what real-world performance numbers look like across a range of popular hardware platforms.

EC-Master on Linux

acontis EC-Master is a professional EtherCAT MainDevice protocol stack available as a software library and development kit. It supports a wide variety of operating systems and hardware platforms, and is widely deployed in industries such as robotics, machine building, automation, and medical technology. The stack communicates with EtherCAT SubDevices by sending and receiving EtherCAT frames via a standard Ethernet MAC controller, and supports advanced features like Distributed Clocks synchronization.

Designed to run entirely in Linux user space, EC-Master enables fast and convenient development while remaining GPL-compliant. To achieve extremely fast, high-speed update rates (short cycle times) that it is known for, the implementation must not use any blocking kernel functions (APIs) in the cyclic part. Combined with real-time user mode drivers, this architecture guarantees the highest possible deterministic real-time performance.

EC-Master EtherCAT MainDevice Software supports Linux on x86, x64, ARM, AArch64/ARM64, and RISC-V architectures. Due to its scalability and modular design, EC-Master can run on low-end systems ranging from a Cortex-M7 Microcontroller to high-end Intel® Core™ i7 CPUs.

Optimizing Linux System for EtherCAT

Step 1: Choose the Right Linux Kernel — PREEMPT_RT

The foundation of any real-time Linux system for EtherCAT is a kernel with real-time preemption support. After more than two decades of development, PREEMPT_RT was officially merged into the mainline Linux kernel in version 6.12 — meaning there is no longer any need to manually apply a patch and recompile the kernel.

Many board and chip manufacturers now ship ready-to-use RT kernels alongside their hardware, including:

This lowers the barrier significantly for embedded system developers who previously had to maintain custom kernel patches.

Step 2: Configure Linux for Real-Time Operation

Two key kernel boot parameters help eliminate unwanted latency introduced by power management:

  • cpuidle.off=1 — Disables CPU idle state management entirely, preventing the CPU from entering sleep states between tasks. This eliminates the wake-up latency that can cause jitter in cyclic real-time tasks.
  • cpufreq.off=1 — Disables dynamic CPU frequency scaling. The CPU runs at a fixed (typically maximum) frequency, removing the latency spikes associated with frequency transitions.

These parameters are essential for achieving consistent cycle times in EtherCAT applications.

Step 3: Isolate CPUs for Real-Time Tasks

On a multi-core system, you can reserve one or more CPU cores exclusively for real-time tasks such as the EtherCAT job task, preventing the Linux scheduler from placing general-purpose processes on those cores.

Isolate CPU for Real-time Tasks on Linux
The relevant kernel parameters are:

  • isolcpus=3 — Removes CPU 3 from the general-purpose scheduler's load balancing. The kernel will not place regular processes on this CPU unless explicitly instructed to do so.
  • irqaffinity=0-2 — Restricts hardware interrupt handling to CPUs 0–2. CPU 3 is left free of interrupt load, further improving its real-time responsiveness.

The result: CPU 3 runs only your EtherCAT task with minimal interference from the rest of the system.

Step 4: Choose the Right Ethernet Driver Architecture

This is where EC-Master on Linux truly differentiates itself. The stack supports four distinct architectures for controlling the Ethernet controller, each with different trade-offs between simplicity, performance, and hardware requirements.

Architecture 1: SOCK_RAW (Linux Network Stack)

The simplest approach. EC-Master communicates via the standard Linux network stack using raw sockets (SOCK_RAW). This is hardware-independent and works on virtually any Linux distribution out of the box — no kernel modifications needed.

Trade-off: Because it goes through the Linux network stack, CPU execution time and frame jitter are higher compared to lower-level approaches.

Architecture 2: acontis Real-Time Driver (atemsys)

The recommended approach for production real-time systems. The acontis driver runs entirely in user space and accesses the Ethernet MAC directly, bypassing the Linux network stack completely. This is made possible by a small GPL-licensed kernel module called atemsys, which grants the user-space driver direct hardware access.
The standard Linux Ethernet driver must be unbound from the adapter before using this architecture (via sysfs or the device tree on embedded platforms). The atemsys kernel module is open source and available at github.com/acontis/atemsys.

Trade-off: Requires licensing of the real-time driver and compilation of the atemsys kernel module. Delivers the best jitter and round-trip performance.

Architecture 3: AF_XDP (XDP Sockets)

A newer approach using the Linux eXpress Data Path (XDP) framework. EC-Master uses the AF_XDP socket interface, which provides better performance than SOCK_RAW while still relying on the standard Linux Ethernet driver.

Trade-off: XDP requires additional components (libxdp and libbpf), and the Linux Ethernet driver must also support XDP, which is not yet the case for many drivers. In addition, XDP requires careful configuration.

Architecture 4: DPDK (Data Plane Development Kit)

The acontis DPDK driver (emlldpdk) uses the Linux Foundation's Data Plane Development Kit for high-performance packet processing. DPDK provides its own hardware drivers (bypassing Linux Ethernet drivers entirely) for controllers including Intel Gigabit and NXP ENETFEC.

Trade-off: DPDK requires Ethernet controller-specific drivers that run in Linux user space. These drivers must be developed in parallel with the standard kernel-space drivers. So far, only a few manufacturers have released such drivers for a limited number of controllers.

Measuring the performance

EC-Master includes the EcMasterDemoSyncSm demo application, which provides built-in performance measurement of three critical metrics:

  • Cycle Time — accuracy of the EtherCAT job task triggered by CLOCK_MONOTONIC. Jitter here reflects the overall real-time capability of the OS configuration.
  • Task Duration — total CPU time spent on EC-Master jobs and the application.
  • Round-Trip Time (TX+RX) — the elapsed time from sending an EtherCAT frame to receiving the response. This is the sum of software execution time, DMA/NIC hardware latency, and OS scheduler overhead. The maximum round-trip time directly determines the minimum achievable EtherCAT cycle time for a given network configuration.

The sample application EcMasterDemoSyncSm includes a measurement function to determine the cycle time and round-trip time. The measurement can be enabled using the command-line parameter -perf and regularly prints this data:

0226810177: PerfMsmt 'Cycle Time                     ' (min/avg/max) [usec]:  977.3/1000.0/1023.8
0226810177: PerfMsmt 'Task Duration (JOB_Total + App)' (min/avg/max) [usec]:   71.4/  72.8/ 100.4
0226810177: PerfMsmt 'JOB_Total                      ' (min/avg/max) [usec]:    3.7/   4.6/  31.4
0226810177: PerfMsmt 'JOB_ProcessAllRxFrames Duration' (min/avg/max) [usec]:    0.1/   0.1/  20.5
0226810177: PerfMsmt 'JOB_SendAllCycFrames Duration  ' (min/avg/max) [usec]:    1.8/   2.1/  27.8
0226810177: PerfMsmt 'JOB_MasterTimer Duration       ' (min/avg/max) [usec]:    0.5/   0.8/  21.1
0226810177: PerfMsmt 'JOB_SendAcycFrames Duration    ' (min/avg/max) [usec]:    0.4/   0.7/  20.5
0226810177: PerfMsmt 'myAppWorkPd                    ' (min/avg/max) [usec]:    0.1/   0.4/  19.8
0226810177: PerfMsmt 'RoundTrip (TX+RX)              ' (min/avg/max) [usec]:   58.7/  68.3/  87.8

Real-World Performance Results

The following measurements were taken with 7 Beckhoff EtherCAT SubDevices, 512 bytes of process data, Distributed Clocks synchronization, and a 1000 µs target cycle time. All systems ran concurrent load (stress + iperf3) to simulate real production conditions.

Operating System (Cycle Time) Jitter measurements results

System

Linux Kernel

Linux Driver

acontis Driver

Avg [us]

Min [us]

Max [us]

Jitter [us]
after 24h

Intel PC i3-9100 with I210 6.18.0-rt3 #1 SMP PREEMPT_RT --- / atemsys emllIntelGbe 1000 978 1020 22
Nvidia Jetson Orin AGX 5.15.148-rt-tegra #1 SMP PREEMPT_RT --- / atemsys emllDW3504 1000 968.1 1034.8 34
Nvidia Jetson AGX Thor Dev. Kit 6.8.12-rt-tegra #1 SMP PREEMPT_RT --- / atemsys emllRtl8169 1000 987.9 1012.9 12.9
Qualcomm IQ-9075 Evaluation Kit 6.6.97-rt57-qli-1.6-ver.1.2.1-dirty #1 SMP PREEMPT_RT --- / atemsys emllDW3504 1000 865 1134 135
RevPi Connect 5 6.12.56 #1 SMP PREEMPT_RT --- / atemsys emllGem 1000 978.2 1024.9 24.9
Raspberry Pi Compute Module 5 6.12.34-v8-16k+ #4 SMP PREEMPT_RT --- / atemsys emllGem 1000 978 1017 22

Round-trip time measurements results

System

Driver
Architecture

Network
Interface

Linux Driver

acontis Driver

Avg [us]
af. 24h

Max [us]
af. 30min

Max [us]
after 6h

Max [us]
after 24h

Intel PC i3-9100 1 Intel i210 igb emllSockRaw 71.8 185.8 213.4 213.7
  2 Intel i210 ---/atemsys emllIntelGbe 68.3 83.3 85.5 89.7
  3 Intel i210 igb emllXdp 76.1 208.5 208.9 303.9
  4 Intel i210 igb emllDpdk 68.5 82.6 86.4 87.3
Nvidia Jetson Orin AGX 1 On-Chip DWC QOS nvethernet emllSockRaw 389.6 1363.0 1363.0 1690.3
  2 On-Chip DWC QOS ---/atemsys emllDW3504 105.2 165.7 165.7 165.7
  1 On-Chip DWC XGMAC mgbe emllSockRaw 692.8 2781.2 2781.2 2781.2
  2 On-Chip DWC XGMAC ---/atemsys emllDwXgmac 78.0 85.7 133.8 136.5
Nvidia Jetson AGX Thor Dev. Kit 1 Realtek 8126 enP2p1s0 emllSockRaw 110.4 713.6 791.1 833.9
  2 Realtek 8126 ---/atemsys emllRtl8169 65.6 75.6 80.1 84.6
  1 On-Chip DWC XGMAC mgbe emllSockRaw coming soon coming soon coming soon coming soon
  2 On-Chip DWC XGMAC ---/atemsys emllDwXgmac coming soon coming soon coming soon coming soon
Qualcomm IQ-9075 Evaluation Kit 1 On-Chip Synopsys IP dwmac_qcom_ethqos emllSockRaw 314.4 1203.8 2082 Frame Loss
  2 On-Chip Synopsys IP ---/atemsys emllDW3504 81.4 94.1 101.4 102.4
RevPi Connect 5 1 On-Chip Cadence MACB macb emllSockRaw 113.3 1815.3 2041.1 2041.1
  2 On-Chip Cadence MACB ---/atemsys emllGem 62.0 69.4 71.6 76.1
Raspberry Pi Compute Module 5 1 On-Chip Cadence MACB macb emllSockRaw 121.5 178.0 178.0 178.0
  2 On-Chip Cadence MACB ---/atemsys emllGem 62.3 70.7 70.7 74.8

Conclusion

Linux has matured into a viable real-time platform for EtherCAT MainDevice applications, especially with the mainlining of PREEMPT_RT in kernel 6.12. But achieving production-quality timing requires more than just an RT kernel — it requires careful system configuration and the right Ethernet driver architecture.

For engineers building industrial automation, robotics, or motion control systems on Linux, the acontis EC-Master combined with the atemsys-based real-time Ethernet driver provides a proven, high-performance path to deterministic EtherCAT communication on a wide range of hardware — from x86 industrial PCs to ARM-based embedded platforms.

Stay Up to Date