<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)">
<style><!--
/* Font Definitions */
@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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">If you have hardware access to a slave then you can also hook a scope or other monitor to the ESC pins which indicate sync pulses or SOF/EOF (packet arrival). This is probably easiest if you have
a custom slave or if the particular slave you’re using exposes these for diagnostic purposes; otherwise I don’t recommend trying to crack an off-the-shelf slave open to try to access these signals.
</span><span style="font-family:"Segoe UI Emoji",sans-serif;mso-fareast-language:EN-US">😊</span><span style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Graeme Foot<br>
<b>Sent:</b> Wednesday, 3 October 2018 12:20<br>
<b>To:</b> Mohsen Alizadeh Noghani <m.alizad3h@gmail.com>; etherlab-users@etherlab.org<br>
<b>Subject:</b> Re: [etherlab-users] Measuring the frequency of master sending the frames to network<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Two options:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">1) You can use wireshark on another computer.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- Plug in a switch inline somewhere on your EtherCAT network, make sure it forwards without delay<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- Also plug your second computer into the switch, make sure you disable all protocols on the network card (but not the card itself)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">1a)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- In your application cycle call ecrt_master_sync_slave_clocks()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- Run your application and use wireshart to log your data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- Run the command:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">"C:\Program Files\Wireshark\tshark.exe" -r data.pcap -T fields -e ecat.reg.dc.systimeL > data.txt<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">(replacing data.pcap and data.txt with your input and output filenames)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">1b) If you have gavinl's patchset<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- In your application cycle call ecrt_master_64bit_reference_clock_time_queue()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- Run your application and use wireshart to log your data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- Run the command:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">"C:\Program Files\Wireshark\tshark.exe" -r data.pcap -T fields -e ecat.reg.dc.systime > data.txt<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">(replacing data.pcap and data.txt with your input and output filenames)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- Filter out the appropriate information from data.txt and analyse. Note: wireshark will see each packet twice, once going out and once coming back in. If the switch is before your reference slave
then the timestamp will only be in the returning packet, if it's after then it will be in both.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">2) analyse the info within your app<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">2a)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- In your application cycle call ecrt_master_sync_slave_clocks()
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- get the 32bit clock value using ecrt_master_reference_clock_time()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">2b) If you have gavinl's patch set<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- In your application cycle call ecrt_master_64bit_reference_clock_time_queue()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- get the 64bit clock value using ecrt_master_64bit_reference_clock_time()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- Analyse the results yourself in the app, or log to file<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Notes:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- The wireshark message timestamp is not accurate enough by itself, hence using the distributed clock reference slave timestamp<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- EtherCAT frames are broadcast messages so you don't need to do anything special on the switch for your wireshark PC to be able to see them<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- See: <a href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.wireshark.org%2Fdocs%2Fdfref%2Fe%2Fecat.html&data=02%7C01%7Cgavin.lambert%40tomra.com%7C7fd3e029a6144a91fc0608d628bd96f4%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C636741192100743022&sdata=mAIOwRdHbZDk2mim4zVEMgoMtPz%2FAMSWUCQPmHXUh0o%3D&reserved=0">
https://www.wireshark.org/docs/dfref/e/ecat.html</a> for a list of possible tshark ethercat fields<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">- The EtherCAT master syncs reference slave using the lower 32bits of the dc clock. If your application is running at 1khz then this value rolls over every 4.2 odd seconds, so gets more complicated
to track long running time. Gavinl's patchset adds the ability to read the whole 64bit timestamp using ecrt_master_sync_slave_clocks().<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Graeme Foot.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> etherlab-users <<a href="mailto:etherlab-users-bounces@etherlab.org">etherlab-users-bounces@etherlab.org</a>>
<b>On Behalf Of </b>Mohsen Alizadeh Noghani<br>
<b>Sent:</b> Tuesday, 2 October 2018 10:50 PM<br>
<b>To:</b> <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> [etherlab-users] Measuring the frequency of master sending the frames to network<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">In motion control applications, smooth motion and small error often requires an update rate of at least 1 KHz.<o:p></o:p></p>
<div>
<p class="MsoNormal">When defining a task in RTAI, we can set its execution frequency. Therefore, if we set the frequency to 2 KHz, the master is expected to send EtherCAT frames every 0.5 ms + jitter. <o:p></o:p></p>
<div>
<p class="MsoNormal">Other than using a network probe (e.g. Beckhoff ET2000) connected to another PC and analyzing the timestamps, is there a reliable way for measuring this frequency? In other words, I want to stress test the master for a few hours and make
sure that all frames are sent before the real-time deadlines.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Best, <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Mohsen<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>