<div dir="ltr"><div><div><div>Thanks for your reply Graeme! <br><br></div>I would try your changes for the A method (a EtherCAT master is the master clock:) putting domain_queue the first.<br><br></div>By the way for the B method (Slave DC master is the master clock) what is wrong in this approach?:<br><br> // send process data<br> rtapi_mutex_get(&master->mutex);</div><div><br></div><div> // queue domain data</div><div>ecrt_domain_queue(master->domain);<br></div><div><br></div><div> </div>//get the DC slave reference clock time and save in master->reference_time<br><div>ecrt_master_reference_clock_time(master->master, &master->reference_time); <br></div><div><br></div><div>// sync slaves to ref clock</div><div>ecrt_master_sync_slave_clocks(master->master); </div><div><br></div><div>//update master time with time got from dc ref slave<br> ecrt_master_application_time(master->master, master->reference_time+master->app_time_period); <br> </div><div>// send domain data<br> <br> ecrt_master_send(master->master);<br> rtapi_mutex_give(&master->mutex);</div><div><br></div><div>Best regards,</div><div>Ignacio Rosales<br></div><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-01-23 2:18 GMT+01:00 Graeme Foot <span dir="ltr"><<a href="mailto:Graeme.Foot@touchcut.com" target="_blank">Graeme.Foot@touchcut.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As Boris says, master->app_time needs to actually match your PC's time (converted to your app's timeframe).<br>
<br>
Another change you could try is as below. From line 1115:<br>
<br>
// send process data<br>
rtapi_mutex_get(&master-><wbr>mutex);<br>
<br>
// queue domain data<br>
ecrt_domain_queue(master-><wbr>domain);<br>
<br>
// update application time<br>
master->app_time = rt_get_app_time();<br>
ecrt_master_application_time(<wbr>master->master, master->app_time);<br>
<br>
// sync ref clock to master<br>
ecrt_master_sync_reference_<wbr>clock(master->master);<br>
<br>
// sync slaves to ref clock<br>
ecrt_master_sync_slave_clocks(<wbr>master->master);<br>
<br>
// send domain data<br>
ecrt_master_send(master-><wbr>master);<br>
rtapi_mutex_give(&master-><wbr>mutex);<br>
<br>
<br>
You want as constant a time between calling ecrt_master_application_time() and ecrt_master_send() as possible. The calls to ecrt_domain_queue() call takes variable amounts of processing time, so do that first. Also call ecrt_master_sync_reference_<wbr>clock() every cycle to ensure the reference slave gets lot of small updates rather than a few big updates. This helps all slaves keep sync better. It also avoids another source of variable processing time between ecrt_master_application_time() and ecrt_master_send().<br>
<br>
<br>
Graeme.<br>
<div><div class="h5"><br>
<br>
-----Original Message-----<br>
From: etherlab-users [mailto:<a href="mailto:etherlab-users-bounces@etherlab.org">etherlab-users-<wbr>bounces@etherlab.org</a>] On Behalf Of Boris Skegin<br>
Sent: Tuesday, 23 January 2018 2:07 p.m.<br>
To: <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a>; Ignacio Rosales Gonzalez <<a href="mailto:narogon@gmail.com">narogon@gmail.com</a>><br>
Subject: Re: [etherlab-users] Sync problems and DC mode<br>
<br>
Hello.<br>
<br>
> With this version<br>
> <<a href="https://github.com/narogon/linuxcnc-ethercat/commit/e4ab86ba6167ced53" rel="noreferrer" target="_blank">https://github.com/narogon/<wbr>linuxcnc-ethercat/commit/<wbr>e4ab86ba6167ced53</a><br>
> 2e49904059df580062b2d97#diff-<wbr>059a684a933530837771b5a249433f<wbr>f3><br>
> (also as attachment lcec_main.c) I get the servos sync and OP but it<br>
> seems that the PDO doesn't arrive for some of the slaves (no idea why).<br>
<br>
master->app_time += master->app_time_period; means that you just sum<br>
up constant cycle times of the LinuxCNC thread. So any latency information gets lost here.<br>
<br>
Rather make master->app_time be equal to something like<br>
rt_get_time() transferred to EtherCAT time.<br>
<br>
I also think that a proper value for sync0Shift can help a lot.<br>
<br>
If however nothing of that helps, then proceed to Graeme Foot's option b) .<br>
<br>
BTW, what exactly is your kernel and network card and do you really use an adopted ( non-generic) network driver?<br>
<br>
Regards,<br>
boris<br>
</div></div>______________________________<wbr>_________________<br>
etherlab-users mailing list<br>
<a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<a href="http://lists.etherlab.org/mailman/listinfo/etherlab-users" rel="noreferrer" target="_blank">http://lists.etherlab.org/<wbr>mailman/listinfo/etherlab-<wbr>users</a><br>
</blockquote></div><br></div>