<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:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 12 (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]--><style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:MingLiU;
panose-1:2 2 5 9 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:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"Microsoft JhengHei";
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@Microsoft JhengHei";
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@MingLiU";
panose-1:2 2 5 9 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","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.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.5pt;
font-family:Consolas;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle23
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle24
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle25
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:Consolas;}
.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;}
--></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-NZ" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I used to pre-start my realtime thread and call
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_activate()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> (from non-realtime) just before “going live”. But after a few emails with Florian
where he was saying that it wasn’t necessary I changed it back.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">However he has also said in another post:<o:p></o:p></span></p>
<p class="MsoPlainText">you should not call ecrt_master_application_time() at an arbitrary time before cyclic operation, because the initial value is used to calculate the phase offset of the sync0 start times. You should call it in cyclic operation only.<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The upshot for me is that I’ve found</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> that as long as
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_application_time()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> is called with an appropriate time, just before the activate, there are no
race conditions or errors.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Graeme.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">PS: One little correction, it was the CX1100-0004 that I had problems with using as a reference slave, not the EK1100.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Gavin Lambert [mailto:gavinl@compacsort.com]
<br>
<b>Sent:</b> Tuesday, 2 June 2015 1:59 p.m.<br>
<b>To:</b> Graeme Foot<br>
<b>Cc:</b> etherlab-users@etherlab.org<br>
<b>Subject:</b> RE: [etherlab-users] Twincat communicate with yaskawa SGDV alarm A12 (Sync Error)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The “No app_time received up to now but master already active” warning is due to a race between the internal master starting to configure the slaves once
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_activate()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> is called and the realtime loop calling
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_send()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">
</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">for the first time. As long as your master thread starts up faster than your slaves can be configured (which is usually the case, but not always if you have a small number
of slaves or a particularly slow thread start-up time) then you shouldn’t get the warning (which also makes the DC times at the wrong phase from your PDO exchange; that may or may not matter to you – but it also happens if you don’t call
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_application_time()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">
</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">for the first time just prior to the send).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">My preferred solution to avoid this warning is to start the realtime thread before calling
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_activate()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">, but make it sleep without calling the
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> functions until a flag is set by the main thread after activating. This way it’s already “hot” and the
delay will be minimal, practically guaranteeing that it will win the race (since it requires multiple cycles to configure even a single slave). It also means that I can deactivate, reconfigure, and reactivate the master without having to stop the realtime
thread (although that requires some care and another patch, if using the usermode library).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><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" style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Graeme Foot [<a href="mailto:Graeme.Foot@touchcut.com">mailto:Graeme.Foot@touchcut.com</a>]
<br>
<b>Sent:</b> Tuesday, 2 June 2015 13:41<br>
<b>To:</b> Gavin Lambert<br>
<b>Cc:</b> <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> RE: [etherlab-users] Twincat communicate with yaskawa SGDV alarm A12 (Sync Error)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Good comments to make.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Yes, the DC reference slave should be the first capable slave and definitely before (or at least the first) DC enabled slave. However, I had some EK1100 modules
(which at one stage were my first slaves) that just did not seem to provide a settled enough time for the yaskawa SGDV drives. But when I changed my reference slave to an EL1008 slave (the next slave in the system) everything was fine. I suspect the EK1100’s
time was running too fast (or too slow, I can’t remember) compared to the SGDV’s time and it couldn’t adjust quick enough.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">If you don’t call
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_application_time()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> before
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_activate()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> then you can get: "No app_time received up to now but master already active.". However,
as you say, you should call </span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_application_time()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> in phase with your realtime cycle time. I set
my time just before going realtime and the first realtime period is scheduled to run 50 times my cycle period later. The 50 times is to allow the
</span><span style="font-size:11.0pt;font-family:"Courier New"">rt_make_hard_real_time()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> call to go realtime. As we are not yet realtime, this call can take a little time
to happen.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Yes, I agree, the
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_send()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> should be as consistent as possible. To allow this my cycles sequence is to perform the
EtherCAT code below straight after waking up. All other calculations and processing, to prepare for the next cycle, are performed after this.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Graeme.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Gavin Lambert [<a href="mailto:gavinl@compacsort.com">mailto:gavinl@compacsort.com</a>]
<br>
<b>Sent:</b> Tuesday, 2 June 2015 12:52 p.m.<br>
<b>To:</b> Graeme Foot<br>
<b>Cc:</b> <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> RE: [etherlab-users] Twincat communicate with yaskawa SGDV alarm A12 (Sync Error)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">FWIW, while I could be wrong about this, as far as I know it’s generally a bad idea to explicitly set the reference clock slave. It defaults to being the first
DC-capable slave on the network, and you shouldn’t set it to any other slave because of the way the DC sync datagrams work. Specifically, any DC-capable slaves that are topologically earlier than the reference clock will
<b>not</b> receive the reference clock’s time, but instead whichever value happens to have been initialised by the master (I haven’t checked exactly what this will be but I expect it’s probably either zero or the master’s time). As a result these slaves will
be desynched with the rest of the network.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Of course, you can get away with this if you don’t care about the DC times of any slaves prior to the selected reference clock, but it still seems like a bad
habit unless there’s a very good reason to select some specific device (eg. known as a “better” clock) – but then you should try to get it as early in the network as possible.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Also, you’re not supposed to call
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_application_time()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> before
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_activate()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">; the master is expecting that the first application_time it receives is in phase with
the application loop – ideally as close to the </span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_send()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> call as possible. (The examples don’t
really make this clear, but the goal is to make the </span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_send()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">call at as close to the desired cycle
time as possible. The sleep is at the other end of the loop because there is a natural delay between send and receive anyway and because the assumption is that the processing time is reasonably constant.)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><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" style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif""> 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> Tuesday, 2 June 2015 11:45<br>
<b>To:</b> </span><span style="font-size:11.0pt;font-family:"Microsoft JhengHei","sans-serif"">陈成细</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif"">;
<a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> Re: [etherlab-users] Twincat communicate with yaskawa SGDV alarm A12 (Sync Error)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">1) If your cycle time is 4ms, I think it should instead be:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">0x60C2, 0x01 = 4<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">0x60C2, 0x02 = -3<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Eg:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""> ecrt_slave_config_sdo8(dev->slaveConfig, 0x60C2, 0x01, (uint8_t)4);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""> ecrt_slave_config_sdo8(dev->slaveConfig, 0x60C2, 0x02, (int8_t)(-3));<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Where the first parameter is the significand and the second parameter is the exponent. So:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">(0x60C2, 0x01) * 10 ^ (0x60C2, 0x02) = 4 * 10 ^ -3 = 0.004 seconds = 4 ms<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">2) I’m currently patching against 1.5.2 (2526). Yes it is still quite old but I haven’t needed to (or had the time) to move on. I don’t think any of my patches
have made it into the master. My current DC patch is: etherlabmaster-1.5.2-2526-c_dc_helpers.patch (attached). There is still the odd issue with some of the slaves taking a while to sync on startup. This has been solved by other people but I haven’t had
a chance to add it in myself yet.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I don’t think the EK1100, EL1008 and EL2008 modules are able to be set up as DC slaves, but they can be used as the reference clock slave.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Before starting realtime polling I set the reference clock slave using (where refSlaveConfig is the slaveConfig of the module I select via a config file):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""> ecrt_master_select_reference_clock(ecMod->master, refSlaveConfig);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">This is after
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_application_time()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> and before
</span><span style="font-size:11.0pt;font-family:"Courier New"">ecrt_master_activate()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">My realtime loop is:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // receive process data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecrt_master_receive(ecMod->master);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // process domain data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black">
</span><span style="font-size:11.0pt;font-family:"Courier New";color:blue">for</span><span style="font-size:11.0pt;font-family:"Courier New";color:black"> (i = 0; i < EC_DOMAIN_COUNT; i++)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecrt_domain_process(ecMod->domains[i].domain);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // check domain state, check master state<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // prepare pdo data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // send process data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black">
</span><span style="font-size:11.0pt;font-family:"Courier New";color:blue">for</span><span style="font-size:11.0pt;font-family:"Courier New";color:black"> (i = 0; i < EC_DOMAIN_COUNT; i++)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecrt_domain_queue(ecMod->domains[i].domain);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // always sync distributed clock (just before master_send)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecMod_syncDistClock(ecMod);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // do the send<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecrt_master_send(ecMod->master);
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // update the master clock (if this module provides the ref slave)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // Note: called after ecrt_master_send to reduce time jitter<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecMod_updateMasterClock(ecMod);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">My syncDistClock function gets the current ref slave time and requests the slaves to sync to the ref slave:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // cache prev master time and get now<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> masterTime = (uint32_t)ecMod->m_dcTime;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecMod->m_dcTime = filterTime( rt_get_time_ns() );<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // get lower 32 bit of clock time from reference slave (after first scan)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black">
</span><span style="font-size:11.0pt;font-family:"Courier New";color:blue">if</span><span style="font-size:11.0pt;font-family:"Courier New";color:black"> (ecMod->m_getDCDiff)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> int res;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> uint32_t slaveTime;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> res = ecrt_master_reference_clock_time(ecMod->master, &slaveTime);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black">
</span><span style="font-size:11.0pt;font-family:"Courier New";color:blue">switch</span><span style="font-size:11.0pt;font-family:"Courier New";color:black"> (res)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black">
</span><span style="font-size:11.0pt;font-family:"Courier New";color:blue">case</span><span style="font-size:11.0pt;font-family:"Courier New";color:black"> 0 :<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // calc time diff<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecMod->m_dcDiff = masterTime - slaveTime;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> } break;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black">
</span><span style="font-size:11.0pt;font-family:"Courier New";color:blue">default</span><span style="font-size:11.0pt;font-family:"Courier New";color:black"> :<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // no ref clock found or datagram failure<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecMod->m_dcDiff = 0;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black">
</span><span style="font-size:11.0pt;font-family:"Courier New";color:blue">else<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecMod->m_dcDiff = 0;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecMod->m_getDCDiff = true;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // call to sync slaves to ref slave
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // (which is used for ecrt_master_reference_clock_time)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecrt_master_sync_slave_clocks(ecMod->master);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // update the master time for the next cycle (in nano-seconds)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // (this is required for the master to figure out the modules initial<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#006800"> // dc time)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:black"> ecrt_master_application_time(ecMod->master, ecMod->m_dcTime + g_app.scanTimeNS);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">My updateMasterClock function is responsible for tracking and filtering the master time drift. This drift is added to the rtai time. So whenever I need to
get an rtai time I need to wrap it in the </span><span style="font-size:11.0pt;font-family:"Courier New"">filterTime()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> function. When I need the realtime cycle to sleep
for the next period (using </span><span style="font-size:11.0pt;font-family:"Courier New"">rt_sleep_until(wakeTime)</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">) the wake time is adjusted by the filtered time.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">(Note: error checking removed to hopefully make clearer)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I hope this helps,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Graeme.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
</span><span style="font-size:10.0pt;font-family:"Microsoft JhengHei","sans-serif"">陈成细</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> [<a href="mailto:crazyintermilan@gmail.com">mailto:crazyintermilan@gmail.com</a>]
<br>
<b>Sent:</b> Friday, 29 May 2015 2:19 p.m.<br>
<b>To:</b> Graeme Foot<br>
<b>Subject:</b> Re: Twincat communicate with yaskawa SGDV alarm A12 (Sync Error)<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Dear Graeme Foot,<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Thanks for your kindly guide in the mailing list and private email. In the recently half year, I do on the track and make in progress to drive my yaskawa servopack and servo motor via etherlab master.<o:p></o:p></p>
</div>
<p class="MsoNormal">First of all, I would like update my status to you. <o:p></o:p></p>
</div>
<p class="MsoNormal">1. I create three domain, readdomain, write domain for yaskawa, another domain for others.<o:p></o:p></p>
</div>
<p class="MsoNormal">2. I can make motor rotate in free run mode without setup DC<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">3. Two times success to drive motor with DC, others 5000ms sync error<o:p></o:p></p>
</div>
<p class="MsoNormal">My setup:<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">ubuntu 14.04, xenomai real time kernel, etherlab1.52 stable
<o:p></o:p></p>
</div>
<p class="MsoNormal">I do my homework already, and I think the answer already in the mailing list, so I have several point need to make clear.<br>
<br>
1. <<u><span style="color:blue"><a href="http://lists.etherlab.org/pipermail/etherlab-users/2012/001562.html">http://lists.etherlab.org/pipermail/etherlab-users/2012/001562.html</a></span></u>> post you mention
<br>
<o:p></o:p></p>
<pre>Hi,<br><br>Yes I have thanks. My cycle time is 1ms. I have set:<o:p></o:p></pre>
<pre>0x60C2, 0x01 = 1<o:p></o:p></pre>
<pre>0x60C2, 0x02 = -3 <o:p></o:p></pre>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<pre>Graeme.<o:p></o:p></pre>
</blockquote>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">My cycle time use 4ms, I set <o:p></o:p></p>
<pre>0x60C2, 0x01 = 01<o:p></o:p></pre>
<pre>0x60C2, 0x02 = FD<o:p></o:p></pre>
<p class="MsoNormal">refer to<br>
<img border="0" width="406" height="471" id="_x0000_i1033" src="cid:image001.jpg@01D09D40.538BC100" alt="Inline image 1"><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">2. Regarding DC patch <<u><span style="color:blue"><a href="http://thread.gmane.org/gmane.network.etherlab.user/1421">http://thread.gmane.org/gmane.network.etherlab.user/1421</a></span></u>>, do you have latest patch for etherlab1.52 stable,
since it is years ago, or already merged into 1.52?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I understand that 5000ms sync error caused by DC time offset calculation inaccurate. First of all, I select yaskawa slave as reference clock, then sync master to reference clock? If I add EK1100, EL1008, and EL2008, also I have to sync
these slaves to reference clock?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">As now my implement in my loop as follow:<o:p></o:p></p>
<p class="MsoNormal"><span style="color:green">//</span><span style="color:silver">
</span><span style="color:green">send</span><span style="color:silver"> </span><span style="color:green">process</span><span style="color:silver">
</span><span style="color:green">data</span> <o:p></o:p></p>
<pre><span style="color:silver"> </span><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">update</span><span style="color:silver"> </span><span style="color:green">application</span><span style="color:silver"> </span><span style="color:green">time</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:black">master-></span><span style="color:maroon">app_time</span><span style="color:silver"> </span><span style="color:black">+=</span><span style="color:silver"> </span><span style="color:black">master-></span><span style="color:maroon">app_time_period</span><span style="color:black">;</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span>ecrt_master_application_time<span style="color:black">(master-></span><span style="color:maroon">master</span><span style="color:black">,</span><span style="color:silver"> </span><span style="color:black">master-></span><span style="color:maroon">app_time</span><span style="color:black">);</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">sync</span><span style="color:silver"> </span><span style="color:green">ref</span><span style="color:silver"> </span><span style="color:green">clock</span><span style="color:silver"> </span><span style="color:green">to</span><span style="color:silver"> </span><span style="color:green">master</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:olive">if</span><span style="color:silver"> </span><span style="color:black">(master-></span><span style="color:maroon">sync_ref_cycles</span><span style="color:silver"> </span><span style="color:black">></span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">)</span><span style="color:silver"> </span><span style="color:black">{</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:olive">if</span><span style="color:silver"> </span><span style="color:black">(master-></span><span style="color:maroon">sync_ref_cnt</span><span style="color:silver"> </span><span style="color:black">==</span><span style="color:silver"> </span><span style="color:navy">0</span><span style="color:black">)</span><span style="color:silver"> </span><span style="color:black">{</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:black">master-></span><span style="color:maroon">sync_ref_cnt</span><span style="color:silver"> </span><span style="color:black">=</span><span style="color:silver"> </span><span style="color:black">master-></span><span style="color:maroon">sync_ref_cycles</span><span style="color:black">;</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span>ecrt_master_sync_reference_clock<span style="color:black">(master-></span><span style="color:maroon">master</span><span style="color:black">);</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:black">}</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:black">master-></span><span style="color:maroon">sync_ref_cnt</span><span style="color:black">--;</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:black">}</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">sync</span><span style="color:silver"> </span><span style="color:green">slaves</span><span style="color:silver"> </span><span style="color:green">to</span><span style="color:silver"> </span><span style="color:green">ref</span><span style="color:silver"> </span><span style="color:green">clock</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span>ecrt_master_sync_slave_clocks<span style="color:black">(master-></span><span style="color:maroon">master</span><span style="color:black">);</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><span style="color:green">//</span><span style="color:silver"> </span><span style="color:green">send</span><span style="color:silver"> </span><span style="color:green">domain</span><span style="color:silver"> </span><span style="color:green">data</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span>ecrt_domain_queue<span style="color:black">(master-></span><span style="color:maroon">domain</span><span style="color:black">);</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span>ecrt_master_send<span style="color:black">(master-></span><span style="color:maroon">master</span><span style="color:black">);</span><o:p></o:p></pre>
<pre><span style="color:silver"> </span><o:p></o:p></pre>
<p class="MsoNormal">As follow <<u><span style="color:blue"><a href="http://lists.etherlab.org/pipermail/etherlab-users/2014/002461.html">http://lists.etherlab.org/pipermail/etherlab-users/2014/002461.html</a></span></u>>, I have to use
<o:p></o:p></p>
<pre style="margin-bottom:12.0pt">ecrt_master_reference_clock_time()instead of ecrt_master_sync_reference_clock<span style="color:black">(master-></span><span style="color:maroon">master</span><span style="color:black">).</span><o:p></o:p></pre>
<pre style="margin-bottom:12.0pt"><span style="color:black">Sorry, I am totally lost here. And should select slave as reference clock outside loop?</span><o:p></o:p></pre>
<pre><span style="color:black">Thanks!</span><o:p></o:p></pre>
<pre><span style="color:black">-chengxi</span><o:p></o:p></pre>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Fri, Aug 29, 2014 at 11:52 AM, <span style="font-family:MingLiU">
陈成细</span> <<a href="mailto:crazyintermilan@gmail.com" target="_blank">crazyintermilan@gmail.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Dear Graeme,<o:p></o:p></p>
</div>
<p class="MsoNormal">Thank you for your reply, it is really helpful.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">My whole system only one set yaskawa servopack and motor, maybe i have to read out cycle time of servopack , and set twincat the same cycle time.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Since i bought second hand yaskawa SGDV servopack, i just want use twincat to confirm that my servopack can work well and to configure .xml.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">It seems quite headache, i will try to fix it anyway.<o:p></o:p></p>
</div>
<p class="MsoNormal">Best regards!<o:p></o:p></p>
</div>
<p class="MsoNormal">Chengxi<o:p></o:p></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Fri, Aug 29, 2014 at 8:25 AM, Graeme Foot <<a href="mailto:Graeme.Foot@touchcut.com" target="_blank">Graeme.Foot@touchcut.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy">Hi,</span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy"> </span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy">I've never tried using TwinCAT with the SGDV drives. The drives are quite unforgiving if
your master cycle is a bit out of sync or has reasonable jitter, so the only way I got mine to be happy was to use a slave as the distributed clock master and I sync the EtherCAT master to that. I believe this is also the default method for TwinCAT but there
is possibly some setup required to tell it which slave should be the DC master and also which slave should then also be running in DC mode.</span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy"> </span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy">My DC clock master slave is generally an EL1008 module, but only because this is the first
slave we have that supports it. From memory we used to use a EK1100 coupler but I think I recall having some issues where it wasn't stable enough for some reason.</span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy"> </span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy">The main thing is to always maintain consistent and as much as possible jitter free communications.
I'm not sure how to do that with TwinCAT.</span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy"> </span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy"> </span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy">Regards,</span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy">Graeme.</span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:navy"> </span><span lang="EN-GB"><o:p></o:p></span></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US">
<hr size="2" width="100%" align="center">
</span></div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">
</span><span style="font-size:10.0pt;font-family:MingLiU">陈成细</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> [mailto:<a href="mailto:crazyintermilan@gmail.com" target="_blank">crazyintermilan@gmail.com</a>]
<br>
<b>Sent:</b> Thursday, 28 August 2014 14:07<br>
<b>To:</b> Graeme Foot<br>
<b>Subject:</b> Twincat communicate with yaskawa SGDV alarm A12 (Sync Error)</span><span lang="EN-GB"><o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> <o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Dear Graeme,<br>
<br>
Currently i am trying to connect twincat with yaskawa SGDV driver, I meet CoE- Emergency then synchronization error. After I search from website, luckily i read your posts (<a href="http://article.gmane.org/gmane.network.etherlab.user/1378/match=" target="_blank">http://article.gmane.org/gmane.network.etherlab.user/1378/match=</a>
). <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span lang="EN-GB"><br>
Since i am just start to learn ethercat as a hobby, first step i use tool TwinCat to communicate with SGDV driver follow the manual(<a href="https://www.google.com.sg/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0CCMQFjAB&url=https%3A%2F%2Fwww.yaskawa.com%2Fpycprd%2Flookup%2Fgetdocument%2FjvgyvE5ZTUY_5CC1znzBof23DM0-2qtf20mzhvc2NVVttd_tKgqgkH4jzlPaKN9jwUZxdmOOXgfix7X3yhLYM72qJQdo3XppBhywnUPr1Oy7mtRZ76i_VGFJpKtk9N9SimCMNzyqbNZCaOJGSoV4BG4Gs6GA9Tys&ei=JY3-U9rQJI6UauyUgJAO&usg=AFQjCNHSkmEEGvsiw09L8yuCE1L46XrLEQ&bvm=bv.74035653,d.d2s" target="_blank">https://www.google.com.sg/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0CCMQFjAB&url=https%3A%2F%2Fwww.yaskawa.com%2Fpycprd%2Flookup%2Fgetdocument%2FjvgyvE5ZTUY_5CC1znzBof23DM0-2qtf20mzhvc2NVVttd_tKgqgkH4jzlPaKN9jwUZxdmOOXgfix7X3yhLYM72qJQdo3XppBhywnUPr1Oy7mtRZ76i_VGFJpKtk9N9SimCMNzyqbNZCaOJGSoV4BG4Gs6GA9Tys&ei=JY3-U9rQJI6UauyUgJAO&usg=AFQjCNHSkmEEGvsiw09L8yuCE1L46XrLEQ&bvm=bv.74035653,d.d2s</a>)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">After i read your posts, i think maybe the problems are as follow:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">1. SGDV parameter setting( since i reset all parameter to factory setting)?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">2. Sync mode slection?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">3. Twincat cycle time setting?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span lang="EN-GB">4. Laptop CPU calibrate?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"><span lang="EN-GB">I am appreciated if you can give any hint to help me solve this error. Next step i would like build the communicate by etherlab master under linux xenomai. There still
quite a long way to go.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Thanks!<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">--
<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Best regards!<br>
</span><span style="font-family:MingLiU">陈成细</span><span lang="EN-GB"><br>
R&D Engineer<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB" style="font-size:13.5pt;font-family:"Helvetica","sans-serif"">(\__/)<br>
(='.'=) This is Bunny. Copy and paste bunny into your<br>
(")_(") signature to help him gain world domination.</span><span lang="EN-GB"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <o:p></o:p></p>
<div>
<p class="MsoNormal">Best regards!<br>
<span style="font-family:MingLiU">陈成细</span><br>
R&D Engineer<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif"">(\__/)<br>
(='.'=) This is Bunny. Copy and paste bunny into your<br>
(")_(") signature to help him gain world domination.</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">Best regards!<br>
<span style="font-family:MingLiU">陈成细</span><br>
R&D Engineer<o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif"">(\__/)<br>
(='.'=) This is Bunny. Copy and paste bunny into your<br>
(")_(") signature to help him gain world domination.</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>