High CPU Usage During EtherCAT Device Reconnection in LabVIEW

Updated Aug 28, 2026

Reported In

Hardware

  • PXI EtherCAT Interface Module

Software

  • LabVIEW

Issue Details

I have a LabVIEW EtherCAT application running on a Real-Time target. When an EtherCAT device encounters an error or becomes disconnected, CPU usage increases significantly and may reach very high levels. The issue occurs repeatedly during device reconnection scenarios. I observe the application consuming excessive processor resources while attempting to recover communication with EtherCAT slave devices.

Solution

A common cause of this behavior is repeatedly calling Open Slave.vi inside a fast retry loop during EtherCAT error recovery. Open Slave.vi is a heavy-weight initialization function that allocates resources and performs EtherCAT slave discovery. Executing it continuously can create a processor-intensive loop that drives CPU utilization to very high levels.
 
To prevent excessive CPU usage:
  1. Open EtherCAT slave references once during application startup.
  2. Keep EtherCAT slave references open throughout application execution.
  3. Close EtherCAT slave references only when the application stops.
  4. Avoid using Open Slave.vi as a continuous polling mechanism to detect slave reconnection.
  5. Monitor EtherCAT slave availability by using lightweight state-monitoring functions such as:
    • GetSlaveStates on the EtherCAT Master reference.
    • GetState on the EtherCAT Slave reference.
  6. Compare previous and current slave states to identify disconnected or unhealthy devices before performing recovery actions.
  7. Implement recovery logic only when a state transition indicates that intervention is required.
  8. Introduce a significant delay or backoff mechanism between reconnection attempts if re-executing Open Slave.vi is required. For example, wait approximately 1 minute between attempts to reduce processor load.
Following this architecture helps maintain low CPU utilization while providing robust EtherCAT device recovery behavior.