<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Good idea, this should work for different kind of slaves and did not break backward compatibility. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">How to proceed now ?<br><br>Philippe </div><div><br>On May 18, 2018, at 7:24 AM, Gavin Lambert <<a href="mailto:gavin.lambert@tomra.com">gavin.lambert@tomra.com</a>> wrote:<br><br></div><blockquote type="cite"><div>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.apple-tab-span
{mso-style-name:apple-tab-span;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:647125782;
mso-list-type:hybrid;
mso-list-template-ids:700848884 58605144 336134147 336134149 336134145 336134147 336134149 336134145 336134147 336134149;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l1
{mso-list-id:1145929499;
mso-list-template-ids:-492930822;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">I don’t think it makes sense to start using the sync1_shift_time parameter, as that would introduce incompatibility with other code (that perhaps hasn’t upgraded to that build yet, or hasn’t noticed
or doesn’t care about the change in start time), and introduce some additional ambiguity.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">In theory (completely untested air code) something like this might be more correct:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";mso-fareast-language:EN-US">cycle = sync0->cycle_time + sync1->cycle_time – (sync1->cycle_time % sync0->cycle_time);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Philippe Leuba [<a href="mailto:pleuba@swissonline.ch">mailto:pleuba@swissonline.ch</a>]
<br>
<b>Sent:</b> Friday, 18 May 2018 16:34<br>
<b>To:</b> Gavin Lambert <<a href="mailto:gavin.lambert@tomra.com">gavin.lambert@tomra.com</a>><br>
<b>Cc:</b> Graeme Foot <<a href="mailto:Graeme.Foot@touchcut.com">Graeme.Foot@touchcut.com</a>>; <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> Re: [etherlab-users] Slave DC start time calculation<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi Gavin,<o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal">Thanks for the detailed explanation, this explain why the code is like it is. This works for slaves that are doing oversampling but not for mine that just want to shift the SYNC1 a bit. <o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal">Now if we want a solution working for all kind of possibles slave configurations we will need to use the sync1_shift_time parameter of the ecrt_slave_config_dc into the loop...<o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal">What do you think ?<o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal"><br>
Philippe <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
On May 18, 2018, at 5:15 AM, Gavin Lambert <<a href="mailto:gavin.lambert@tomra.com">gavin.lambert@tomra.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">The SYNC1 Cycle register (0x09A4) is a little weird; it acts as both a cycle and shift in one register, depending on the value of the SYNC0 Cycle (0x09A0).</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoNormal" style="mso-list:l0 level1 lfo3"><span style="mso-fareast-language:EN-US">Where SYNC0 Cycle is X and SYNC1 Cycle is 0, SYNC0 and SYNC1 occur at the same time – thus same cycle, no shift.</span><o:p></o:p></li><li class="MsoNormal" style="mso-list:l0 level1 lfo3"><span style="mso-fareast-language:EN-US">Where SYNC0 Cycle is X and SYNC1 Cycle is less than X, SYNC1 occurs at (SYNC1 Cycle) ns after the SYNC0, but otherwise at the same cycle rate – thus it acts as a
shift.</span><o:p></o:p></li><li class="MsoNormal" style="mso-list:l0 level1 lfo3"><span style="mso-fareast-language:EN-US">Where SYNC0 Cycle is X and SYNC1 Cycle is equal to X, SYNC1 occurs at every second SYNC0 – thus it acts as a 2X cycle with no shift.</span><o:p></o:p></li><li class="MsoNormal" style="mso-list:l0 level1 lfo3"><span style="mso-fareast-language:EN-US">Where SYNC0 Cycle is X and SYNC1 Cycle is equal to 2X, SYNC1 occurs at every third SYNC0 – thus it acts as a 3X cycle with no shift.</span><o:p></o:p></li><li class="MsoNormal" style="mso-list:l0 level1 lfo3"><span style="mso-fareast-language:EN-US">Where SYNC0 Cycle is X and SYNC1 Cycle is greater than X but not an exact multiple, it acts as a combination of cycle and shift as above.</span><o:p></o:p></li></ul>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">(Under the hood, it always does behave as a shift that fires exactly once non-overlapping offset from the SYNC0 pulse. Or to put it another way, SYNC0 starts the timer but doesn’t reset it if already
running, and it fires SYNC1 once when the timer finishes.)</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">The </span><span style="font-size:10.5pt;color:black">ecrt_slave_config_dc method essentially just sets the cycle values into the registers directly, while using the sync0_shift to calculate the
overall DC start time relative to the master cycle. The sync1_shift parameter is ignored and should always be 0 because there’s nothing it can actually do with it.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">Exactly what these mean is slave-specific; some slaves want a simple shift at the same cycle rate because they use one to control output timing and the other to control input timing. Other slaves
might want a subordinated cycle (SYNC1 occurring at the master cycle rate, SYNC0 occurring more frequently) because they want to oversample inputs. Or there can be a number of other scenarios. The slave documentation should tell you what settings you need
relative to your master cycle.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">For what it’s worth, I do have a subordinated slave – it uses ecrt_slave_config_dc(sc, 250000, 100000, 750000, 0) to make SYNC0 pulse every 0.25ms, SYNC1 pulse every 1ms (yes, 1ms, not 0.75ms),
and both to be offset from the 1ms master cycle by about 100us – although that’s a little arbitrary.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">I assume the change was probably motivated by this sort of slave configuration (since it does extend the “true” cycle time of the slave, from a certain point of view), but simple addition is probably
wrong when a non-multiple sync1 cycle time is used to introduce any kind of shift into the mix.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> etherlab-users [<a href="mailto:etherlab-users-bounces@etherlab.org">mailto:etherlab-users-bounces@etherlab.org</a>]
<b>On Behalf Of </b>Graeme Foot<br>
<b>Sent:</b> Friday, 18 May 2018 13:03<br>
<b>To:</b> Philippe Leuba <<a href="mailto:pleuba@swissonline.ch">pleuba@swissonline.ch</a>>;
<a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> Re: [etherlab-users] Slave DC start time calculation</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">This piece of code is getting a start time that is in sync with the initial app time from a multiple of the sync0/sync1 cycle times, adjusted by the sync0 shift time.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><a href="https://download.beckhoff.com/download/Document/io/ethercat-development-products/ethercat_esc_datasheet_sec2_registers_2i7.pdf">https://download.beckhoff.com/download/Document/io/ethercat-development-products/ethercat_esc_datasheet_sec2_registers_2i7.pdf</a>
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">says the sync1 cycle time is the "</span>Time between SYNC1 pulses and SYNC0 pulse in ns".
<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">However <a href="https://infosys.beckhoff.com/english.php?content=../content/1033/tcsystemmanager/reference/ethercat/html/EtherCAT_DistributedClocks.htm&id">
https://infosys.beckhoff.com/english.php?content=../content/1033/tcsystemmanager/reference/ethercat/html/EtherCAT_DistributedClocks.htm&id</a>= (Twincat DC settings) and the information for my yaskawa drives are saying that the sync1 cycle time should be a
multiple of the sync0 cycle time, and the sync1 offset is the offset between the sync0 and sync1 interrupts.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">The master code doesn’t even look like it uses the sync1 shift time, and information from my Yaskawa slave says it's sync1 cycle time is readonly and matches the sync0 cycle time.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">So:<o:p></o:p></p>
<p class="MsoNormal">- It looks like the first documents registers 0x09A4:0x09A7 should actually be called sync1 shift time.<o:p></o:p></p>
<p class="MsoNormal">- It does not look like there is currently any slave support for a different (from sync0) sync1 cycle time.<o:p></o:p></p>
<p class="MsoNormal"> (anyone got a slave out there that does?)<o:p></o:p></p>
<p class="MsoNormal">- The EtherLab master should not be using sync1 cycle time in the calculation you mention below.<o:p></o:p></p>
<p class="MsoNormal">- The EtherLab master should be sending sync1 shift time to 0x09A4:0x09A7 instead of the sync1 cycle time.<o:p></o:p></p>
<p class="MsoNormal">- TwinCAT is probably using its cycle time "multiple" parameters to figure out how often to send the PDO requests for each slave (just a guess).<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">In your case, set the second to last parameter to zero, i.e.:</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">ecrt_slave_config_dc(sc, 0x0700, 500000, 250000, 0, 0);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">You have already adjusted the sync0 shift time (third to last parameter) anyway.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">Regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">Graeme.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> etherlab-users [<a href="mailto:etherlab-users-bounces@etherlab.org">mailto:etherlab-users-bounces@etherlab.org</a>]
<b>On Behalf Of </b>Philippe Leuba<br>
<b>Sent:</b> Friday, 18 May 2018 7:11 AM<br>
<b>To:</b> <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> Re: [etherlab-users] Slave DC start time calculation</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal">Hi,<o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal">I have changed how to calculate the slave start time by taking only the sync0->cycle_time as cycle time.<o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal">The results is good and I can see in the log that the 'remainder' is almost the same for all slaves. <o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal">@Florian: Why did you did this change on 2016-09-16 ?<o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal">Best regards<br>
<br>
Philippe <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
On May 16, 2018, at 6:22 PM, Philippe Leuba <<a href="mailto:pleuba@swissonline.ch">pleuba@swissonline.ch</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt">Hi All,</span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">I can not understand how to configure correctly my slaves with the ecrt_slave_config_dc() function.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">I use nine EL7211-9014 servo controllers and the XML declarations is:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"><Dc></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"><OpMode></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"><Name>DC</Name></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"><Desc>DC-Synchron</Desc></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"><AssignActivate>#x700</AssignActivate></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"><CycleTimeSync0 Factor="1">0</CycleTimeSync0></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"><ShiftTimeSync0 Input="0">30000</ShiftTimeSync0></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"><CycleTimeSync1 Factor="-1">0</CycleTimeSync1></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"><ShiftTimeSync1>1000</ShiftTimeSync1></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"></OpMode></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black"></Dc></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">SYNC0 and SYNC1 should be fired at each cycle.</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">My realtime cycle is at 500us, so initially I used:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> ecrt_slave_config_dc(sc, 0x0700, 500000, 30000, 1000, 0);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">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:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> ecrt_slave_config_dc(sc, 0x0700, 500000, 250000, 1000, 0);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">This help, but I’m still not convinced that it is correct.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">How can I debug this, I did not see any error on slaves COEs 1c32 or 1c33 ?</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">Startup debug messages are the followings:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: Checking for synchrony.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: 19 ns difference after 1 ms.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: app_start_time=64456682505935</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: app_time=64460192975876</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: start_time=64460292975876</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: cycle=501000</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: shift_time=250000</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: remainder=263941</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: start=64460293462935</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: Setting DC cyclic operation start time to 64460293462935.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-12: Setting DC AssignActivate to 0x0700.</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">-</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">-</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">-</span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: Checking for synchrony.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: 9 ns difference after 1 ms.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: app_start_time=64456682505935</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: app_time=64460854977928</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: start_time=64460954977928</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: cycle=501000</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: shift_time=250000</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: remainder=444993</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: start=64460955283935</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: Setting DC cyclic operation start time to 64460955283935.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas;color:black">EtherCAT DEBUG 0-13: Setting DC AssignActivate to 0x0700.</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">I’m really surprised that the remainder can be so different, so I looked in the source code and can not understand the logic:</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> // set DC start time</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> start_time = master->app_time + EC_DC_START_OFFSET; // now + X ns (X being 100000000 = 100 ms)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> if (sync0->cycle_time) {</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> // find correct phase</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> if (master->has_app_time) {</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> u64 diff, start;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> u32 remainder, cycle;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> diff = start_time - master->app_start_time;</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> <span style="color:red">
cycle = sync0->cycle_time + sync1->cycle_time;</span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> remainder = do_div(diff, cycle);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Consolas"> start = start_time + cycle - remainder + sync0->shift_time;</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">Why the cycle is the sum of the two sync->cycle_time, in my case 501000, should not it be: sync0->cycle_time (500000) ?</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">This was changed on 2016-09-16, but It seems it was right before.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">I can see that sync0->cycle_time is written to register 9A0 (500000)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">and sync1->cycle_time is written to register 9A4 (1000), this is correct.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">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.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">Is it normal, can someone explain this ?</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">Philippe</span><o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">_______________________________________________<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">http://lists.etherlab.org/mailman/listinfo/etherlab-users</a><o:p></o:p></p>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div></blockquote></body></html>