[etherlab-users] DC drift issue
Romain Virot
virot at lpsc.in2p3.fr
Wed Jan 8 13:54:38 CET 2020
Hi,
After lurking on the list and trying many different things, I'm looking for some help.
I have issues with DC syncing in my setup. I'm using a Beckhoff CX5140, 4.4.112-rt127-lp151-rt kernel with all the patches from Gavin and 64-bit DC modules (so far one EL7041 and one ELM3004-0000 both from Beckhoff) at 1kHz (I've also tested 200Hz and 400 Hz with similar behavior).
I can successfully enter my cyclic loop, with the system being synchronized, but after some time (typ. few hundred seconds) the dmesg indicates many unmatched datagrams :
....
[14364.891659] EtherCAT WARNING: Datagram ffff88003f81d6d8 (domain0-0-main) was SKIPPED 1004 times.
[14365.712234] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14365.897276] EtherCAT WARNING: Datagram ffff88003f81d6d8 (domain0-0-main) was SKIPPED 1004 times.
[14366.713842] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14366.902893] EtherCAT WARNING: Datagram ffff88003f81d6d8 (domain0-0-main) was SKIPPED 1004 times.
[14367.715453] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14367.908512] EtherCAT WARNING: Datagram ffff88003f81d6d8 (domain0-0-main) was SKIPPED 1004 times.
[14368.717066] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14368.914130] EtherCAT WARNING: Datagram ffff88003f81d6d8 (domain0-0-main) was SKIPPED 1003 times.
[14369.718690] EtherCAT WARNING 0: 2 datagrams TIMED OUT!
[14369.718700] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14369.919746] EtherCAT WARNING: Datagram ffff88003f81d6d8 (domain0-0-main) was SKIPPED 1004 times.
[14370.720285] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14370.925364] EtherCAT WARNING: Datagram ffff88003f81d6d8 (domain0-0-main) was SKIPPED 1004 times.
[14371.721901] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14371.930982] EtherCAT WARNING: Datagram ffff88003f81d6d8 (domain0-0-main) was SKIPPED 1004 times.
[14372.723535] EtherCAT WARNING 0: 2000 datagrams UNMATCHED!
[14372.936607] EtherCAT WARNING: Datagram ffff88003f81d6d8 (domain0-0-main) was SKIPPED 1003 times.
[14373.725111] EtherCAT WARNING 0: 2 datagrams TIMED OUT!
....
My code is roughly set-up like this:
----- Before RT -----
ecrt_slave_config_dc(module->getSlaveConfig(ELM3004), 0x0700, 1000000, 500000, 20000, 0); // ELM3004
ecrt_slave_config_dc(module->getSlaveConfig(EL7041), 0x0300, 1000000, 500000,, 0, 0); // EL7041
ecrt_master_select_reference_clock(master, network->getModule(EL7041); // Defines the EL7041 as the ref clock
----- Before the cyclic task -----
ecrt_master_set_send_interval(ethercatHandler->getMaster(), TIMESPEC2NS(cycletime) / 1000); // set the send interval to 1000 us
clock_gettime(CLOCK_REALTIME, &wakeupTime);
ecrt_master_application_time(ethercatHandler->getMaster(), TIMESPEC2NS(wakeupTime));
ecrt_master_sync_slave_clocks(ethercatHandler->getMaster());
----- Cyclic task -----
wakeupTime = timespec_add(wakeupTime, cycletime);
clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &wakeupTime, nullptr); // sleep until next cycle
ecrt_master_receive(ethercatHandler->getMaster());
ecrt_domain_process(ethercatHandler->getDomain());
.... (Emit signals for my commands) ...
ecrt_domain_queue(ethercatHandler->getDomain());
ecrt_master_reference_clock_time(ethercatHandler->getMaster(), timeForSync);
ecrt_master_sync_slave_clocks(ethercatHandler->getMaster());
clock_gettime(CLOCK_REALTIME, &time);
*timeForSync = uint32_t(TIMESPEC2NS(time));
ecrt_master_application_time(ethercatHandler->getMaster(), *timeForSync);
ecrt_master_send(ethercatHandler->getMaster());
----- End of cyclic task -----
Note that the calculations inside the cyclic task are very small : I'm using slots//signal (QT5 framework) to treat commands (i.e. PDOs and 'RT' SDOs) which are dealt with on their own threads. I'm doing so because I don't care so much about the exact timing of my commands.
Any chance you can spot where my issue is coming from?
Thanks,
Romain
More information about the Etherlab-users
mailing list