Skip to main content

Hot-plug

Standard EtherCAT feature

Hot-plug is a standard EtherCAT capability. A slave dropping out does not interrupt the other slaves; once it answers again the master recovers it automatically, with no configuration in the application. Related documentation: Master events | Slave events

How it works​

When a slave goes offline, EtherCAT frames skip that slave's position and keep forwarding, and the remaining slaves keep communicating normally in OP. The PDO input data of the offline slave is cleared to zero. expected_wkc is fixed at configuration time and is not lowered when a slave drops; actual_wkc falls as the bus actually reports, which means a slave has dropped rather than that the master has failed. The PDO cycle keeps running.

Once the slave answers again, the master recovers it automatically: a module that is declared and passes the identity check is configured again and brought back to the running state, and healthy slaves are not disturbed.

Preconditions and limits of recovery:

  • Recovery runs only when the master's target state is OP. When the application commands the master to PreOp / SafeOp, recovery does not start, so an operator's command for a lower state is not pushed back; recovery continues once the command returns to OP.
  • No recovery takes place while the slave does not answer at all (physically disconnected or powered off); as soon as it answers again (plugged back in or powered up), the recovery procedure starts automatically.
  • Automatic promotion only covers chain-end insertion or re-insertion into the original empty slot. If a module is inserted mid-chain and shifts the station-address order of the modules behind it, the master does not rewrite the station addresses of other slots; it prompts you to rescan the bus.
  • Automatic promotion does not re-baseline after a removal: the expected topology and expected_wkc do not change; promotion is throttled (about once every 1 second), and a station already being promoted is not triggered again.
  • Only modules that are declared and pass the identity check are promoted automatically. Undeclared extra devices and modules with a mismatched identity are not promoted automatically; they are only reported as they are.
  • A failed recovery is reported as it is and retried; a failure is never reported as a success.

Behaviour:

  • Power-cycling and replacing a device with one of the same model also go through automatic recovery
  • In a line topology, disconnecting a slave in the middle makes every slave behind it unreachable (unless ring redundancy is in place)
  • Disconnecting a coupler (such as the EK1100) makes every slave downstream of its branch port unreachable

Detection and recovery time​

Detection latency​

A disconnected or offline slave is detected by cyclic communication, so the latency is counted in PDO cycles (the shorter the cycle, the sooner it is noticed; there is no product minimum cycle time).

Recovery time​

Recovery time depends on how fast the slave responds, the size of the slave's own configuration and whether the topology has to be rebuilt; it cannot be promised as a fixed number of milliseconds. Recovery runs in the background and does not block the other slaves while it proceeds.

Event notifications​

Events are raised when a slave goes offline and when it recovers:

// Master level
master.Events.SlaveOffline += (slaveIndex) =>
{
Console.WriteLine($"从站 {slaveIndex} 离线"); // Slave {slaveIndex} offline
};

master.Events.SlaveOnline += (slaveIndex) =>
{
Console.WriteLine($"从站 {slaveIndex} 恢复上线"); // Slave {slaveIndex} back online
};

// Slave level
slave.Events.Offline += () => { /* handle going offline */ };
slave.Events.Online += () => { /* handle recovery */ };

FAQ​

Does PDO communication suffer during hot-plug?​

Regular operation is not affected. The PDO cycles of the other slaves are not disturbed. Extreme full load can make the PDO cycle irregular.

Does a module plugged back in while running enter OP automatically?​

Yes, but with limits. The precondition is that the module is declared in the configuration, passes the identity check, and the master's current target state is still OP, and that the module is inserted at the chain end or plugged back into its original empty slot. Once the master detects that the module is answering again, it completes the configuration and the state transition automatically; the application does not have to write a state machine. If the module is inserted mid-chain and shifts the station-address order of the modules behind it, the master does not handle it automatically; it prompts you to rescan the bus.

After a power cycle, does the slave return to OP automatically?​

Yes. Once the slave is powered up again and answers, the master restores it to the running state automatically, under the same precondition: declared and identity check passed. The application can use the Offline / Online events for its own records, but recovery itself does not involve the application. The position also matters: the chain end or the original empty slot.

Is there a switch that turns automatic recovery off?​

The SDK exposes no public switch that disables automatic recovery of a single slave; recovery is the master's default behaviour. When the application switches the master's target state to PreOp / SafeOp, recovery does not start.

Does an undeclared device start running by itself when plugged in?​

No. A device that is not in the configuration is neither promoted automatically nor included in the control outputs by itself; the master only reports it as it is. To connect such a device, the application layer has to start the connection explicitly.

Optional modules and slots​

In the configuration (DENI), declare a slot for each module you might use, and mark the slots that may be absent as optional (<deni:Optional>): an absent optional slot is not an error and the other slaves enter OP as usual; if a slot declared as required is absent, this run cannot enter OP.

Once a module is plugged back in, it is configured according to the declaration and brought up to OP. Which slot a module on site maps to is decided by the master-level hot-plug binding mode: by default it matches by module identity, or it can match by wiring position and check the assembly order.