<div dir="ltr">Dear Gavin,<div>Thanks for the suggestion. I don't have access to the pins, and I'm not sure if it's practical to identify each frame by its start or end signal for even a few seconds on an oscilloscope (the rate of transmission is too high). But I will try this method if all else fails.</div><div>Best, </div><div>Mohsen</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 3, 2018 at 4:19 AM Gavin Lambert <<a href="mailto:gavin.lambert@tomra.com">gavin.lambert@tomra.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-NZ" link="#0563C1" vlink="#954F72">
<div class="m_-2918271950751547964WordSection1">
<p class="MsoNormal"><span>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">😊</span><span><u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></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 <<a href="mailto:m.alizad3h@gmail.com" target="_blank">m.alizad3h@gmail.com</a>>; <a href="mailto:etherlab-users@etherlab.org" target="_blank">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> Re: [etherlab-users] Measuring the frequency of master sending the frames to network<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span>Two options:<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>1) You can use wireshark on another computer.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>- Plug in a switch inline somewhere on your EtherCAT network, make sure it forwards without delay<u></u><u></u></span></p>
<p class="MsoNormal"><span>- Also plug your second computer into the switch, make sure you disable all protocols on the network card (but not the card itself)<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>1a)<u></u><u></u></span></p>
<p class="MsoNormal"><span>- In your application cycle call ecrt_master_sync_slave_clocks()<u></u><u></u></span></p>
<p class="MsoNormal"><span>- Run your application and use wireshart to log your data<u></u><u></u></span></p>
<p class="MsoNormal"><span>- Run the command:<u></u><u></u></span></p>
<p class="MsoNormal"><span>"C:\Program Files\Wireshark\tshark.exe" -r data.pcap -T fields -e ecat.reg.dc.systimeL > data.txt<u></u><u></u></span></p>
<p class="MsoNormal"><span>(replacing data.pcap and data.txt with your input and output filenames)<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>1b) If you have gavinl's patchset<u></u><u></u></span></p>
<p class="MsoNormal"><span>- In your application cycle call ecrt_master_64bit_reference_clock_time_queue()<u></u><u></u></span></p>
<p class="MsoNormal"><span>- Run your application and use wireshart to log your data<u></u><u></u></span></p>
<p class="MsoNormal"><span>- Run the command:<u></u><u></u></span></p>
<p class="MsoNormal"><span>"C:\Program Files\Wireshark\tshark.exe" -r data.pcap -T fields -e ecat.reg.dc.systime > data.txt<u></u><u></u></span></p>
<p class="MsoNormal"><span>(replacing data.pcap and data.txt with your input and output filenames)<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>- 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.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>2) analyse the info within your app<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>2a)<u></u><u></u></span></p>
<p class="MsoNormal"><span>- In your application cycle call ecrt_master_sync_slave_clocks()
<u></u><u></u></span></p>
<p class="MsoNormal"><span>- get the 32bit clock value using ecrt_master_reference_clock_time()<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>2b) If you have gavinl's patch set<u></u><u></u></span></p>
<p class="MsoNormal"><span>- In your application cycle call ecrt_master_64bit_reference_clock_time_queue()<u></u><u></u></span></p>
<p class="MsoNormal"><span>- get the 64bit clock value using ecrt_master_64bit_reference_clock_time()<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>- Analyse the results yourself in the app, or log to file<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Notes:<u></u><u></u></span></p>
<p class="MsoNormal"><span>- The wireshark message timestamp is not accurate enough by itself, hence using the distributed clock reference slave timestamp<u></u><u></u></span></p>
<p class="MsoNormal"><span>- 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<u></u><u></u></span></p>
<p class="MsoNormal"><span>- 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" target="_blank">
https://www.wireshark.org/docs/dfref/e/ecat.html</a> for a list of possible tshark ethercat fields<u></u><u></u></span></p>
<p class="MsoNormal"><span>- 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().<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span>Graeme Foot.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></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" target="_blank">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" target="_blank">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> [etherlab-users] Measuring the frequency of master sending the frames to network<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">In motion control applications, smooth motion and small error often requires an update rate of at least 1 KHz.<u></u><u></u></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. <u></u><u></u></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.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Best, <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Mohsen<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div>