<div dir="ltr"><div>As far as 'simple experiment' goes. Here is the requested log of a 17-slave configuration:</div><div><br></div><div><br></div><div><div>[2020582.839193] EtherCAT DEBUG 0-0: Checking system time offset.</div>
<div>[2020582.843201] EtherCAT DEBUG 0-0: DC 64 bit system time offset calculation: system_time=1388788619730212737 (corrected with 4000000), app_time=1388788619729210397, diff=-1002340</div><div>[2020582.843204] EtherCAT DEBUG 0-0: Setting time offset to 1388787098688224529 (was 1388787098689226869)</div>
<div>[2020582.847211] EtherCAT DEBUG 0-1: Checking system time offset.</div><div>[2020582.851219] EtherCAT DEBUG 0-1: DC 64 bit system time offset calculation: system_time=1388788619738253673 (corrected with 4000000), app_time=1388788619737210345, diff=-1043328</div>
<div>[2020582.851221] EtherCAT DEBUG 0-1: Setting time offset to 1388787098694672687 (was 1388787098695716015)</div><div>[2020582.855227] EtherCAT DEBUG 0-2: Checking system time offset.</div><div>[2020582.859235] EtherCAT DEBUG 0-2: DC 64 bit system time offset calculation: system_time=1388788619746127955 (corrected with 4000000), app_time=1388788619745210316, diff=-917639</div>
<div>[2020582.859237] EtherCAT DEBUG 0-2: Not touching time offset.</div><div>[2020582.863244] EtherCAT DEBUG 0-3: Checking system time offset.</div><div>[2020582.867251] EtherCAT DEBUG 0-3: DC 64 bit system time offset calculation: system_time=1388788619754132695 (corrected with 4000000), app_time=1388788619753210302, diff=-922393</div>
<div>[2020582.867253] EtherCAT DEBUG 0-3: Not touching time offset.</div><div>[2020582.871260] EtherCAT DEBUG 0-4: Checking system time offset.</div><div>[2020582.875267] EtherCAT DEBUG 0-4: DC 64 bit system time offset calculation: system_time=1388788619762180961 (corrected with 4000000), app_time=1388788619762210451, diff=29490</div>
<div>[2020582.875269] EtherCAT DEBUG 0-4: Not touching time offset.</div><div>[2020582.879278] EtherCAT DEBUG 0-5: Checking system time offset.</div><div>[2020582.883286] EtherCAT DEBUG 0-5: DC 64 bit system time offset calculation: system_time=1388788619767191997 (corrected with 0), app_time=1388788619770210343, diff=3018346</div>
<div>[2020582.883288] EtherCAT DEBUG 0-5: Setting time offset to 1388787098704211274 (was 1388787098701192928)</div><div>[2020582.887294] EtherCAT DEBUG 0-6: Checking system time offset.</div><div>[2020582.891302] EtherCAT DEBUG 0-6: DC 64 bit system time offset calculation: system_time=1388788619775150970 (corrected with 0), app_time=1388788619778210426, diff=3059456</div>
<div>[2020582.891304] EtherCAT DEBUG 0-6: Setting time offset to 1388787098700760295 (was 1388787098697700839)</div><div>[2020582.895311] EtherCAT DEBUG 0-7: Checking system time offset.</div><div>[2020582.899318] EtherCAT DEBUG 0-7: DC 64 bit system time offset calculation: system_time=1388788619783154795 (corrected with 0), app_time=1388788619786210495, diff=3055700</div>
<div>[2020582.899321] EtherCAT DEBUG 0-7: Setting time offset to 1388787098701077013 (was 1388787098698021313)</div><div>[2020582.903327] EtherCAT DEBUG 0-8: Checking system time offset.</div><div>[2020582.907334] EtherCAT DEBUG 0-8: DC 64 bit system time offset calculation: system_time=1388788619791155722 (corrected with 0), app_time=1388788619794210387, diff=3054665</div>
<div>[2020582.907337] EtherCAT DEBUG 0-8: Setting time offset to 1388787098702059792 (was 1388787098699005127)</div><div>[2020582.911343] EtherCAT DEBUG 0-9: Checking system time offset.</div><div>[2020582.915351] EtherCAT DEBUG 0-9: DC 64 bit system time offset calculation: system_time=1388788619799144106 (corrected with 0), app_time=1388788619802210392, diff=3066286</div>
<div>[2020582.915353] EtherCAT DEBUG 0-9: Setting time offset to 1388787098703046442 (was 1388787098699980156)</div><div>[2020582.919360] EtherCAT DEBUG 0-10: Checking system time offset.</div><div>[2020582.923367] EtherCAT DEBUG 0-10: DC 64 bit system time offset calculation: system_time=1388788619807217599 (corrected with 0), app_time=1388788619810210385, diff=2992786</div>
<div>[2020582.923369] EtherCAT DEBUG 0-10: Setting time offset to 1388787098694401972 (was 1388787098691409186)</div><div>[2020582.927376] EtherCAT DEBUG 0-11: Checking system time offset.</div><div>[2020582.931383] EtherCAT DEBUG 0-11: DC 64 bit system time offset calculation: system_time=1388788619815217343 (corrected with 0), app_time=1388788619818210352, diff=2993009</div>
<div>[2020582.931386] EtherCAT DEBUG 0-11: Setting time offset to 1388787098694270706 (was 1388787098691277697)</div><div>[2020582.935392] EtherCAT DEBUG 0-12: Checking system time offset.</div><div>[2020582.939400] EtherCAT DEBUG 0-12: DC 64 bit system time offset calculation: system_time=1388788619823158753 (corrected with 0), app_time=1388788619826210432, diff=3051679</div>
<div>[2020582.939402] EtherCAT DEBUG 0-12: Setting time offset to 1388787098702271332 (was 1388787098699219653)</div><div>[2020582.943409] EtherCAT DEBUG 0-13: Checking system time offset.</div><div>[2020582.947416] EtherCAT DEBUG 0-13: DC 64 bit system time offset calculation: system_time=1388788619831157270 (corrected with 0), app_time=1388788619834210362, diff=3053092</div>
<div>[2020582.947418] EtherCAT DEBUG 0-13: Setting time offset to 1388787098703045985 (was 1388787098699992893)</div><div>[2020582.951425] EtherCAT DEBUG 0-14: Checking system time offset.</div><div>[2020582.955432] EtherCAT DEBUG 0-14: DC 64 bit system time offset calculation: system_time=1388788619839165891 (corrected with 0), app_time=1388788619842210326, diff=3044435</div>
<div>[2020582.955435] EtherCAT DEBUG 0-14: Setting time offset to 1388787098703499171 (was 1388787098700454736)</div><div>[2020582.959441] EtherCAT DEBUG 0-15: Checking system time offset.</div><div>[2020582.963449] EtherCAT DEBUG 0-15: DC 64 bit system time offset calculation: system_time=1388788619847182087 (corrected with 0), app_time=1388788619850210371, diff=3028284</div>
<div>[2020582.963451] EtherCAT DEBUG 0-15: Setting time offset to 1388787098700973845 (was 1388787098697945561)</div><div>[2020582.967458] EtherCAT DEBUG 0-16: Checking system time offset.</div><div>[2020582.971465] EtherCAT DEBUG 0-16: DC 32 bit system time offset calculation: system_time=1116891966 (corrected with 0), app_time=1388788619858210417, diff=3048243</div>
<div>[2020582.971467] EtherCAT DEBUG 0-16: Setting time offset to 614131959 (was 611083716)</div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">[2020583.075648] EtherCAT DEBUG 0-1: Checking for synchrony.</div>
<div class="gmail_extra">[2020583.079655] EtherCAT DEBUG 0-1: 37 ns difference after 4 ms.</div><div><br></div><div class="gmail_extra">Cycle time: 1ms</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br>
</div><div class="gmail_extra">J.</div><div class="gmail_extra"><br></div><br><div class="gmail_quote">2014/1/3 Jun Yuan <span dir="ltr"><<a href="mailto:j.yuan@rtleaders.com" target="_blank">j.yuan@rtleaders.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Oh, I understand, you're talking about synchronizing the master clock<br>
to the ref slave. This has been implemented in the etherlab master.<br>
You need to use the function ecrt_master_reference_clock_time()<br>
instead of ecrt_master_sync_reference_clock(). An example is given in<br>
example/rtai_rtdm_dc.<br>
<br>
Well, I think most of us are still used to sync reference clock to<br>
master. And yes, sync master to ref clock would make the situation a<br>
little bit better, as the ref clock itself doesn't need any adjustment<br>
any more, making the ref clock signal stable for the other slaves. But<br>
since the other slave are still having a bad time offset from the<br>
master to have a same timebase as the ref_clock, they still suffer<br>
from a large diff at the beginning of drift compensation. The problem<br>
is not still there.<br>
<br>
I need some volunteers to do a simple experiment for me. You'll just<br>
need a normal master application based on the current etherlabmaster<br>
and a ethercat bus network with at least one slave having DC enabled.<br>
1. running your master application for about 10 minutes. This would be<br>
enough for all the DC sync on the bus get converged. So that all the<br>
DCs are running synchronized. You can check that with „ethercat<br>
reg_read -tsm32 0x92c“, it should be something below 1000 ns.<br>
2. turn the debug level of master to 1 using „sudo ethercat debug 1“.<br>
3. stop the master application and restart it right away, while don't<br>
shut down your slaves. Your slaves should still have a relative good<br>
sync with each other.<br>
4. check you system log, look for the lines like<br>
<br>
[ 9766.885265] EtherCAT DEBUG 0-0: DC 64 bit system time offset<br>
calculation: system_time=xxxxxxxx (corrected with xxxxxxxx),<br>
app_time=xxxxxxx, diff=xxxxxxxx<br>
[ 9766.885268] EtherCAT DEBUG 0-0: „Setting time offset to xxxxxxx<br>
(was xxxxxxx)“ OR: „Not touching time offset.“<br>
…<br>
[ 9767.292758] EtherCAT DEBUG 0-0: Checking for synchrony.<br>
[ 9767.296758] EtherCAT DEBUG 0-0: Sync after 4 ms: xxxxxxx ns<br>
<br>
send these 4 lines of your system log to me, and tell me the cycle<br>
time of your loop. That’s it. Thanks!<br>
<div class=""><div class="h5"><br>
On Fri, Jan 3, 2014 at 10:52 AM, Slutsker, Rasty<br>
<<a href="mailto:rasty.slutsker@servotronix.com">rasty.slutsker@servotronix.com</a>> wrote:<br>
> Master clock is accurate (more or less), but delivery is not, since software is involved.<br>
> I'm just asking why slave(s) shall synchronize to "jumpy" clock of master? Maybe be it would be more correct, if master could synchronize itself to the first slave and then will run pll adjusting it's clock to the slave's one?<br>
> In that case we can completely eliminate this time-consuming synchronization phase.<br>
><br>
> Say,<br>
> a) master sends it's virtual clock to the first slave and that slave becomes a clock master<br>
> b) master re-distributes fist slave's clock to other slaves<br>
> c) master adjust it's clock permanently, relatively to the clock master (first slave)<br>
> d) master periodically re-distributes clock from the first slave to other in order to eliminate time skew in slave.<br>
><br>
><br>
> ________________________________________<br>
> From: Jun Yuan [<a href="mailto:j.yuan@rtleaders.com">j.yuan@rtleaders.com</a>]<br>
> Sent: Friday, January 03, 2014 11:10 AM<br>
> To: Slutsker, Rasty<br>
> Cc: Jeroen Van den Keybus; Raz; <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
> Subject: Re: [etherlab-users] etherlab dc sync check<br>
><br>
> I'm not saying that the clock of the master is inaccurate. I'm saying<br>
> that the master software does a bad job in the calculation of the time<br>
> offset for each slave. It should not use jiffies in the calculation,<br>
> It should not have any correction at all. The app_time when the fprd<br>
> datagram to 0x0910 is sent, let's call it app_time_sent, is exactly<br>
> the time which should be compared to the system time of the slave.<br>
><br>
>> Why not just send once a current muster time to the first slave, then propagate(copy) it to other slaves, and run PLL in the master that adjust itself to the fist slave (clock master)?<br>
><br>
> I think we cannot do that, it's against the ethercat standard :)<br>
> It actually works similiar like you suggest, just in another way. It<br>
> is something like this:<br>
> Ref clock -> Master clock<br>
> 1. The master asks the first slave which time it has.<br>
> 2. The master compares the timestamp with its app time, and sends a<br>
> new time offset to the first slave.<br>
> 3. The first slave adds the new time offset to its clock. Now he has<br>
> the same time as the master. Drift is the next thing to worry about.<br>
><br>
> Other slave clock -> Ref clock<br>
> 1. The master asks the slave which is not a ref clock which time it has.<br>
> 2. The master compares the timestamp with the time of the ref clock,<br>
> and sends a new time offset to the slave.<br>
> 3. The slave adds the new time offset to its clock. Now he shall have<br>
> the same time as the ref clock.<br>
><br>
> I believe the current etherlabmaster doesn't do well in step 2. it<br>
> could be done better.<br>
<br>
<br>
<br>
</div></div><div class=""><div class="h5">--<br>
Jun Yuan<br>
[Aussprache: Djün Üän]<br>
<br>
Robotics Technology Leaders GmbH<br>
Am Loferfeld 58, D-81249 München<br>
Tel: <a href="tel:%2B49%2089%20189%200465%2024" value="+4989189046524">+49 89 189 0465 24</a><br>
Mobile: <a href="tel:%2B49%20176%202176%205238" value="+4917621765238">+49 176 2176 5238</a><br>
Fax: <a href="tel:%2B49%2089%20189%200465%2011" value="+4989189046511">+49 89 189 0465 11</a><br>
mailto: <a href="mailto:j.yuan@rtleaders.com">j.yuan@rtleaders.com</a><br>
<br>
Umlautregel in der chinesischen Lautschrift Pinyin: Nach den Anlauten<br>
y, j, q, und x wird u als ü ausgesprochen, z.B. yu => ü, ju => dschü,<br>
qu => tschü, xu => schü.<br>
</div></div></blockquote></div><br></div></div>