Hi,

I recently upgraded ethercat master to Gavin Patchset 20160804, adding to that, 
patch 0061.


EoE seems to be working fine while the master is idle, with heavy SDO traffic 
in parallel.


When the master is active our realtime application invokes  
ecrt_master_receive(master);  and  ecrt_master_send(master);  from interrupt 
context, and NOT from

ec_master_operation_thread() thread context.


The problem comes up when the master is active.


Just as I issue


ifconfig eoe0a1 up


I get a bunch of UNMATCHED DATAGRAMS in the kernel log, and the master is 
released.


[   73.324525] EtherCAT DEBUG 0: UNMATCHED datagram:
[   73.324528] EtherCAT DEBUG: 0D 83 01 00 10 09 08 80 00 00 68 5A 4A 84 9C 9B
[   73.324539] EtherCAT DEBUG: 84 11 01 00
[   73.324544] EtherCAT DEBUG 0: UNMATCHED datagram:
[   73.324547] EtherCAT DEBUG: 04 84 01 00 90 09 08 80 00 00 B0 3D 4C 84 9C 9B
[   73.324557] EtherCAT DEBUG: 84 11 01 00
[   73.324562] EtherCAT DEBUG 0: UNMATCHED datagram:
[   73.324565] EtherCAT DEBUG: 0C 85 00 00 00 00 10 80 00 00 00 00 70 FF FF FF
[   73.324575] EtherCAT DEBUG: 50 52 70 FF FF FF 00 00 31 00 03 00
[   73.324584] EtherCAT DEBUG 0: UNMATCHED datagram:
[   73.324587] EtherCAT DEBUG: 07 86 01 00 30 01 02 00 00 00 08 00 01 00
[   73.324838] EtherCAT 0: fsm->slaves_responding[fsm->dev_idx]=1
[   73.324843] EtherCAT 0: 0 slave(s) responding on main device.
[   73.324846] EtherCAT 0: datagram->working_counter=0     
<-------------------------  In wireshark capture WC is 1 !!!!
[   73.324850] EtherCAT 0: datagram->state=4
[   73.324853] EtherCAT 0: datagram->device_index=0
[   73.324856] EtherCAT 0: datagram->device_origin=0
[   73.324860] EtherCAT 0: datagram->index=134
[   73.324863] EtherCAT 0: datagram->type=7
[   73.324866] EtherCAT DEBUG 0: Rescanning the bus



This happens due to a timeout. When the EoE thread invokes


master->receive_cb(master->cb_data); which leads to invoke of 
ecrt_master_receive(master); it somehow messes up


master->devices[EC_DEVICE_MAIN].cycles_poll


which leads to a negative time delta in the calculation 
master->devices[EC_DEVICE_MAIN].cycles_poll - datagram->cycles_sent.


Attempting to bypass that in the EoE thread, I commented out  
master->receive_cb(master->cb_data);  and  master->send_cb(master->cb_data);

and once I invoke

ifconfig eoe0a1 up


I get an explosion of


[  123.529911] EtherCAT WARNING 0-main-0: Failed to receive mbox check datagram 
for eoe0a1.
[  123.529918] EtherCAT WARNING 0-main-0: Failed to receive mbox check datagram 
for eoe0a1.
[  123.529925] EtherCAT WARNING 0-main-0: Failed to receive mbox check datagram 
for eoe0a1.
[  123.529932] EtherCAT WARNING 0-main-0: Failed to receive mbox check datagram 
for eoe0a1.



If I comment out only master->receive_cb(master->cb_data);


I get no errors in dmesg, but then of course, EoE is not functional, and EoE 
thread starts gathering more and more CPU usage.


I understand that an invoke of master->send_cb(master->cb_data); leads to

ec_master_internal_send_cb     -->     ecrt_master_send_ext(master);


which pulls datagrams from master->ext_datagram_queue and pushes them forward 
with ec_master_queue_datagram(), and then

invokes ecrt_master_send(master); which will lead to a collision with 
ecrt_master_send() in the interrupt context.


So instead of invoking master->send_cb(master->cb_data); i tried only to pass 
datagrams from master->ext_datagram_queue,

but it caused a kernel panic.



So, if I want EoE to work when the master is active, how should I pass 
datagrams from EoE thread to the master?

Should I change the ethernet.c state machine?


Thanks a lot,


Nir.

_______________________________________________
etherlab-dev mailing list
etherlab-dev@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-dev

Reply via email to