ethercat
Note: Using the EtherCAT protocol requires system version V4.0.4 or higher.
Native Driver vs. Generic Driver
Version Notes
RDK S100 V4.0.7 and above use the Native (hobot) EtherCAT driver by default, not the Generic driver.
Note: The EtherCAT usage methods described in subsequent sections of this document ("Network Configuration Before Use", "EtherCAT Usage Guide", etc.) are based on the Generic driver mode. If you are using the V4.0.7 default image, the system is pre-configured for Native driver mode. Please refer to the Native driver usage instructions in this section first.
RDK S600 V5.1.0 and above use the Native (hobot) EtherCAT driver by default, not the Generic driver.
Note: The EtherCAT usage methods described in subsequent sections of this document ("Network Configuration Before Use", "EtherCAT Usage Guide", etc.) are based on the Generic driver mode. If you are using the V5.1.0 default image, the system is pre-configured for Native driver mode. Please refer to the Native driver usage instructions in this section first.
Differences Between Native Driver and Generic Driver
| Feature | Native Driver (ec_hobot) | Generic Driver (ec_generic) |
|---|---|---|
| Driver Module | ec_hobot | ec_generic |
| Network Performance | Better (direct hardware operation, bypasses Linux network stack) | Standard Linux network stack |
| Compatibility with gmac driver | Mutually exclusive, requires unloading hobot_eth_super | Compatible, can coexist |
| Network Port Configuration | Must use MAC address | Supports interface name or MAC address |
| Visibility of Network Port in System | After being taken over by Native driver, the port with corresponding MAC disappears from ip a | Port always visible |
Native Driver Usage Steps
Network Port MAC Address Reference
The following are four example Ethernet port MAC addresses for S100/S600:
| Port | MAC Address |
|---|---|
| eth0 | xx:xx:xx:xx:01:18 |
| eth1 | xx:xx:xx:xx:01:19 |
| eth2 | xx:xx:xx:xx:01:1a |
| eth3 | xx:xx:xx:xx:01:1b |
Actual MAC addresses may vary slightly depending on the hardware version. Please refer to the output of the ip link show command on your device.
Native Driver Configuration Steps
Step 1: Verify the configuration file
In the default image, /etc/ethercat.conf is pre-configured for Native mode. To switch the EtherCAT network port, modify MASTER0_DEVICE to the MAC address of the corresponding port:
MASTER0_DEVICE="xx:xx:xx:xx:01:18" # MAC address of eth0
DEVICE_MODULES="hobot"
To use eth1 as the EtherCAT port:
MASTER0_DEVICE="xx:xx:xx:xx:01:19" # MAC address of eth1
DEVICE_MODULES="hobot"
Step 2: Configure systemd drop-in (required)
Since the Native driver and the gmac driver are mutually exclusive, you need to configure a systemd drop-in to automatically handle driver unloading and reloading. Execute the following commands on the device to:
- Automatically unload
hobot_eth_superbefore starting EtherCAT - Automatically reload
hobot_eth_superafter stopping EtherCAT to restore network functionality
sudo mkdir -p /etc/systemd/system/ethercat.service.d
sudo tee /etc/systemd/system/ethercat.service.d/prestart.conf << 'EOF'
[Service]
ExecStartPre=-/sbin/rmmod hobot_eth_super
ExecStopPost=-/sbin/modprobe hobot_eth_super
EOF
sudo systemctl daemon-reload
ExecStartPre=-:Automatically unloadshobot_eth_superbefore starting (the prefix-means execution continues even if this command fails)ExecStopPost=-:Automatically reloadshobot_eth_superafter stopping to restore normal network functionality
SSH Connection Note: If you are connected to the development board via SSH, when you execute systemctl start ethercat or systemctl stop ethercat, the network will experience a brief interruption of a few seconds (ping will show Destination Host Unreachable) due to the unloading/reloading of the gmac driver. The SSH client will typically reconnect automatically. This is normal and does not require manual intervention.
Step 3: Start EtherCAT
sudo systemctl start ethercat
sudo systemctl status ethercat
Example of normal output:
● ethercat.service - EtherCAT Master Kernel Modules
Loaded: loaded (/usr/lib/systemd/system/ethercat.service; disabled; preset: enabled)
Drop-In: /etc/systemd/system/ethercat.service.d
└─prestart.conf
Active: active (exited) since Thu 2026-03-26 20:48:36 CST; 4s ago
Process: 6476 ExecStartPre=/sbin/rmmod hobot_eth_super (code=exited, status=0/SUCCESS)
Process: 6504 ExecStart=/sbin/ethercatctl start (code=exited, status=0/SUCCESS)
Main PID: 6504 (code=exited, status=0/SUCCESS)
Step 4: Verification
After starting, check ip a. You will see that the MAC address of the network port bound to EtherCAT has disappeared from the kernel protocol stack (no longer appears in the list):
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> ...
6: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> ...
7: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> ... # MAC is for an unbound port
8: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> ... # MAC is for an unbound port
9: eth2: <NO-CARRIER,BROADCAST,MULTICAST,UP> ... # MAC is for an unbound port
# Note: eth0 with MAC xx:xx:xx:xx:01:18 is no longer in the list (taken over by Native driver)
Check EtherCAT master status:
$ sudo ethercat master
Master0
Phase: Idle
Active: no
Slaves: 1
Ethernet devices:
Main: xx:xx:xx:xx:01:18 (attached)
Link: UP
...
$ sudo ethercat slaves
0 0:0 PREOP + SSC-Device
Step 5: Stop EtherCAT (switch back to normal network mode)
After stopping the EtherCAT service, ExecStopPost will automatically load hobot_eth_super, and all network ports will revert to normal network mode:
sudo systemctl stop ethercat
Switching the Network Port Used by the Native Driver
To switch the network port used by EtherCAT, simply modify MASTER0_DEVICE in /etc/ethercat.conf to the MAC address of the corresponding port, then restart the EtherCAT service:
-
Modify the configuration (e.g., switch from eth0 to eth1):
MASTER0_DEVICE="xx:xx:xx:xx:01:19" # Change to MAC of eth1
DEVICE_MODULES="hobot" -
Restart the service:
sudo systemctl restart ethercat -
Verify that the new port is active:
sudo ethercat master
# Should display the new MAC address: Main: xx:xx:xx:xx:01:19 (attached)
Risks and Impacts of the Native Driver
Important: Because the Native driver and the gmac driver are mutually exclusive, it is strongly recommended to use systemctl to manage the EtherCAT service (with the systemd drop-in to automatically handle driver unloading/reloading). Do not use the ethercatctl command directly. Using ethercatctl start directly requires manually unloading hobot_eth_super with rmmod, and improper operation (e.g., forgetting to unload the gmac driver) will cause EtherCAT to fail to start. Furthermore, in remote SSH connection scenarios, manual operation could lead to network loss that cannot be recovered.
1. Conflict with gmac driver
The Native driver ec_hobot is mutually exclusive with the system's hobot_eth_super (xgmac) driver; the two cannot be loaded simultaneously. hobot_eth_super must be unloaded before starting EtherCAT, otherwise the EtherCAT service will not start correctly.
Impact: After unloading hobot_eth_super, the network port bound to the EtherCAT master is taken over by the Native driver. The remaining Ethernet ports can still be used normally (they can be configured with IPs, used for SSH connections, etc.). However, at the moment of rmmod/modprobe hobot_eth_super, all Ethernet ports will briefly interrupt for a few seconds and then automatically recover. The SSH connection will typically reconnect automatically.
Recovery Method: After stopping EtherCAT, ExecStopPost will automatically reload hobot_eth_super, and all Ethernet ports will return to normal network functionality.
2. Network port is exclusive to the Native driver
When the Native driver starts, the network port corresponding to the MAC address bound to MASTER0_DEVICE in the configuration file will disappear from the Linux kernel protocol stack (it will no longer be shown in ip a) and will be exclusively used by EtherCAT. The other, unbound ports will remain visible and usable.
3. MAC address configuration requirement
In Native driver mode, MASTER0_DEVICE in /etc/ethercat.conf must be configured with the actual MAC address of the corresponding network port (e.g., "xx:xx:xx:xx:01:18"). The broadcast address ff:ff:ff:ff:ff:ff or an interface name (e.g., "eth0") cannot be used, as the driver will not be able to bind correctly.
Notes on deb Package Upgrades
When upgrading EtherCAT-related deb packages, versions must be consistent. Upgrade the following two packages synchronously:
# Both packages must be upgraded synchronously, and version numbers must match
dpkg -i hobot-ethercat_5.1.0-20260525160326_arm64.deb
dpkg -i linux-image-rdk-s600_6.1.158-rt58-DR-5.1.0-2605251554-g369e4b-gf8e87c-29_arm64.deb
If you upgrade only hobot-ethercat without upgrading linux-image, the kernel module version mismatch may prevent the driver from loading.
Switching to Generic Driver Mode
If you need to use Generic driver mode (supports multiple ports eth0/eth1, can coexist with gmac driver, can stop the service normally), modify /etc/ethercat.conf:
# Switch to Generic driver configuration
sudo sed -i 's/DEVICE_MODULES="hobot"/DEVICE_MODULES="generic"/' /etc/ethercat.conf
sudo sed -i 's/MASTER0_DEVICE=".*"/MASTER0_DEVICE="eth0"/' /etc/ethercat.conf
After modification, restart the device or the EtherCAT service. For detailed usage in Generic mode, please refer to the subsequent sections (starting with "Network Configuration Before Use").
Network Configuration Before Use
Note: The following content applies to Generic driver mode. If you are using the V4.0.7 default Native driver mode, please refer to the "Native Driver Usage Steps" section above.
The EtherCAT protocol is mutually exclusive with the Ethernet protocol and cannot coexist. The development board uses eth0 as the DHCP management interface by default. If you want to use eth0 as the EtherCAT network interface, you can use one of the following network configuration schemes. Click here to see using eth0 as the EtherCAT master.
Special note: The RDK S100 uses eth0 as the DHCP port by default. If you originally used eth0 as the primary mode for SSH connection to the development board, after using eth0 as the EtherCAT master, you need to configure eth1 for DHCP, or configure a fixed IP usable on your local network for SSH connection, and move the connected network cable to the eth1 port. Click here to see the eth1 network configuration scheme when using eth0 as the master.
Note: The following content applies to Generic driver mode. If you are using the V5.1.0 default Native driver mode, please refer to the "Native Driver Usage Steps" section above.
The EtherCAT protocol is mutually exclusive with the Ethernet protocol and cannot coexist. The development board uses eth0 as the DHCP management interface by default. If you want to use eth0 as the EtherCAT network interface, you can use one of the following network configuration schemes. Click here to see using eth0 as the EtherCAT master.
Special note: The RDK S600 uses eth0 as the DHCP port by default. If you originally used eth0 as the primary mode for SSH connection to the development board, after using eth0 as the EtherCAT master, you need to configure eth1 for DHCP, or configure a fixed IP usable on your local network for SSH connection, and move the connected network cable to the eth1 port. Click here to see the eth1 network configuration scheme when using eth0 as the master.
EtherCAT Usage Guide
This section applies to Generic driver mode. If you are using Native driver mode, please refer to the "Native Driver Usage Steps" section above.
- Ensure hardware connection:
- The slave is powered on.
- The network cable is connected to the master port you selected (
eth0oreth1).
- Select the master port (before selecting the master port, please carefully read the notes in Network Configuration Before Use):
- Using
eth0as master: See Using eth0 as the EtherCAT master. - Using
eth1as master: See Using eth1 as the EtherCAT master.
- Using
- Start the EtherCAT master (using ethercatctl):
sudo ethercatctl start
- If using IgH 1.5.x (default firmware version for S100) and NetworkManager is configured not to manage the master port, you need to manually bring up the port before use:
- If using IgH 1.5.x (default firmware version for S600) and NetworkManager is configured not to manage the master port, you need to manually bring up the port before use:
sudo ip link set dev eth0 up
# If the master port is eth1, replace with eth1
- Check the master using user-space commands:
sudo ethercat master
# Sample output:
sunrise@ubuntu:~$ sudo ethercat master
Master0
Phase: Idle
Active: no
Slaves: 0
Ethernet devices:
Main: c8:30:76:63:2d:93 (attached)
Link: UP
Tx frames: 9477
Tx bytes: 568620
Rx frames: 0
Rx bytes: 0
Tx errors: 0
Tx frame rate [1/s]: 124 125 89
Tx rate [KByte/s]: 7.3 7.3 5.2
Rx frame rate [1/s]: 0 0 0
Rx rate [KByte/s]: 0.0 0.0 0.0
Common:
Tx frames: 9477
Tx bytes: 568620
Rx frames: 0
Rx bytes: 0
Lost frames: 9477
Tx frame rate [1/s]: 124 125 89
Tx rate [KByte/s]: 7.3 7.3 5.2
Rx frame rate [1/s]: 0 0 0
Rx rate [KByte/s]: 0.0 0.0 0.0
Loss rate [1/s]: 124 125 89
Frame loss [%]: 100.0 100.0 100.0
Distributed clocks:
Reference clock: None
DC reference time: 0
Application time: 0 - Configure IgH service to start automatically:
sudo systemctl enable ethercat
EtherCAT Development Guide
Software Stack
The D-Robotics RDK S100 provides the EtherCAT-IgH 1.5 software stack by default (this section uses S100 as an example; the same applies to S600). The EtherCAT-IgH software stack is currently the mainstream open-source EtherCAT master protocol.
EtherCAT official website: EtherLab | EtherCAT EtherCAT open-source code repository: Gitlab | EtherLab - EtherCAT