<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40" xmlns:ns0="http://schemas.microsoft.com/office/2004/12/omml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName" /><!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]--><style>
<!--a:link
        {mso-style-priority:99;}
span.MSOHYPERLINK
        {mso-style-priority:99;}
a:visited
        {mso-style-priority:99;}
span.MSOHYPERLINKFOLLOWED
        {mso-style-priority:99;}

 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 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;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:Calibri;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</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]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="Section1">
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">Hi,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">First off, my understanding of setting up the DC system is that each slave that wants a Distributed Clock setup calls ecrt_slave_config_dc()
 specifying the sync0_cycle time and the sync0_shift time (and sync1).  The sync0_shift time should be specified as the offset from the nominal start of cycle time, which is specified by the very fist call to ecrt_master_application_time().<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">Therefore your cycles should always start at: initial_master_application_time + cycle_count * cycle_time<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">Where you start counting cycles as soon as the first ecrt_master_application_time() call is made.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">I set my sync0_cycle to 1000000 (1ms) and sync0_shift to 500000 (0.5ms).  After waking up at the beginning of the cycle I then have 0.5ms
 to send my EtherCAT frames and have them be processed by all slaves.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">As to answering "</span></font><span lang="EN-US">To solve the problem i have to know the systemtime, the next sync0-signal is generated
 in the slave. Does anybody know if this time is available in a slave with dc-support ?</span><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy">":<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">If the slave has a 64bit DC you should be able to calculate the next sync time as "initial_master_application_time + cycle_count * cycle_time
 + sync_shift".<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">If the slave has a 32bit DC its more annoying reading the clock but it should be the same calculation, but then remove the top 4 bytes. 
 (You get 4.2 odd seconds before the clock rolls over.)<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">Looking at the ET1100 datasheet document there is a register 0x0990:0x0997 which says it is the "SYNC0 Start Time" - Local copy of System
 Time (T_localtime + T_offset) (From Section 9.1.5).<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy">Regards,<o:p></o:p></span></font></p>
<p class="MsoNormal"><st1:PersonName w:st="on"><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy">Graeme Foot</span></font></st1:PersonName><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy">.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"> <o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="navy" face="Arial"><span style="font-size:
10.0pt;font-family:Arial;color:navy"><o:p> </o:p></span></font></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt;font-family:
"Times New Roman"">
<hr size="2" width="100%" align="center" tabindex="-1">
</span></font></div>
<p class="MsoNormal"><b><font size="2" face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma"> etherlab-users-bounces@etherlab.org
 [mailto:etherlab-users-bounces@etherlab.org] <b><span style="font-weight:bold">On Behalf Of
</span></b>WIEGAND Ralf<br>
<b><span style="font-weight:bold">Sent:</span></b> Wednesday, 2 April 2014 05:23<br>
<b><span style="font-weight:bold">To:</span></b> <st1:PersonName w:st="on">etherlab-users@etherlab.org</st1:PersonName><br>
<b><span style="font-weight:bold">Subject:</span></b> [etherlab-users] DC-Synchronization - Sync signal generation</span></font><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt;font-family:
"Times New Roman""><o:p></o:p></span></font></p>
</div>
<p class="MsoNormal"><font size="2" face="Calibri"><span style="font-size:11.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span lang="EN-US" style="font-size:
11.0pt">Hello,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span lang="EN-US" style="font-size:
11.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span lang="EN-US" style="font-size:
11.0pt">first of all, thanks to all etherlab-developers for their great job.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span lang="EN-US" style="font-size:
11.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span lang="EN-US" style="font-size:
11.0pt">I have a question about the activation of the sync-signal generation with distributed clocks.  I use the ethercatmaster 1.5.1 with the dc-patches from
<st1:PersonName w:st="on">Graeme Foot</st1:PersonName>, kernel 2.6.32.11 with rtai 3.8.1. The application is running over the rtdm-interface and the masterclock is synchronized to the reference clock in slave 1. The slaves are particular developed for us from
 external companies (FPGA-based designs with Beckhoff IP-Core). The synchronization of the masterclock with the reference clock, like the patches from
<st1:PersonName w:st="on">Graeme Foot</st1:PersonName>, works very well. But i see a constant phase offset between the sync0-signal and the incoming frame (SOF). With every restart of the application the offset is constant during runtime, but with another value.
 If the value is in a special range, i read  the same input pdo values between two cycle times from the slave. To solve the problem i have to know the systemtime, the next sync0-signal is generated in the slave. Does anybody know if this time is available in
 a slave with dc-support ?<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span lang="EN-US" style="font-size:
11.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span lang="EN-US" style="font-size:
11.0pt">Thank you in advance,<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span lang="EN-US" style="font-size:
11.0pt"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Calibri"><span lang="EN-US" style="font-size:
11.0pt">Ralf Wiegand  <o:p></o:p></span></font></p>
<p style="margin-bottom:12.0pt"><strong><b><font size="2" color="gray" face="Arial"><span lang="DE" style="font-size:10.0pt;font-family:Arial;color:gray">Ralf Wiegand</span></font></b></strong><font size="2" color="gray" face="Arial"><span lang="DE" style="font-size:10.0pt;font-family:
Arial;color:gray"><br>
<br>
<br>
<strong><b><font face="Arial"><span style="font-family:Arial">T:</span></font></b></strong> +49 6441 207-410 
<strong><b><font face="Arial"><span style="font-family:
Arial">F:</span></font></b></strong> +49 6441 207-387<br>
<strong><b><font face="Arial"><span style="font-family:Arial">E:</span></font></b></strong>
</span></font><font color="gray"><span lang="DE" style="color:gray"><a href="mailto:Ralf.Wiegand@hexagonmetrology.com%20" title=""><font size="2" color="#0082bf" face="Arial"><span style="font-size:10.0pt;font-family:Arial;
color:#0082BF">Ralf.Wiegand@hexagonmetrology.com</span></font><font size="2" face="Arial"><span style="font-size:10.0pt;font-family:Arial">
</span></font></a></span></font><span lang="DE"><o:p></o:p></span></p>
<p><strong><b><font size="2" color="gray" face="Arial"><span lang="DE" style="font-size:10.0pt;font-family:Arial;color:gray">Hexagon Metrology GmbH</span></font></b></strong><font size="2" color="gray" face="Arial"><span lang="DE" style="font-size:10.0pt;font-family:
Arial;color:gray"><br>
Siegmund-Hiepe-Str. 2-12<br>
DE-35578 Wetzlar</span></font><span lang="DE"> <br>
<a href="http://www.hexagonmetrology.de/" title="Hexagon Metrology Web Site"><font size="2" color="#0082bf" face="Arial"><span style="font-size:10.0pt;font-family:
Arial;color:#0082BF">www.hexagonmetrology.de</span></font></a></span><font size="2" color="#0082bf" face="Arial"><span lang="DE" style="font-size:10.0pt;
font-family:Arial;color:#0082BF"> |
</span></font><span lang="DE"><a href="http://www.linkedin.com/company/hexagon-metrology" title=""><font size="2" color="#0082bf" face="Arial"><span style="font-size:10.0pt;font-family:Arial;
color:#0082BF">LinkedIn</span></font></a></span><font size="2" color="#0082bf" face="Arial"><span lang="DE" style="font-size:10.0pt;font-family:Arial;color:#0082BF"> |
</span></font><span lang="DE"><a href="http://www.facebook.com/hex.metrology" title=""><font size="2" color="#0082bf" face="Arial"><span style="font-size:10.0pt;
font-family:Arial;color:#0082BF">Facebook</span></font></a></span><font size="2" color="#0082bf" face="Arial"><span lang="DE" style="font-size:10.0pt;font-family:
Arial;color:#0082BF"> |
</span></font><span lang="DE"><a href="http://twitter.com/hexmetrology" title=""><font size="2" color="#0082bf" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:#0082BF">Twitter</span></font></a><o:p></o:p></span></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="DE" style="font-size:12.0pt;font-family:"Times New Roman""><a href="www.hexagonmetrology.de"></a></span></font><font size="3" face="Arial"><span lang="DE" style="font-size:12.0pt;font-family:Arial"><o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" color="gray" face="Arial"><span lang="DE" style="font-size:10.0pt;font-family:Arial;color:gray">Hauptgeschäftsführer: Holger Fritze<br>
Geschäftsführer: Per Holmberg - Arno Seuren - Michael Rosenbruch<br>
Amtsgericht Wetzlar, HRB 1201 </span></font><font size="3" face="Times New Roman"><span lang="DE" style="font-size:12.0pt;font-family:"Times New Roman""><o:p></o:p></span></font></p>
</div>
</body>
</html>