<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi,</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">I have changed how to calculate the slave start time by taking only the sync0->cycle_time as cycle time.</div><div id="AppleMailSignature">The results is good and I can see in the log that the 'remainder' is almost the same for all slaves. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">@Florian: Why did you did this change on <span style="background-color: rgba(255, 255, 255, 0);">2016-09-16 ?</span></div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Best regards<br><br>Philippe </div><div><br>On May 16, 2018, at 6:22 PM, Philippe Leuba <<a href="mailto:pleuba@swissonline.ch">pleuba@swissonline.ch</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><span style="font-family: Calibri, sans-serif; font-size: 14px;">Hi All,</span></div><div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
I can not understand how to configure correctly my slaves with the ecrt_slave_config_dc() function.</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
I use nine EL7211-9014 servo controllers and the XML declarations is:</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 14px;">
<div><font face="Consolas"><Dc></font></div>
<div><font face="Consolas"><span class="Apple-tab-span" style="white-space:pre"></span><OpMode></font></div>
<div><font face="Consolas"><span class="Apple-tab-span" style="white-space:pre"></span><Name>DC</Name></font></div>
<div><font face="Consolas"><span class="Apple-tab-span" style="white-space:pre"></span><Desc>DC-Synchron</Desc></font></div>
<div><font face="Consolas"><span class="Apple-tab-span" style="white-space:pre"></span><AssignActivate>#x700</AssignActivate></font></div>
<div><font face="Consolas"><span class="Apple-tab-span" style="white-space:pre"></span><CycleTimeSync0 Factor="1">0</CycleTimeSync0></font></div>
<div><font face="Consolas"><span class="Apple-tab-span" style="white-space:pre"></span><ShiftTimeSync0 Input="0">30000</ShiftTimeSync0></font></div>
<div><font face="Consolas"><span class="Apple-tab-span" style="white-space:pre"></span><CycleTimeSync1 Factor="-1">0</CycleTimeSync1></font></div>
<div><font face="Consolas"><span class="Apple-tab-span" style="white-space:pre"></span><ShiftTimeSync1>1000</ShiftTimeSync1></font></div>
<div><font face="Consolas"><span class="Apple-tab-span" style="white-space:pre"></span></OpMode></font></div>
<div><font face="Consolas"></Dc></font></div>
<div><font face="Consolas"><br>
</font></div>
<div><font face="Calibri">SYNC0 and SYNC1 should be fired at each cycle.</font></div>
</div>
<div style="color: rgb(0, 0, 0); font-size: 14px;"><font face="Calibri"><br>
</font></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
My realtime cycle is at 500us, so initially I used:</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<div> ecrt_slave_config_dc(sc, 0x0700, 500000, 30000, 1000, 0);</div>
<div><br>
</div>
<div>but I sometimes faced some hiccup on some motor movements (almost always on the same motor, but sometimes not), most probably due to frames late regarding SYNC events, so I increased the sync1_shift to half of the cycle time:</div>
<div><br>
</div>
<div> ecrt_slave_config_dc(sc, 0x0700, 500000, 250000, 1000, 0);</div>
<div><br>
</div>
<div>This help, but I’m still not convinced that it is correct.</div>
<div><br>
</div>
<div>How can I debug this, I did not see any error on slaves COEs 1c32 or 1c33 ?</div>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
Startup debug messages are the followings:</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 14px;">
<div><font face="Consolas">EtherCAT DEBUG 0-12: Checking for synchrony.</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: 19 ns difference after 1 ms.</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: app_start_time=64456682505935</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: app_time=64460192975876</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: start_time=64460292975876</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: cycle=501000</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: shift_time=250000</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: remainder=263941</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: start=64460293462935</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: Setting DC cyclic operation start time to 64460293462935.</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-12: Setting DC AssignActivate to 0x0700.</font></div>
</div>
<div style="color: rgb(0, 0, 0); font-size: 14px;"><font face="Consolas">-</font></div>
<div style="color: rgb(0, 0, 0); font-size: 14px;"><font face="Consolas">-</font></div>
<div style="color: rgb(0, 0, 0); font-size: 14px;"><font face="Consolas">-</font></div>
<div style="color: rgb(0, 0, 0); font-size: 14px;">
<div><font face="Consolas">EtherCAT DEBUG 0-13: Checking for synchrony.</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: 9 ns difference after 1 ms.</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: app_start_time=64456682505935</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: app_time=64460854977928</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: start_time=64460954977928</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: cycle=501000</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: shift_time=250000</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: remainder=444993</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: start=64460955283935</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: Setting DC cyclic operation start time to 64460955283935.</font></div>
<div><font face="Consolas">EtherCAT DEBUG 0-13: Setting DC AssignActivate to 0x0700.</font></div>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
I’m really surprised that the remainder can be so different, so I looked in the source code and can not understand the logic:</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div>
<div><font face="Consolas"> // set DC start time</font></div>
<div><font face="Consolas"> start_time = master->app_time + EC_DC_START_OFFSET; // now + X ns (X being 100000000 = 100 ms)</font></div>
<div><font face="Consolas"><br>
</font></div>
<div><font face="Consolas"> if (sync0->cycle_time) {</font></div>
<div><font face="Consolas"> // find correct phase</font></div>
<div><font face="Consolas"> if (master->has_app_time) {</font></div>
<div><font face="Consolas"> u64 diff, start;</font></div>
<div><font face="Consolas"> u32 remainder, cycle;</font></div>
<div><font face="Consolas"><br>
</font></div>
<div><font face="Consolas"> diff = start_time - master->app_start_time;</font></div>
<div><font face="Consolas"> <font color="#ff0000">cycle = sync0->cycle_time + sync1->cycle_time;</font></font></div>
<div><font face="Consolas"> remainder = do_div(diff, cycle);</font></div>
<div><font face="Consolas"><br>
</font></div>
<div><font face="Consolas"> start = start_time + cycle - remainder + sync0->shift_time;</font></div>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
Why the cycle is the sum of the two sync->cycle_time, in my case 501000, should not it be: sync0->cycle_time (500000) ?</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
This was changed on 2016-09-16, but It seems it was right before.</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
I can see that sync0->cycle_time is written to register 9A0 (500000)</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
and sync1->cycle_time is written to register 9A4 (1000), this is correct.</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
It seems to me that the sync1_cycle parameter of the ecrt_slave_config_dc() is handled as as sync1_shift, this is really confusing.</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
Is it normal, can someone explain this ?</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif; font-size: 14px;">
Philippe</div></div><blockquote type="cite"><div><div><p></p></div>
</div></blockquote></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>etherlab-users mailing list</span><br><span><a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a></span><br><span><a href="http://lists.etherlab.org/mailman/listinfo/etherlab-users">http://lists.etherlab.org/mailman/listinfo/etherlab-users</a></span><br></div></blockquote></body></html>