[etherlab-dev] [etherlab-users] Lost slaves after device restart

Stefan Agner stefan.agner at yahoo.com
Tue May 10 19:38:32 CEST 2011


I found my Problem: I requested a master while Ethernet was not connected by 
using ecrt_request_master(0). I immediately call ecrt_master_deactivate (this 
didn't helped because the functions exits very early because the master was not 
activated) and ecrt_release_master.

The Function ec_master_enter_operation_phase sets "allow_scan" to 0. As I said, 
the master gets never activated, it just leaves its state by using 
ec_master_leave_operation_phase. But allow_scan don't get resetted then, the 
master never ever rescans the bus...!

I solved the problem by adding two lines (master->allow_scan = 
1/master->allow_config = 1) to the function ec_master_clear_config, which gets 
always called:

void ec_master_clear_config(
        ec_master_t *master /**< EtherCAT master. */

    master->allow_scan = 1;
    master->allow_config = 1;


Maybe somebody should review this before adding to the repository... It solved 
my problem.


----- Original Message ----
From: Stefan Agner <stefan.agner at yahoo.com>
To: etherlab-users at etherlab.org
Sent: Tue, May 10, 2011 1:48:43 PM
Subject: [etherlab-users] Lost slaves after device restart


I use 1.5 trunk version of the Etherlab EtherCAT master on a Debian Lenny Linux 
5.0. I use the generic network driver (using default a device driven by a 
default e1000e driver) and PREEMPT_RT. 

Normally all works fine: I start Linux, Etherlab EtherCAT Master, and check the 
list of slaves:
# ethercat slaves
0  0:0  OP  +  EK1101 EtherCAT-Koppler (2A E-Bus, ID-Switch)
1  0:1  OP  +  EL6692 EtherCAT Bridge-Klemme (Primär)

I now start my application, which requests the master. The application runs 

When I shut down the EtherCAT device, slaves disappears as expcted:
# ifconfigeth0 down
# ethercat slaves

Next I activate the device again, but slaves don't show up...
# ifconfigeth0 up
# ethercat slaves

When I stop my application (release the master) the slaves still don't appear. 
Even rescan doesn't help, it looks like user space missed this new state (device 


In dmesg everything looks ok:
[16091.763659] EtherCAT WARNING 0: 3 datagrams TIMED OUT!
[16091.783764] EtherCAT 0: Link state changed to DOWN.
[16091.787793] EtherCAT 0: 0 slave(s) responding.

[16105.749575] e1000e 0000:02:00.0: irq 28 for MSI/MSI-X
[16105.805136] e1000e 0000:02:00.0: irq 28 for MSI/MSI-X
[16105.806045] ADDRCONF(NETDEV_UP): ethercat0: link is not ready
[16107.390075] e1000e: ethercat0 NIC Link is Up 100 Mbps Full Duplex, Flow 
Control: None
[16107.390082] 0000:02:00.0: ethercat0: 10/100 speed: disabling TSO
[16107.390521] ADDRCONF(NETDEV_CHANGE): ethercat0: link becomes ready
[16107.390966] EtherCAT 0: Link state changed to UP.
[16107.395015] EtherCAT 0: 2 slave(s) responding.
[16107.395022] EtherCAT 0: Slave states: PREOP.

How can I make sure state and the slaves are tracked correctly in user space?

Thanks for any hints

etherlab-users mailing list
etherlab-users at etherlab.org

More information about the Etherlab-dev mailing list