<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 15 (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:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"MS Gothic";
panose-1:2 11 6 9 7 2 5 8 2 4;}
@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:Aptos;}
@font-face
{font-family:"Microsoft JhengHei";
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@Microsoft JhengHei";}
@font-face
{font-family:"\@MS Gothic";
panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
p.elementtoproof, li.elementtoproof, div.elementtoproof
{mso-style-name:elementtoproof;
margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
span.EmailStyle22
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:200945993;
mso-list-template-ids:277006082;}
@list l0:level1
{mso-level-start-at:2;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l1
{mso-list-id:475418460;
mso-list-template-ids:-1638388504;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l2
{mso-list-id:507408760;
mso-list-template-ids:-1031929360;}
@list l2:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l2:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l3
{mso-list-id:666713911;
mso-list-template-ids:-455323392;}
@list l3:level1
{mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l3:level2
{mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l3:level3
{mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l3:level4
{mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l3:level5
{mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l3:level6
{mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l3:level7
{mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l3:level8
{mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l3:level9
{mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l4
{mso-list-id:1110930052;
mso-list-template-ids:-126303306;}
@list l5
{mso-list-id:1427187007;
mso-list-template-ids:700365274;}
@list l5:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l5:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l5:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l5:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l5:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l5:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l5:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l5:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l5:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l6
{mso-list-id:1735010867;
mso-list-type:hybrid;
mso-list-template-ids:1136683180 336134145 336134147 336134149 336134145 336134147 336134149 336134145 336134147 336134149;}
@list l6:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l6:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l6:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l6:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l6:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l6:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l6:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Hi Circle,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Re #1)<o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l6 level1 lfo3"><span style="font-size:11.0pt;mso-fareast-language:EN-US">ecrt_master_application_time() stores the PC time in the master.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l6 level1 lfo3"><span style="font-size:11.0pt;mso-fareast-language:EN-US">The ref slave clock is set to the masters time (plus its transmission delay) on activation.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l6 level1 lfo3"><span style="font-size:11.0pt;mso-fareast-language:EN-US">ecrt_master_sync_slave_clocks() syncs subsequent slaves clocks to the ref slave, and returns the ref slave time.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l6 level1 lfo3"><span style="font-size:11.0pt;mso-fareast-language:EN-US">ecrt_master_reference_clock_time() gets the ref slaves time “slaveTime” (minus its transmission delay) from the previous ecrt_master_sync_slave_clocks()
call, so returns the slave time, at the time of the send, of the previous send<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l6 level1 lfo3"><span style="font-size:11.0pt;mso-fareast-language:EN-US">“ecMaster->m_dcTime” caches the time sent to ecrt_master_application_time() of the previous send<o:p></o:p></span></li></ul>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-size:11.0pt;mso-fareast-language:EN-US">So we can compare the difference between “(uint32_t)ecMaster->m_dcTime” and “slaveTime” and if there’s no drift or jitter between the master and slave
clocks we should get a value of zero. The rest of the code is attempting to filter out the jitter and calculate a drift compensation. Note: we are comparing the lower 32 bits of the times.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-size:11.0pt;mso-fareast-language:EN-US">“</span><span style="font-family:"Calibri",sans-serif;color:black">why are we using pc time - reference time to caculate m_dcDiff (m_dcTime -slaveTime,
even it's named by m_dcTime, i think it's still a term of pc time)?”:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">if there’s no drift and the ref slave clock has been set to the master clock on activation then the master and slave time should match. If there’s drift,
we need to adjust the master time to compensate. (So it is comparing the PC clock time to the slave time to figure out the drift.)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">“However time of SYNC0(0x990) is changing quite regularly”:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">if dc is enabled on the slave it is incremented by the cycle period every cycle (by the slave). If it’s a 32bit dc clock the time value rolls over every
4.2second odd, if it’s a 64bit dc clock you see the whole time value. For DC to remain synced (and enable dc sync0) it only needs a 32bit dc clock, but if you want proper timestamping of events, you need the 64bit clocks.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">“0x990 is always like xxxxxxxxxx500000 (500000 is sync0_shift), why don't we try to make slaveTime to, like 0-phase-aligned”:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">Once dc is set up sync0 0x990 on the slave just keeps ticking over based on the slaves clock. The slaves clock is synced to the ref slaves clock. Your
application can choose when sync0 occurs on the slave with respect to the cycle but has no other control over it. However your application must call ecrt_master_send() once every cycle so that the frames reach the slave before the cycles sync0 time is triggered.
Other than that you can choose when to call ecrt_master_send(). In your realtime cycle you can choose when to wake up and perform your calculations. That wakeup event it triggered in relation to the PC’s clock. So to wake up in relation to the ref slaves
clock, you need to sync your application (PC) time to the ref slaves time.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">“BTW, is the write cmd to register 0x990 only sent once at the beginning”:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">yes<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Re #2)
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">“I didn't get the "first master diff" in syslog”:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">I output all my app messages to the syslog via “rtai_lxrt(BIDX, SIZARG, PRINTK, &arg);”. Via std out is fine too.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">“And it's quite big”:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">It should be small (within max jitter or so). If it’s big to start with, it indicates the initial master time is not being set correctly in the ref slave
on master activation. If it becomes big then your drift compensation isn’t working.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">“I don't know why you are saying m_dcDiff should be around 0”:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><span style="font-family:"Calibri",sans-serif;color:black">As per above, m_dcDiff is the difference between the time master time when the frame was sent and the time at the ref slave. If the initial slave time
is set up correctly and you have no drift between the master and slave clocks (or account for the drift) then m_dcDiff should jitter around 0.</span><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Looking at your logs:<o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l6 level1 lfo3"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Your syslog logs are showing unmatched and corrupted frames. You need to sort that out first. Try contact cleaner on the
RJ45 / EBus connections. Also, try higher quality shielded twisted pair cables. You need to get it to zero comms errors.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l6 level1 lfo3"><span style="font-size:11.0pt;mso-fareast-language:EN-US">You need to get wireshark logs that include the response. You could use the “ethercat pcap” command if you have patch “features\pcap\0001-pcap-logging.patch”.
You could also install a physical switch between your master and the first slave and use another computer as the sniffer (with all protocols disabled on that devices eth port). Because EtherCAT is a broadcast frame you shouldn’t need to do anything special
with the switch.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l6 level1 lfo3"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Your crc log is a little weird. There’s no crc or physical errors, but there are a lot of forwarded errors (more than the
max count). Maybe there’s problems on the master to first slave link.<o:p></o:p></span></li></ul>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Graeme.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> </span><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"> Circle
Fang </span><a href="mailto:circlefang@live.com"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">circlefang@live.com</span></a><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">
<br>
</span><span style="font-family:"Calibri",sans-serif">> </span><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">Sent:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Saturday, 3 May 2025
20:10<br>
</span><span style="font-family:"Calibri",sans-serif">> </span><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">To:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Graeme Foot
</span><a href="mailto:Graeme.Foot@touchcut.com"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">Graeme.Foot@touchcut.com</span></a><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
</span><span style="font-family:"Calibri",sans-serif">> </span><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">Cc:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">
</span><a href="mailto:etherlab-users@etherlab.org"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">etherlab-users@etherlab.org</span></a><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
</span><span style="font-family:"Calibri",sans-serif">> </span><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">Subject:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">
</span><span style="font-size:11.0pt;font-family:"MS Gothic"">回复</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">: DC synchronization demo about etherlab master<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">></span><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
Hi Graeme,<o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
Basically I didn't figure out the following two things yet.<o:p></o:p></span></span></p>
</div>
<div>
<ol start="1" type="1">
<li class="MsoNormal" style="color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l3 level1 lfo6">
<span style="font-family:"Calibri",sans-serif">why are we using pc time - reference time to caculate m_dcDiff (m_dcTime -slaveTime, even it's named by m_dcTime, i think it's still a term of pc time)? I think they could drift together, like both delayed for
hundreds of microseconds, since reference time(slaveTime) is strong-related to pc time of ecrt_master_send (get m_dcTime then call ecrt_master_send). However time of SYNC0(0x990) is changing quite regularlly. so in this way even m_dcDiff is small enough,
dc sync error may still occurs becuase both m_dcTime and slaveTime may go beyond the time of 0x990. And I'm wondering why not try to sync master time to SYNC0 (probably with a sync0_shift interval). In my test, when i watch the 64bit of 0x990, it is just sync0_shift-phase-aligned,
I mean 0x990 is always like xxxxxxxxxx500000 (500000 is sync0_shift), why don't we try to make slaveTime to, like 0-phase-aligned(it could be a little complicated since slaveTime is 32-bit, and i still don't figure out how to do this yet, maybe change ecrt_master_reference_clock_time
to 64-bit), which means time of ecrt_master_send and both slaveTime is always drifting around 0-phase of SYNC0/0x990(I mean make 64-bit slaveTime always xxxxxxxxxabcdef wherein abcdef is around 0). BTW, is the write cmd to register 0x990 only sent once at
the beginning?<o:p></o:p></span></li></ol>
</div>
<div>
<ol start="2" type="1">
<li class="MsoNormal" style="color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l3 level1 lfo6">
<span style="font-family:"Calibri",sans-serif">I didn't get the "first master diff" in syslog, but I do get this from the cmd line which I run the application. And it's quite big. I am not clear about this but I think this is OK. Since the 0-phase-aligned m_dcTimeStart
passed into ecrt_master_application_time at the beginning is used to caculate the real dc start time(which written to 0x990) about 100cycles beyond in the future (EC_DC_START_OFFSET=100ms, eventually with sync0_shift phase-aligned), and our first wakeup time
is 50 cycles in the future, even it's 0-phase-aligned. I don't know why you are saying m_dcDiff should be around 0. <o:p></o:p></span></li></ol>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">><span style="color:black"><o:p> </o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
I did 2 test, the first one is using your way, and the second is using my way(i don't know it's right or not, but m_dcDiff is always drifting around 0). please see attched logs. As for wireshark logs, only frames sent from master are captured. In those test,
no motion task, only check the recived datagrams, adjust pc time, and send pdos, so the task is quite light-weight, and MSW(mode switch of xenomai) is always 0. However, from wireshark, sending time is getting odd occasionaly. one more earlier test (not recorded)
is quite stable, as it's running for 24 hours without any errors, even motion task is running.<o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">><span style="color:black"><o:p> </o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
The error of "Failed to get reference clock time" is something like resource un-available, because i called this even for the first time (no datagram received yet). sometimes in the middle of test for a short time, but no dc sync error occurs. And it's not
easy to reproduce.<o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">><span style="color:black"><o:p> </o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
In addition, SMI, power-saving, and a lot of other features that may affect realtime task, are disabled. fixed cpu frequency is also set. and /proc/xenomai/stat is ok(no MSW).<o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">><span style="color:black"><o:p> </o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
It seems my problem has nothing to do with problems by dc patches as mentioned before, since i don't see the difference before/after patches applied. <o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">><span style="color:black"><o:p> </o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
I am sorry this cost you so much time, and I am really really grateful about this.<o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">><span style="color:black"><o:p> </o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
Best Regards,<o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
Circle <o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">><span style="color:black"><o:p> </o:p></span></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black">发件人</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Graeme
Foot <</span><a href="mailto:Graeme.Foot@touchcut.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Graeme.Foot@touchcut.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black">发送时间</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> 2025</span><span style="font-size:11.0pt;font-family:"MS Gothic";color:black">年</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">5</span><span style="font-size:11.0pt;font-family:"MS Gothic";color:black">月</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">2</span><span style="font-size:11.0pt;font-family:"MS Gothic";color:black">日</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">
4:21<br>
</span><b><span style="font-size:11.0pt;font-family:"MS Gothic";color:black">收件人</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Circle
Fang <</span><a href="mailto:circlefang@live.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">circlefang@live.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">><br>
</span><b><span style="font-size:11.0pt;font-family:"MS Gothic";color:black">抄送</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> </span><a href="mailto:etherlab-users@etherlab.org"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">etherlab-users@etherlab.org</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">
<</span><a href="mailto:etherlab-users@etherlab.org"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">etherlab-users@etherlab.org</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">><br>
</span><b><span style="font-size:11.0pt;font-family:"MS Gothic";color:black">主</span></b><b><span style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black">题</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> RE:
DC synchronization demo about etherlab master<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<p><span style="font-size:11.0pt">Hi Circle,</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p class="elementtoproof"><span style="font-size:11.0pt">m_dcDiff should jitter around zero. The previous slave time to current slave time should jitter around your period (e.g. 1ms). The PC clock total adjustment should drift by an approximate constant amount
over time. It can drift at slightly slower or faster rates over time due to electronics issues (such as thermal changes etc.)</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">The master needs to account for the time drift between the ref slave and PC clock so that it interacts with the fieldbus in the fieldbuses timeframe. Looking at 0x92C of subsequent slaves won’t help as that is their syncing
to the ref slave. We are dealing with the master syncing to the ref slave.</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">If you enable “ethercat debug 1” and start your app you should see in the logging (where main-1 is the ref slave number):</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoNormal" style="mso-list:l1 level1 lfo10"><span style="font-size:11.0pt">Using slave main-1 as DC reference clock</span><span style="font-family:SimSun"><o:p></o:p></span></li><li class="MsoNormal" style="mso-list:l1 level1 lfo10"><span style="font-size:11.0pt">DEBUG 0-main-1: Checking system time offset.</span><span style="font-family:SimSun"><o:p></o:p></span></li><li class="MsoNormal" style="mso-list:l1 level1 lfo10"><span style="font-size:11.0pt">DEBUG 0-main-1: DC 64 bit system time offset calculation: system_time=50278625750, app_time=42973023400, diff=-7305602350</span><span style="font-family:SimSun"><o:p></o:p></span></li><li class="MsoNormal" style="mso-list:l1 level1 lfo10"><span style="font-size:11.0pt">DEBUG 0-main-1: Setting time offset to 18446744066403949266 (was 0)</span><span style="font-family:SimSun"><o:p></o:p></span></li><li class="MsoNormal" style="mso-list:l1 level1 lfo10"><span style="font-size:11.0pt">first master diff: -609.</span><span style="font-family:SimSun"><o:p></o:p></span></li></ul>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">The first master diff should be quite small (within the jitter range).</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p class="elementtoproof"><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p class="elementtoproof"><span style="font-size:11.0pt">You shouldn’t be getting any "Failed to get reference clock time" messages. What is the error number that is output with it?</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">I’m starting to think you may be getting comms errors or something. Can you send the kernel log messages (e.g. dmesg / journalctrl -k) (with “ethercat debug 1” set before startup) and maybe the wireshark logs.</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p class="elementtoproof"><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">Check for comms error using the “ethercat crc” command, check for unmatched datagram errors in the system logs and potentially check the wireshark logs for mismatched frames around the time of your errors.</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">Also check that you have the CPU speed stepping (dynamic frequency scaling) turned off in the kernel configuration options. That can cause problems with the timestamp clock.</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">If you have an intel CPU you may need to disable the SMI interrupt.</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">Also, what are the Yaskawa sync errors you are getting? Are the A12 errors? If so these generally only occur (by default) after three missed PDO’s in a row. You don’t generally get those alarms when you are just having drifting
errors. Check the wireshark logs around the time of the error and check the reference clock times to see when the master is sending the frames.</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p class="elementtoproof"><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">Under RTAI you need to have the RTDM interface enabled to allow realtime calls from the user space into the masters kernel space. RTAI will allow you to make non-realtime syscalls, but you will lose hard realtime while the
syscall is occurring. You can check for any lost hard realtime events using the “/cat /proc/rtai/scheduler” command. I don’t know what the equivalent in Xenomi is.</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">Regards,</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt">Graeme.</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-size:11.0pt"> </span><span style="font-family:SimSun"><o:p></o:p></span></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p><span style="font-family:"Calibri",sans-serif">> </span><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Circle Fang
</span><a href="mailto:circlefang@live.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">circlefang@live.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
</span><span style="font-family:"Calibri",sans-serif">> </span><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Sent:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Friday, 2 May 2025 05:33<br>
</span><span style="font-family:"Calibri",sans-serif">> </span><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">To:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Graeme Foot
</span><a href="mailto:Graeme.Foot@touchcut.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Graeme.Foot@touchcut.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
</span><span style="font-family:"Calibri",sans-serif">> </span><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Cc:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
</span><a href="mailto:etherlab-users@etherlab.org"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">etherlab-users@etherlab.org</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><br>
</span><span style="font-family:"Calibri",sans-serif">> </span><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Subject:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
</span><span style="font-size:11.0pt;font-family:SimSun">回复</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">: DC synchronization demo about etherlab master</span><span style="font-family:SimSun"><o:p></o:p></span></p>
</div>
<p><span style="font-family:"Calibri",sans-serif">></span><span style="font-family:SimSun"> <o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Hi Graeme,</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">><span style="color:black"> </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">I think I was wrong about option a and b. I should compare reference clock time "<i>slaveTime</i>" with ideal values( i.e., initial slaveTime + cycle_counters*cycle_ns); And if that
difference soon converges to 0, rather than some big weird values for several consecutive cycles (bigger than "<i>sync error limit"</i> threshold in slave) occasionaly . that will prove master is well synced to reference, right?</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">><span style="color:black"> </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">I should continue on this bug.</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">><span style="color:black"> </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">How do u_appTimeBase and m_dcDiff change in your app? is there any patterns? </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">><span style="color:black"> </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Many thanks again for your help.</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Best Regards,</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Circle</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">><span style="color:black"> </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">></span><span style="font-family:SimSun"><o:p> </o:p></span></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p><span style="font-family:"Calibri",sans-serif">></span><b><span style="font-size:11.0pt;font-family:SimSun;color:black">发件人</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Circle
Fang <</span><a href="mailto:circlefang@live.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">circlefang@live.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">><br>
</span><span style="font-family:"Calibri",sans-serif">></span><b><span style="font-size:11.0pt;font-family:SimSun;color:black">发送时间</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> 2025</span><span style="font-size:11.0pt;font-family:SimSun;color:black">年</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">5</span><span style="font-size:11.0pt;font-family:SimSun;color:black">月</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">1</span><span style="font-size:11.0pt;font-family:SimSun;color:black">日</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> 16:22<br>
</span><span style="font-family:"Calibri",sans-serif">></span><b><span style="font-size:11.0pt;font-family:SimSun;color:black">收件人</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Graeme
Foot <</span><a href="mailto:Graeme.Foot@touchcut.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Graeme.Foot@touchcut.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">><br>
</span><span style="font-family:"Calibri",sans-serif">></span><b><span style="font-size:11.0pt;font-family:SimSun;color:black">抄送</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> </span><a href="mailto:etherlab-users@etherlab.org"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">etherlab-users@etherlab.org</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> <</span><a href="mailto:etherlab-users@etherlab.org"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">etherlab-users@etherlab.org</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">><br>
</span><span style="font-family:"Calibri",sans-serif">></span><b><span style="font-size:11.0pt;font-family:SimSun;color:black">主题</span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> </span><span style="font-size:11.0pt;font-family:SimSun;color:black">回复</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:
DC synchronization demo about etherlab master</span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">></span><span style="font-family:SimSun"> <o:p></o:p></span></p>
</div>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Hi Graeme,</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">><span style="color:black"> </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Where and what value should I monitor if I want to check if my master is well synchronized to reference slave or not? I think that value should eventually converges to 0 soon (or
maybe some constant value). I used the following 2 options:</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Option a: Initially, I monitor the reference's slaveTime - prev_slaveTime, and it converges to 1000000, meanwhile the jitter of this value is about +- 20 us. I thought this should
prove that the master is well synced to reference, since it implies that time of ecrt_master_send is well aligned, but dc sync error still occurs occasionally when app running for several hours.</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Option b: Then I start to monitor m_dcDiff in ecMaster_syncDistClock(since first m_dcDiff is probably several milliseconds which i don't know why, marked as "fixed", so my m_dcDiff
formula is m_dcDiff = (uint32_t)ecMaster->m_dcTime - slaveTime - fixed), and soon eventually it also converges to 0, meanwhile the jitter of m_dcDiff is about several microseconds.</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">And I think Option a and b is essentially same. Can I use these values to check synchronization, like 0x92c in other slaves(BTW, 0x92x is no more than 30 nanoseconds usually).</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">><span style="color:black"> </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Sometimes I got error from master, "Failed to get reference clock time", even no dc sync error occurs meanwhile.</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">><span style="color:black"> </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">At last, when I monitor u_appTimeBase, I can see it's increasing(or decreasing) monotonically, like, eventually 1 second per day. Is this normal? ( J1900 cpu and xenomai).</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">><span style="color:black"> </span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Any ideas/advices are highly appreciated.</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Best Regards,</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif">> <span style="color:black">Circle</span></span><span style="font-family:SimSun"><o:p></o:p></span></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
</div>
</body>
</html>