<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)">
<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;}
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.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.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">The DC flow
</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">from the post below</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> is an old version</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">,
back in the days when RTDM was first being added to the master</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">. I no longer need the separate thread to activate the master.<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 use a slave as a reference clock, adjusting the PC’s cycle to match. I haven’t used Xenomai or RT-PREMPT</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">
but they should only need something similar to </span><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">rt_sleep_until()</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">My current DC flow 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:#1F497D">configure master<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_request_master<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_create_domain (x3)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">configure slaves (pdos / sdos / dc)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_get_slave // get slave info and check it matches the expected device and revision<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_slave_config<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_slave_config_pdos<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_slave_config_create_sdo_request // I create one general usage SDO per module<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_slave_config_reg_pdo_entry // one call per pdo entry<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_slave_config_sdo8 etc // configuration entries<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_slave_config_dc // for dc slaves<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">prepare to run<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_setup_domain_memory // pre-setup domain memory (via one of my patches)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> per domain:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_domain_data // get domain data address<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_domain_size // get domain data size<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> allocate memory x2 // for a mask and a cache<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> per module:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> calculate/cache pdo data addresses<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> set initial module data/control values<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> set up dc clocks:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_application_time // set initial app time (must be in phase with realtime cycle)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_select_reference_clock // select slave to use as reference clock<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_activate<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">start realtime cycle (I use RTAI)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> rt_thread_init<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> rt_set_oneshot_mode<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> rt_allow_nonroot_hrt<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> mlockall<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> calc first wake time (in phase with initial ecrt_master_application_time call)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> start_rt_timer<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> rt_make_hard_real_time<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">realtime cycle<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_receive<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_domain_process x3<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_domain_state // check WC / state of domains<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_state // check state of master<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> see if any modules want to write “special” data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> write cached domain data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_domain_queue x3<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> sync distributed clock // as close to ecrt_master_send as possible<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_reference_clock_time // calc diff between expected slave time and actual, after first realtime scan<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_sync_slave_clocks<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_application_time<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_send<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> calc slave to master time drift and adjust master clock and cycle period to match<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> see if any modules want to reset “special” data or calc extra data (eg Actual Velocity)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> perform application logic.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> note: any data to be written to the domain memory is actually written to the domain cache and mask<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> run device logic (eg axis enable / disable logic)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> wait for remainder of cycle<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> rt_sleep_until<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">stop realtime cycle (called before wait for remainder of cycle if app is flagged to shutdown)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> (while continuing realtime cycle)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> tell modules to prepare to stop, ie stop and disable axes nicely etc<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> once safe:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_deactivate_slaves // from one of my patches, it stops a few shutdown errors<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> (continue cycling until the rest of the app is ready to shutdown also)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">and stop<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> rt_make_soft_real_time<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> stop_rt_timer<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> rt_task_delete<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_master_deactivate<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> ecrt_release_master<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D"> free domain cache/mask memory<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New";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">The call to
</span><span style="font-size:11.0pt;font-family:"Courier New";color:#1F497D">ecrt_master_reference_clock_time()</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> is what gives us the reference slave clock time. We compare
this to our expected time and the difference is the slaves drift compared to the master PC. I cache a running history of these to calc an average drift to figure out my base cycle time in terms of the PC clock. I also gradually adjust the cycle time as required
to keep the slave and master periods in sync.<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">The application time needs to be the master PC’s time adjusted by the overall drift with the reference slaves clock.<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>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">As for the Working counter changed messages I’m not really sure. Check the cable between the last two modules is good / try a new cable maybe.<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">Regards,<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, 25 March 2016 1:16 a.m.<br>
<b>To:</b> Graeme Foot<br>
<b>Subject:</b> Distribute Clock new flow<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Dear Graeme,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks a lot for your help during last two years .<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Now i can run yaskawa driver and motor with ethercat. However sometimes it will run into sync error, I am not aware the problem until i bought another secondhand Omron driver . I decided to solve this DC issue from the root, so I carefully
go through all the threads from mailing list which related to DC many times.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Of course your thread(<a href="http://thread.gmane.org/gmane.network.etherlab.user/1335/focus=1349">http://thread.gmane.org/gmane.network.etherlab.user/1335/focus=1349</a>) is from A-Z to solve this issue. I would like to use the same method
to solve my problem, but I have following questions:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">1. your DC flow:<o:p></o:p></p>
</div>
<pre><span style="color:black">configure master<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_request_master<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_master_create_domain<o:p></o:p></span></pre>
<pre><span style="color:black">configure slaves (pdos / sdos / dc)<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_master_slave_config<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_slave_config_pdos<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_slave_config_reg_pdo_entry<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_slave_config_sdo8<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_slave_config_dc<o:p></o:p></span></pre>
<pre><span style="color:black">connect to rtdm<o:p></o:p></span></pre>
<pre><span style="color:black"> rt_dev_open(rtdm)<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_domain_index<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_master_attach<o:p></o:p></span></pre>
<pre><span style="color:black">setup domain memory<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_master_setup_domain_memory<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_domain_data<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_domain_size<o:p></o:p></span></pre>
<pre><span style="color:black"><o:p> </o:p></span></pre>
<pre><span style="color:black">create master_activate thread -------+<o:p></o:p></span></pre>
<pre><span style="color:black"> |<o:p></o:p></span></pre>
<pre><span style="color:black">start realtime |<o:p></o:p></span></pre>
<pre><span style="color:black"> request master_activate --> | ecrt_master_activate<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_master_recieve | (after first sync dc)<o:p></o:p></span></pre>
<pre><span style="color:black"> sync dc |<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_master_send |<o:p></o:p></span></pre>
<pre><span style="color:black"> <-- | master activated<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_master_recieve |<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_domain_process_all |<o:p></o:p></span></pre>
<pre><span style="color:black"> check domain state |<o:p></o:p></span></pre>
<pre><span style="color:black"> check master state |<o:p></o:p></span></pre>
<pre><span style="color:black"> update domain data |<o:p></o:p></span></pre>
<pre><span style="color:black"> sync dc |<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_domain_queue_all |<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_master_send |<o:p></o:p></span></pre>
<pre><span style="color:black"> |<o:p></o:p></span></pre>
<pre><span style="color:black"> request master deactivate --> | ecrt_master_deactivate_slaves<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_master_recieve | (wait for PREOP or 5s)<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_domain_process_all |<o:p></o:p></span></pre>
<pre><span style="color:black"> check domain state |<o:p></o:p></span></pre>
<pre><span style="color:black"> check master state |<o:p></o:p></span></pre>
<pre><span style="color:black"> update domain data |<o:p></o:p></span></pre>
<pre><span style="color:black"> sync dc |<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_domain_queue_all |<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_master_send |<o:p></o:p></span></pre>
<pre><span style="color:black"> <-- | master deactivating<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_master_recieve | ecrt_master_deactivate<o:p></o:p></span></pre>
<pre><span style="color:black"> sync dc |<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_rtdm_master_send |<o:p></o:p></span></pre>
<pre><span style="color:black"> <-- | master deactivated<o:p></o:p></span></pre>
<pre><span style="color:black">stop realtime |<o:p></o:p></span></pre>
<pre><span style="color:black">stop master_activate thread +<o:p></o:p></span></pre>
<pre><span style="color:black"><o:p> </o:p></span></pre>
<pre><span style="color:black">cleanup<o:p></o:p></span></pre>
<pre><span style="color:black"> rt_dev_close(rtdm)<o:p></o:p></span></pre>
<pre><span style="color:black"> ecrt_release_master<o:p></o:p></span></pre>
<div>
<div>
<pre><span style="color:black"><o:p> </o:p></span></pre>
<pre><span style="color:black">There is a master_activate thread, can I do it in the same real time thread?<o:p></o:p></span></pre>
<pre><span style="color:black">But it seems you denied your previous conclusion in this thread(<a href="http://thread.gmane.org/gmane.network.etherlab.user/1412/focus=1416">http://thread.gmane.org/gmane.network.etherlab.user/1412/focus=1416</a>).</span><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><span style="color:black">I'm using RTAI but I was not calibrating my cpu-frequency. By default Linux only calibrates the cpu-freq to<o:p></o:p></span></pre>
<pre><span style="color:black">the PIT timer to an accuracy of 500 parts per million. So each time I rebooted I could get quite varied<o:p></o:p></span></pre>
<pre><span style="color:black">cpu-freq values.<o:p></o:p></span></pre>
<pre><span style="color:black"><o:p> </o:p></span></pre>
<pre><span style="color:black">When they were outside a good operating range I would often get:<o:p></o:p></span></pre>
<pre><span style="color:black"> EtherCAT WARNING 0-9: Slave did not sync after 5001 ms.<o:p></o:p></span></pre>
<pre><span style="color:black"><o:p> </o:p></span></pre>
<pre><span style="color:black">And sometimes get:<o:p></o:p></span></pre>
<pre><span style="color:black"> EtherCAT DEBUG 0-9: OP -> SAFEOP + ERROR.<o:p></o:p></span></pre>
<pre><span style="color:black"> EtherCAT ERROR 0-9: AL status message 0x001A: "Synchronization error".<o:p></o:p></span></pre>
<pre><span style="color:black"><o:p> </o:p></span></pre>
<pre><span style="color:black">The drive would then report an error code of 0x0A12 (sync error).<o:p></o:p></span></pre>
<pre><span style="color:black"><o:p> </o:p></span></pre>
<pre><span style="color:black">When I changed my code to start cycling the pdo information and the dc information before calling<o:p></o:p></span></pre>
<pre><span style="color:black">ecrt_master_activate() the problem pretty much went away. But I would often still get the odd sync error<o:p></o:p></span></pre>
<pre><span style="color:black">at some later stage.<o:p></o:p></span></pre>
<pre><span style="color:black"><o:p> </o:p></span></pre>
<pre><span style="color:black">Now after calibrating my cpu-freq value, doing a lot of other stuff and generally gathering more knowledge<o:p></o:p></span></pre>
<pre><span style="color:black">I see the original diagnosis was wrong. All that was happening was that the drives could not stay synced if<o:p></o:p></span></pre>
<pre><span style="color:black">the masters time cycle was too fast or too slow. Starting to cycle the dc information sooner seemed to help<o:p></o:p></span></pre>
<pre><span style="color:black">them stabilise better on startup but they would still sometimes loose sync at a later stage anyway.<o:p></o:p></span></pre>
<pre><span style="color:black"><o:p> </o:p></span></pre>
<pre><span style="color:black">(Note: I'm setting my calibrated cpu-freq by using the "rtai_cpufreq_arg" when calling insmod on rtai_hal.ko.)<o:p></o:p></span></pre>
</blockquote>
<div>
<p class="MsoNormal"> How can I check my cpu-freq and define whether it get issue or not?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> May I have a little bit detail how to calibrate it in your case? <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">And how about RT-PREMPT or Xenomai?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">By the way, I already use the lastest patches from Jun Yuan(<a href="http://lists.etherlab.org/pipermail/etherlab-users/2016/002922.html">http://lists.etherlab.org/pipermail/etherlab-users/2016/002922.html</a>)<o:p></o:p></p>
</div>
<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 style="white-space:pre-wrap"><span style="color:black">hg clone <a href="http://hg.code.sf.net/u/mensch88/etherlabmaster">http://hg.code.sf.net/u/mensch88/etherlabmaster</a> -r rtleaders<o:p></o:p></span></pre>
<pre><span style="color:black">etherlab-dev<o:p></o:p></span></pre>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">2 My issue is omron driver keep changing working counter like:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> [10353.644769] EtherCAT 0: Domain 2: Working counter changed to 2/3.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> [10354.652702] EtherCAT 0: Domain 2: Working counter changed to 3/3.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> [ 10358.496736] EtherCAT 0: Domain 2: Working counter changed to 2/3.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> [10359.504699] EtherCAT 0: Domain 2: Working counter changed to 3/3.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> Do you have any experience about it? detail Dmesg file attached.<o:p></o:p></p>
</div>
<pre><o:p> </o:p></pre>
<pre><span style="color:black">I am so sorry drop you so long email. I am appreciated that you can give any hints to help me solve this nightmare issue.</span><o:p></o:p></pre>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks very much!<o:p></o:p></p>
</div>
<p class="MsoNormal">-- <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>
</body>
</html>