<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:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Microsoft JhengHei";
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@MS Gothic";
        panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
        {font-family:"\@Microsoft JhengHei";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:12.0pt;
        font-family:SimSun;
        mso-fareast-language:ZH-CN;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
p.elementtoproof, li.elementtoproof, div.elementtoproof
        {mso-style-name:elementtoproof;
        margin:0cm;
        font-size:12.0pt;
        font-family:SimSun;
        mso-fareast-language:ZH-CN;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        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:210505629;
        mso-list-template-ids:1053971808;}
@list l0: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 l0: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 l0: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 l0: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 l0: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 l0: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 l0: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 l0: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 l0: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 l1
        {mso-list-id:520700572;
        mso-list-template-ids:1528224738;}
@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:771323426;
        mso-list-template-ids:-1922632404;}
@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: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 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:Wingdings;}
@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:Wingdings;}
@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:Wingdings;}
@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:Wingdings;}
@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:Wingdings;}
@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:Wingdings;}
@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:Wingdings;}
@list l3
        {mso-list-id:956910700;
        mso-list-template-ids:928943502;}
@list l3:level1
        {mso-level-start-at:2;
        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:1216314454;
        mso-list-template-ids:1887069168;}
@list l4: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 l4: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 l4: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 l4: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 l4: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 l4: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 l4: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 l4: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 l4: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 l5
        {mso-list-id:1563296682;
        mso-list-template-ids:1941579092;}
@list l5:level1
        {mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l5:level2
        {mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l5:level3
        {mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l5:level4
        {mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l5:level5
        {mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l5:level6
        {mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l5:level7
        {mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l5:level8
        {mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l5:level9
        {mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l6
        {mso-list-id:1929656007;
        mso-list-template-ids:1303662244;}
@list l6:level1
        {mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l6:level2
        {mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l6:level3
        {mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l6:level4
        {mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l6:level5
        {mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l6:level6
        {mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l6:level7
        {mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l6:level8
        {mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l6:level9
        {mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l7
        {mso-list-id:2032828386;
        mso-list-template-ids:-1064010166;}
@list l7:level1
        {mso-level-start-at:3;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l7:level2
        {mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l7:level3
        {mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l7:level4
        {mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l7:level5
        {mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l7:level6
        {mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l7:level7
        {mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l7:level8
        {mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l7:level9
        {mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
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">
<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"> Monday, 28 April 2025
 17:36<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 lang="ZH-CN" style="font-size:11.0pt">回复</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">
Thanks again for the fast reply.<o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
My problem now is the first m_dcDiff value is about several milliseonds, and u_appTimeBase are increasing fast and monotonically, this raise the dc problem.<o:p></o:p></span></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">> <span style="color:black">
As I understand, the master->app_start_time is for caculate the offset, so the local system time in reference slave should be same (at least not much different) as master->app_time, and so it is when first go into hard realtime. it's unexpected that the first
 several cycles there is a huge m_dcDiff value, and the u_appTimeBase should be changed very slowly as PC ticks could drift so much compared with reference clock ticks. Do you know why?<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 really appreciate your mails,<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"><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"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">Hi Circle,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">I use the GavinL patchset.  There are various distributed clock fixes and helpers.  One of them from memory fixes the calculation for the initial dc time.  I’m also running a
 few versions behind on the master (HG repo, rev 2679), so I’m not up to date with what patches have been integrated into the recent master source code.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">Graeme.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></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 lang="ZH-CN" style="font-size:11.0pt;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><b><span lang="ZH-CN" style="font-size:11.0pt;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 lang="ZH-CN" style="font-size:11.0pt;color:black">年</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">4</span><span lang="ZH-CN" style="font-size:11.0pt;color:black">月</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">28</span><span lang="ZH-CN" style="font-size:11.0pt;color:black">日</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">
 0:15<br>
</span><b><span lang="ZH-CN" style="font-size:11.0pt;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 lang="ZH-CN" style="font-size:11.0pt;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 lang="ZH-CN" style="font-size:11.0pt;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</span> <o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<p><span style="font-size:11.0pt">Hi Circle,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">Please see below:</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">Graeme.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p><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>
<b>> Sent:</b> Sunday, 27 April 2025 20:50<br>
<b>> To:</b> 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>
<b>> Cc:</b> </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>
<b>> Subject:</b> </span><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";mso-fareast-language:ZH-CN">回复</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">: DC synchronization demo about etherlab master</span><o:p></o:p></p>
</div>
<p><span style="font-size:11.0pt">></span> <o:p></o:p></p>
<p><span style="font-size:11.0pt">> Dear Graeme,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">> Thank you so much for your exlaborate explanation.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">> Those time values in 0x1c32 are 0 is also correct according to the vendors, since those are adaptive.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">> Although I have some more questions,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">></span><o:p> </o:p></p>
<p><span style="font-size:11.0pt">> 1.  I see the fucntion ecrt_slave_config_dc called NOWHERE, why is that?</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       If we need that, where it should be?</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">It looks like ecrt_slave_config_dc() got missed in the example app.  It was concentrating on setting up the DC cycle.  In my real application I read a dynamic configuration (rather than a fixed array as in the example).  This
 calls ecrt_slave_config_dc() while in the configuration step.  In the example app the equivalent would be to put the ecrt_slave_config_dc() call in yaskawaSGDV_create() (after ecDevice_init()).  E.g.:</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Courier New"">  // init pdo's and prepare for cmd objects</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Courier New"">  if (ecDevice_init(ecMaster, dev, yaskawaSGDV_syncs) != 0) return -1;</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Courier New"">  ecrt_slave_config_dc(dev->slaveConfig, 0x0300, g_app.scanTimeNS, g_app.scanTimeNS / 2, 0, 0);</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">> 2.  Also, It seems the shift parameter in ecrt_slave_config_dc is only</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       used to calculate dc start time, and it has nothing to do with shift</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       time in 0x1c32:03(or 0x1c33:03), right? As I understand 0x1c32:03</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       (or 0x1c33:03) is for "Output Valid"/"Input Latch" according to</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       beckhoff's online document. What's more, it seems no servo vendors</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       are implementing these features.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">ecrt_slave_config_dc:</span><o:p></o:p></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoNormal" style="mso-list:l2 level1 lfo1"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">sets the slaves assign active value</span><o:p></o:p></li><li class="MsoNormal" style="mso-list:l2 level1 lfo1"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">sets sync0 cycle time</span><o:p></o:p></li><li class="MsoNormal" style="mso-list:l2 level1 lfo1"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">sets sync0 shift time</span><o:p></o:p></li><li class="MsoNormal" style="mso-list:l2 level1 lfo1"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">sets sync1 info (relative to sync0 info)</span><o:p></o:p></li></ul>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">When the slave goes live:</span><o:p></o:p></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoNormal" style="mso-list:l0 level1 lfo2"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">assign active is applied to register 0x0980</span><o:p></o:p></li><li class="MsoNormal" style="mso-list:l0 level1 lfo2"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">sync0 cycle time is applied to register 0x09A0</span><o:p></o:p></li><li class="MsoNormal" style="mso-list:l0 level1 lfo2"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">sync0 shift time is applied by calculating a time (relative to the current cycle zero time) and writing it to register 0x0990</span><o:p></o:p></li></ul>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">From what I understand, the above registers are mapped into the 0x1c32 sdo items.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">> 3.  in ecMaster_syncDistClock, what value of ecMaster->m_dcDiff should</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       be normally(in a short time like one minute)? is it drifting near 0,</span><o:p></o:p></p>
<p class="elementtoproof"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">>       or near N x cycles, or drifting monotonically? And normally how much</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       is the jitter could be? Mine is like several microseconds.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">That depends on how close your master PC clock is to the reference slaves clock.  On startup Linux calibrates the clock and timer frequency.  It preferences speed over accuracy and is also only usually to 6 digits (1us) resolution. 
 This can procduce a slightly different value every time the PC is restarted.  To account for this I generally take a long running time period and calc my own PC clock frequency (with respect to the slave time).  I can then use that value on subsequent starts
 to quickly settle the time drift.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">Beckhoff CX2020:</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">The general scan wakeup jitter is generally around 1 - 2 us (Min: -1us, Max: 8us)</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">The DC Time Delta is around -200ns (+- 500ns)</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">The DC Time Diff is around -1000 ns (+- 500ns)</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">> 4.  the reference clock time retrieved from ecrt_master_reference_clock_time</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       is strongly-related to the time of ecrt_master_send, right? I mean,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       if ecrt_master_send were delayed, reference clock time is also delayed?</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       since the "current" reference clock time copied into the frame is the</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       time when frame goes through the first slave.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">Yes.  There are variable code paths within ecrt_master_send() so it does not necessarily take the same amount of time to process each cycle.  This can cause some of the jitter.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">> 5.  If I want to measure the interval between sending time and SYNC0,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       how should I do? Can I use wireshark to analyze this?</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">Take the returned ecrt_master_reference_clock_time value.  Add the propagation time between the reference slave and slave you are interested in (use ethercat sl -v command and look at port DC times).  Compare this to the sync0
 shift time you selected.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">You could also check the value in register 0x0990, look in wireshark for the value returned and compare it to the ecrt_master_reference_clock_time value from the same time.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">> 6.  After I checked the debug msg in syslog, and the recorded initial</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       time passed into ecrt_master_application_time, I still don't know</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       the relationship among "initial time passed into</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       ecrt_master_application_time"/"dc_start_time"/"first wake time". It</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       seems the "ref_time=" in syslog for the 1st slave is the initial time</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       pssed into ecrt_master_application_time. Also I can see you sleep 50</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       cycles with firstWakeTime in cycle 0 as you mentioned (not one cycle,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       actually the cycle not started yet, and you are doing "call</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       ecrt_master_activate() and setup hard realtime" before the first wake</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">>       at firstWakeTime).</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="elementtoproof"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">In the EtherCAT master, the first time ecrt_master_application_time is called the value is stored in master->app_start_time.  That time and every time thereafter it is stored
 in master->app_time.  fsm_slave_config.c ec_fsm_slave_config_state_dc_sync_check() uses these times (plus the slave dc sync info) to calc the value passed to register 0x0990.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">Under RTAI we need to call ecrt_master_activate() before we start hard realtime.  As we are not yet in hard realtime we can’t guarantee how long it will take between the call to activate and becoming hard realtime.  So we choose
 a cycle far enough in the future (e.g. 50 cycles) to allow for any variable delay time in starting the hard realtime.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt">></span><o:p> </o:p></p>
<p><span style="font-size:11.0pt">> Thanks again for everything, you really helped me (and somebody else I bet) a lot</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">> With Kindest Regards,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt">></span><o:p> </o:p></p>
<p><span style="font-size:11.0pt">> Circle</span><o:p></o:p></p>
<p><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black;mso-fareast-language:ZH-CN">发件人</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><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black;mso-fareast-language:ZH-CN">发送时间</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 lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">年</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">4</span><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">月</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">22</span><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">日</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> 5:11<br>
</span><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">收件人</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 lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">抄送</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 lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">主</span></b><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black;mso-fareast-language:ZH-CN">题</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</span><o:p></o:p></p>
<p> <o:p></o:p></p>
</div>
<div id="x_x_divtagdefaultwrapper">
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="color:black">Hi Circle,</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Re the two emails below:</span><o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="1009" style="width:757.05pt" align="center">
</div>
<div id="x_x_divRplyFwdMsg">
<p><b><span style="font-family:"Calibri",sans-serif;color:black">> </span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">From:</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">></span><o:p></o:p></p>
</div>
<div id="x_x_divRplyFwdMsg">
<p><b><span style="font-family:"Calibri",sans-serif;color:black">> </span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Sent:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Thursday,
 17 April 2025 19:59<br>
</span><b><span style="font-family:"Calibri",sans-serif;color:black">> </span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">To:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Graeme
 Foot<br>
</span><b><span style="font-family:"Calibri",sans-serif;color:black">> </span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Cc:</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"><br>
</span><b><span style="font-family:"Calibri",sans-serif;color:black">> </span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Subject:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> </span><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">回复</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:
 DC synchronization demo about etherlab master</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">>  </span><o:p></o:p></p>
</div>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Dear Graeme,</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> I am so sorry again, I am too excited to receive your email, and I can't wait to know more.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> One more thing, does ECAT Master set sync0 time for the slave? if so, what type of frame for that(I want to check that by wireshark)?  And is it aligned with dc_start_time? As I understand app_start_time
 is the first call to ecrt_master_application_time, some code says application_time should be phase aligned with dc time, what does this mean? I am not clear about the purpose of application_time if we don't sync all slaves to master clock.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Wish you have a good time.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Best Regards,</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Circle</span><o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_x_divRplyFwdMsg">
<p><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">> From:</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-family:"Calibri",sans-serif;color:black">> </span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Sent:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Thursday,
 17 April 2025 19:47<br>
</span><b><span style="font-family:"Calibri",sans-serif;color:black">> </span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">To:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Graeme
 Foot<br>
</span><b><span style="font-family:"Calibri",sans-serif;color:black">> </span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Cc:</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"><br>
</span><b><span style="font-family:"Calibri",sans-serif;color:black">> </span></b><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Subject:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> </span><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">回复</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:
 DC synchronization demo about etherlab master</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> </span><o:p></o:p></p>
</div>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Dear Graeme,</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> if I call ecrt_slave_config_dc(NULL, 0x300, 1000000, 300000, 0, 0), does the parameter 3000000 for sync0_shift only affect dc_start_time in the master, is any other purpose? like, will will be
 copied to 0x1c32:3(shift_time), how is it related to initial master_time and the first frame send time?</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Also, when you mentioned " If you active the slaves dc, then the sync0 occurs at the sync0_shift time after the
</span><b><i><u><span style="font-family:"Calibri",sans-serif;color:#C82613">nominal
</span></u></i></b><span style="font-family:"Calibri",sans-serif;color:black">cycle zero time.  ", what do you mean by nominal? does sync0 event occurs first, then after shift time, slave apply PDOs? and should we just care about is the time between frame arrival
 and SYNC0(I mean shift time NOW is the internal things of slave, it should not raise dc sync problems, just a shift time to apply PDOs)?</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Finally, i would like to share something, when my YASKAWA is synchronized very well(servo_on, no dc error, drift of last slave is very small), the 0x1c32:02=0x1c32:10=1000000, but 0x1c32:03=62500,
 0x1c33:02=0x1c33:10=1000000, 0x1c33:3=0(anyway i don't think we should care 0x1c33 since we are not using SYNC1, right?). What's more, when I try another 2 servos from HCFA(remove all YASKAWA servos), all the above values is 0(cycle time and shift time in
 0x1c32 and 0x1c33), but the servos are working better than YASKAWA's. Have you any idea about this?</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> With KINDEST REGARDS</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Circle</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Re Yaskawa vs HCFA, if all the 0x1c32 / 0x1c33 values are zero then it is unlikely that the ecrt_slave_config_dc() call has succeeded.  Check the ethercat logs for errors.  If dc sync is not active
 on the HCFA axes then they will not raise sync errors.  Instead they will most likely be in free run mode and just be applying the pdo values as soon as they receive them (which means they will not be coordinated).  Also make sure the Assign Active value is
 correct for the HCFA axes.  This value can be obtained from it's esi file (it may not be 0x0300).</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Re Yaskawa 0x1c32:03=62500.  That doesn't look right and may be why you're having problems.  62500 is the smallest possible period the Yaskawa axes will accept.  It also doesn't look like your shift
 time of 300us has been applied.  So it's likely that these are the default values and dc sync has not been activated correctly at all.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">In your example you are passing NULL as the first parameter of ecrt_slave_config_dc().  This needs to be the slave config of the slave you want to activate DC sync on and needs to called for each
 slave that you want to activate DC sync on.  Prior to calling ecrt_slave_config_dc() on any slave you need to have already started your realtime loop to ensure they don't raise DC sync errors due to missed PDO's.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Re the rest, hopefully this answers everything:</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Your application is the master so you get to choose time zero and the cycle period.  Just before activating the master you call ecrt_master_application_time(), passing it your time value you want
 to be considered time zero.  In my example (previous email) I do this by taking the current clock time and rounding it down to the nearest even cycle period value (phase aligning it).  It is then up to your application to cycle at your desired period.  If
 you keep everything in sync then you will get something like:</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">* Time Zero / Cycle Zero Time   (time zero set with ecrt_master_application_time())</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|  cycle 0   (call ecrt_master_activate() and setup hard realtime)</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|  wait for next cycle</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">* Cycle Zero Time (Time Zero + (Period * 1))</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|  cycle 1   (receive / calc / dc sync / send)</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|  wait for next cycle</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|  </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">* Cycle Zero Time (Time Zero + (Period * 2))</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|  cycle 2   (receive / calc / dc sync / send)</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|  wait for next cycle</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">...</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> * Cycle Zero Time (Time Zero + (Period * n))</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|  cycle n   (receive / calc / dc sync / send)</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|  wait for next cycle</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">|</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">On the slave side you have three types of slaves:</span><o:p></o:p></p>
<ol style="margin-top:0cm" start="1" type="1">
<li class="MsoNormal" style="color:black;mso-list:l6 level1 lfo3"><span style="font-family:"Calibri",sans-serif">Does not support DC at all</span><o:p></o:p></li><li class="MsoNormal" style="color:black;mso-list:l6 level1 lfo3"><span style="font-family:"Calibri",sans-serif">Has a DC clock (either 32bit or 64bit clock)</span><o:p></o:p></li><li class="MsoNormal" style="color:black;mso-list:l6 level1 lfo3"><span style="font-family:"Calibri",sans-serif">Has a DC clock and can be DC sync activated</span><o:p></o:p></li></ol>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">A slave must have a DC clock to be able to serve as a DC reference slave, but doesn't need to support DC sync activation.  All slaves start up without DC sync activate by default.  Slaves without
 DC sync activated get a sync0 signal when they receive the write PDO frame (and potentially a sync1 if they receive the read PDO frame in a separate domain).  This means the PDO data is applied immediately on receiving it, so the first slave can apply it's
 outputs some time before the last slave does due to the physical time the frame takes to travel along the slaves.  Slaves that allow the DC sync to be activated allow some arbitrary time offset (the sync0 shift time) from the Cycle Zero Time so that all of
 these slaves can trigger the sync0 signal at the same time so their outputs become coordinated regardless of where they are in the EtherCAT chain.  Note: dc slaves do not need to have the same sync0 shift time applied to them but it would be unusual to do
 so.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">So, your sync0_shift time of 300000 is configuring the slave to have a sync0 signal occur 300us after Cycle Zero each cycle (where the cycle period is 1ms).</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">What I mean by the nominal cycle zero time is: as the master you nominate Time Zero.  Each cycle thereafter has a Cycle Zero time which is Time Zero + (Period * cycle number).  Using ecrt_slave_config_dc()
 allows you to configure a slave to trigger the sync0 signal at a time of your choosing, in relation to the Cycle Zero time.  This allows the slave to delay applying the PDO data, but the PDO data must have arrived before the sync0 signal is triggered else
 it has nothing to apply and it causes an error condition on the slave.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Back on the master side, it is up to you when you wake up and perform the receive / calc / dc sync / send functions.  It doesn't have to coincide with Cycle Zero, but each of the functions have various
 constraints.  e.g.:</span><o:p></o:p></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoNormal" style="color:black;mso-list:l4 level1 lfo4"><span style="font-family:"Calibri",sans-serif">receive must be called after the frames have returned to the master from the previous cycle</span><o:p></o:p></li><li class="MsoNormal" style="color:black;mso-list:l4 level1 lfo4"><span style="font-family:"Calibri",sans-serif">dc sync (e.g. ecrt_master_application_time()) should be called just before send to minimize timing jitter</span><o:p></o:p></li><li class="MsoNormal" style="color:black;mso-list:l4 level1 lfo4"><span style="font-family:"Calibri",sans-serif">send needs to be called every cycle, after the previous cycles last active sync0_shift time and before the current cycles first active sync0_shift
 time (plus time allowance for time on the wire)</span><o:p></o:p></li></ul>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">So for a cycle you get something like:</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">  Master                     Slave 1          Slave 2</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">* Cycle n Zero time</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|  wake up</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|  receive</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|  calc</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|  dc sync</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|  send ----------------\</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|  wait for next cycle   \</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|                         \- process pdo -\</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|                                          \- process pdo -\</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|                                                           |</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|                                          /---------------/</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|                         /---------------/</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|                        /</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|  <--------------------/</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|                            Sync0            Sync0     <= pdo data becomes active 300us after Cycle Zero</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">...</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">* Cycle n+1 Zero time</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">|  wake up</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black">etc...</span><o:p></o:p></p>
<p><span style="font-family:"Courier New";color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">I'm not at work for the next week so can't look up the EtherCAT docs, but the DC related registers are in the 0x0900 range (with the assign activate at 0x0980, 0x0981).</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">ecrt_master_application_time() is used to inform the master code what time we think it is.  If we are syncing the master to the reference slave then we account for drift on the app side.  I don't
 have the code in front of me so can't say at the moment whether it is necessary to be called each cycle in this situation (after the initial call to set Time Zero).</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Regards,</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Graeme.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_x_divRplyFwdMsg">
<p><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black;mso-fareast-language:ZH-CN">发件人</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 lang="ZH-CN" style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black;mso-fareast-language:ZH-CN">发送时间</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 lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">年</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">4</span><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">月</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">17</span><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">日</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> 7:33<br>
</span><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">收件人</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><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">抄送</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 lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">主</span></b><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black;mso-fareast-language:ZH-CN">题</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 lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">回复</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">:
 DC synchronization demo about etherlab master</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
</div>
<p><span style="font-family:"Calibri",sans-serif;color:black">Dear Graeme,</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">Thanks so much for the detailed explanation. that really help me a lot.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">if I call ecrt_slave_config_dc(NULL, 0x300, 1000000, 300000, 0, 0), does the parameter 3000000 for sync0_shift only affect dc_start_time in the master, is any other purpose? like, will will be copied
 to 0x1c32:3(shift_time), how is it related to initial master_time and the first frame send time?</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<p><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black;mso-fareast-language:ZH-CN">发件人</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><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black;mso-fareast-language:ZH-CN">发送时间</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 lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">年</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">4</span><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">月</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">17</span><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">日</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> 0:26</span><o:p></o:p></p>
<div id="x_x_x_divRplyFwdMsg">
<p><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">收件人</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">></span><o:p></o:p></p>
</div>
<p><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">抄送</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 lang="ZH-CN" style="font-size:11.0pt;font-family:"MS Gothic";color:black;mso-fareast-language:ZH-CN">主</span></b><b><span lang="ZH-CN" style="font-size:11.0pt;font-family:"Microsoft JhengHei",sans-serif;color:black;mso-fareast-language:ZH-CN">题</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</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">Hi Circle,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">Re below, I’m also cc’ing the forum in case anyone has more input to add.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> From: Circle Fang
</span><a href="mailto:circlefang@live.com"><span style="font-family:"Calibri",sans-serif">circlefang@live.com</span></a><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Sent: Wednesday, 16 April 2025 20:02</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> To: Graeme Foot </span>
<a href="mailto:Graeme.Foot@touchcut.com"><span style="font-family:"Calibri",sans-serif">Graeme.Foot@touchcut.com</span></a><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Subject: DC synchronization demo about etherlab master</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">></span><span style="color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Dear Graeme,</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">></span><span style="color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> I am interested in some motion control research, and I am really thankful about all your response in etherlab-users mail-list, that help me a lot. And i am very sorry if my mail dirturbe you, I
 am not able to post questions on the maillist.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">></span><span style="color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> I like the way you mentioned here
</span><a href="https://lists.etherlab.org/pipermail/etherlab-users/2018-May/014740.html"><span style="font-family:"Calibri",sans-serif">https://lists.etherlab.org/pipermail/etherlab-users/2018-May/014740.html</span></a><span style="font-family:"Calibri",sans-serif;color:black"> by
 CACHED PDOs sent in next cycle, but i am not able to find the attachment you mentioned here,
</span><a href="https://lists.etherlab.org/pipermail/etherlab-users/2022-March/019231.html"><span style="font-family:"Calibri",sans-serif">https://lists.etherlab.org/pipermail/etherlab-users/2022-March/019231.html</span></a><span style="font-family:"Calibri",sans-serif;color:black">.
 Is it possible that you send me a copy?</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">></span><span style="color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> I am having dc sync error occasionally with 4 YASKAWA servos(first time with this brand) connected a line to the master, even 0x92c is very small like no more than 20. I am using xenomai in the
 traditional ways (the master is synchronized to reference with PDOs in current cycle), and my realtime cycle(1ms) takes various mount of time. And if my OS is ok, then the only thing i can do is sync 0 shift_time(now 300us) and CACHED PDOs sent in next cycle
 as you mentioned? Do you have any other suggestions?</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">></span><span style="color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> I also have one more question about sync0 and shift time, is "DC cyclic operation start time to 64460955283935" the first sync0 time in slave? I saw in some docs said the sync0_shift is only a
 time after snyc0 in the slave(like all motors move at the same time, i.e., after shift time), If so, why we use sync0_shift to calculate dc_start_time? because dc errors is about the time SM2 and sync0, it's not because sync0_shift.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">></span><span style="color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> This confuse me for several years, and I would be very very appreciated if you give me some guidance.</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">></span><span style="color:black"> </span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Thanks again</span><o:p></o:p></p>
<p><span style="font-family:"Calibri",sans-serif;color:black">> Circle</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">I’ve attached the email you mention and the test program.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">Inside ecMaster_syncDistClock() I call ecrt_master_64bit_reference_clock_time_queue().  This is used to put a long running timestamp in the wireshark logs so you can check and ensure your cycle period is not drifting.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">If drifting is not the problem then calling ecrt_master_send() at a consistent time (with enough time on the wire before the DC Sync time at the slave) is essential.  As you say, I do this by caching the data to
 write from the previous cycle and send it as soon as I receive and process the previous domain information.  This ensures the previous frames have returned and reduces the jitter of the send.  I also set the dc shift time on the slaves to 500us (half of my
 1ms period) so that the frames have half the cycle to reach all the slaves and the other half of the cycle to return.  (We only have 60 to 80 slaves so are nowhere near needing to worry about time on the wire, unless we decide at some stage to reduce the cycle
 period.)  The calculations for the next period can then also be performed in parallel to the frames being on the wire.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">A few other options are:</span><o:p></o:p></p>
<ol style="margin-top:0cm" start="1" type="1">
<li class="MsoNormal" style="color:black;mso-list:l5 level1 lfo5"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">Set your DC Sync offset to 900us.  A time large enough to process the previous frame reads, do calcs, send and time on the wire. 
 The drawback is that non DC slaves will apply their data more early than the dc slaves.</span><o:p></o:p></li></ol>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<ol style="margin-top:0cm" start="2" type="1">
<li class="MsoNormal" style="color:black;mso-list:l3 level1 lfo6"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">Wake up the master twice.  E.g.:</span><o:p></o:p></li></ol>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black">At 0us: Wake up and perform the send</span><o:p></o:p></p>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black">At 500us: Wake up and receive, do calcs</span><o:p></o:p></p>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black">At 1000us: Wake up and perform the send</span><o:p></o:p></p>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black">Etc.</span><o:p></o:p></p>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black">Also, people have asked the forum previously if you can wake up at an event when the PDO data frames return.  There is no such event, so they have attempted to poll for this.  The master
 is not designed for this so it doesn’t work so well.  What you can do however is figure out how much time the frames take on the wire by looking at the “ethercat sl -v -p0” command and look at the Diff [ns] value for port 1 (or calc the diff between the first
 and last port if using a start topology).  That will tell you how long it takes for the frames to go out and return to the first slave.  Add a little overhead for the master send / receive and you can tune the mid cycle wake up time above to maximize the calc
 time.  That of course then becomes system specific (and can change if you have hot plug groups).</span><o:p></o:p></p>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<ol style="margin-top:0cm" start="3" type="1">
<li class="MsoNormal" style="color:black;mso-list:l7 level1 lfo7"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">Do what TwinCAT does and separate the calc from the EtherCAT processing (different threads and memory space).</span><o:p></o:p></li></ol>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black">The EtherCAT module wakes up at 0us and reads linked data from other modules, it then reads the returned PDO information and caches it for other process to read, applies the PDO write
 data and sends it.</span><o:p></o:p></p>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black">The calc modules can wake up when they want and follow the same steps, read linked data from other modules (including the EtherCAT PDO data), perform calcs, write results to the modules
 out data.</span><o:p></o:p></p>
<p style="margin-left:36.0pt"><span style="font-size:11.0pt;color:black">This is kind of similar to my caching method except that it uses the different modules to achieve the data caching and decouples the EtherCAT data cycle and calculations.  It’s also helpful
 due to TwinCAT using overlapped PDO’s.  Different calc modules can also have different cycle rates, but the EtherCAT module needs to run at least at the fastest module cycle rate.  There’s also more locking issues to resolve and memory shuffling.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">Re your last question, I’m not really sure what you are asking but from my recollection:</span><o:p></o:p></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoNormal" style="color:black;mso-list:l1 level1 lfo8"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">The sync0 time is to do with getting all dc clock slaves to a common time base and in sync with your masters nominal cycle zero time. 
 The dc syncing after that is just to keep the master and dc slaves in sync with each other.</span><o:p></o:p></li><li class="MsoNormal" style="color:black;mso-list:l1 level1 lfo8"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">By default slaves will apply data from incoming PDO’s immediately, and write outgoing data at their current values.  DC capable slaves
 can optionally have DC sync enabled (with ecrt_slave_config_dc()), which effectively caches the incoming PDO data to be applied at the shift time, so all DC slaves can activate their incoming data at the same time (or in a coordinated fashion).  It also caches
 write data at the same time (or at its own offset with sync1).  The only requirement is that the slave needs to have processed the PDO frames each cycle before the offset time, else it starts raising errors.</span><o:p></o:p></li><li class="MsoNormal" style="color:black;mso-list:l1 level1 lfo8"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">The master can choose when in the nominal cycle period it sends the PDO frames, but as close to the cycle zero point with minimal
 jitter is preferable.  (Minimal jitter is especially good for the non dc activated slaves.)</span><o:p></o:p></li></ul>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">ecrt_slave_config_dc() params:</span><o:p></o:p></p>
<p style="margin-left:106.35pt;text-indent:-92.15pt"><span style="font-size:11.0pt;color:black">sc                                     the slave to configure</span><o:p></o:p></p>
<p style="margin-left:106.35pt;text-indent:-92.15pt"><span style="font-size:11.0pt;color:black">assign_activate       the assign activate word the slave uses to enable DC sync (often 0x0300) (see ETG ethercat_esc_datasheet_sec2_registers pdf, registers 0x0980,
 0x0981)</span><o:p></o:p></p>
<p style="margin-left:106.35pt;text-indent:-92.15pt"><span style="font-size:11.0pt;color:black">sync0_cycle               your nominal EtherCAT master cycle time (e.g. 1ms)</span><o:p></o:p></p>
<p style="margin-left:106.35pt;text-indent:-92.15pt"><span style="font-size:11.0pt;color:black">sync0_shift                 when to raise the sync0 event, as a shift time from the nominal cycle zero time (aka when to apply the read PDO values in the cycle period)</span><o:p></o:p></p>
<p style="margin-left:106.35pt;text-indent:-92.15pt"><span style="font-size:11.0pt;color:black">sync1_cycle               some slaves can have a sync1 event, used for caching PDO write values at a different time to sync0.  Not generally required, use 0 to ignore</span><o:p></o:p></p>
<p style="margin-left:106.35pt;text-indent:-92.15pt"><span style="font-size:11.0pt;color:black">sync1_shift                 not generally required, use 0 to ignore.  The master has a bug with this.  There’s a patch floating around to fix this if needed</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">In summary, the sync0 event is when the PDO data is applied.  If you active the slaves dc, then the sync0 occurs at the sync0_shift time after the nominal cycle zero time.  If it is not activated the sync0 event
 is raised as the PDO data comes in so it is applied immediately.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">Regards,</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black">Graeme.</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;color:black"> </span><o:p></o:p></p>
</div>
</div>
</body>
</html>