[etherlab-users] Sync problems and DC mode

Graeme Foot Graeme.Foot at touchcut.com
Wed Jan 24 02:44:56 CET 2018

The Sync0shift values should be the same for all slaves (with the same time base), so that they all apply their PDO data at the same shift time from the start of the period.  This allows you to send the PDO information any time between the start of the period and the sync time without the slave missing the information.  The distributed clock framework makes sure all the slaves clocks are in sync so that the sync0 time occurs at the same time on all the slaves.

I have a period of 1000us, so I use a shift time of 500us.  So I can use up to half of by period to receive, calc and send new PDOs.  Note: the send time includes the time the frame is on the wire.


From: etherlab-users [mailto:etherlab-users-bounces at etherlab.org] On Behalf Of Ignacio Rosales Gonzalez
Sent: Wednesday, 24 January 2018 12:47 a.m.
To: Boris Skegin <boris.skegin.de at googlemail.com>
Cc: etherlab-users at etherlab.org
Subject: Re: [etherlab-users] Sync problems and DC mode

First of all  many thanks for your help!

If you look below, master->app_time is not really used in the code.
I get the dc ref slave clock with ecrt_master_reference_clock_time(master->master, &master->reference_time); and save in master->reference_time
after that

 ecrt_master_sync_slave_clocks(master->master); // sync slaves to ref clock
 ecrt_master_application_time(master->master, master->reference_time+master->app_time_period); //update master time with time got from dc ref slave

Could you help me with the Sync0shift values??  The topology of my network is line one.

Master ----- S1 - S2 - S3 ..... and so on until S25.

I suppose I must set a very small one for the first slave and increase it a little for the next ones, no??

The kernel is Linux debian 3.4-9-rtai-686-pae #1 SMP PREEMPT Debian 3.4.55-4linuxcnc i686 GNU/Linux
what is the default one of the linuxcnc 2.7 debian wheezy

The network card is a realtek r8169

Thanks again

Ignacio Rosales

2018-01-23 2:06 GMT+01:00 Boris Skegin <boris.skegin.de at googlemail.com<mailto:boris.skegin.de at googlemail.com>>:

> With this version
> <https://github.com/narogon/linuxcnc-ethercat/commit/e4ab86ba6167ced532e49904059df580062b2d97#diff-059a684a933530837771b5a249433ff3>
> (also as attachment lcec_main.c) I get the servos sync and OP but it seems
> that the PDO doesn't arrive for some of the slaves (no idea why).

master->app_time += master->app_time_period;  means that you just sum
up constant cycle times of  the LinuxCNC thread. So any latency
information gets lost here.

Rather  make  master->app_time  be equal to something like
rt_get_time() transferred to EtherCAT time.

I also think that a proper value for sync0Shift  can help a lot.

If however nothing of that helps, then proceed  to  Graeme Foot's option b) .

BTW, what exactly is your kernel and network card and do you really
use an adopted ( non-generic) network driver?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20180124/3e5ed892/attachment.html>

More information about the etherlab-users mailing list