<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=us-ascii">
<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;}
@font-face
        {font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;
        mso-fareast-language:EN-US;}
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:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">ecrt_master_sdo_upload is mainly intended for use when a master app is not running (or just starting, prior to realtime).  You can run it concurrently with a master app, but
 only from a non-realtime thread.  It’s the equivalent of running the “ethercat upload” command.  There is a risk that this can impact the performance of the realtime thread, as under the hood it uses mutexes.  (YMMV for linux-default vs. linux-rt vs. Xenomai.)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">The ring vs. alias addressing isn’t usually a big problem, since you can enumerate the ring to translate from one addressing format to another.  There is a risk of a misread
 if the network changes while in the middle of a transfer (though that should hopefully be rare), but you can at least detect that by checking the network state before and after.  This may be impractical if you want to do frequent or constant polling of the
 SDOs, but it might be acceptable if this is only an occasional thing and if you can spread out queries to each device over time rather than bunching all devices together.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">The sdo_requests are the way to go if you want to ensure there’s reduced performance issues while concurrently running a master app, but you do need to use them correctly.  You
 create the SDO request before starting the realtime thread, then within the realtime thread you need to run a mini-state-machine where you do nothing when nothing is pending, call request_read/write just once to kick off a request, and call request_state once
 per cycle (or less often) only while a request is in progress.  (It’s mostly harmless to call request_state unnecessarily, so you
<i>could</i> just call it blindly if you don’t want to separately track which requests are in progress, but I consider that bad style.)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">At minimum you will need one request object per slave.  It’s up to you whether you make only one per slave or one per SDO on that slave you want to read; either way, while you
 can queue up multiple requests (on distinct objects), only a single request per slave can actually make forward progress at a time.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<span style="FONT-FAMILY: Gotham, Calibri, 'sans-serif'; COLOR: #231f20"><strong>Gavin Lambert<br></strong>
 <br>
Software Engineer<br>
<br>

</span><br>
 <br><img style="HEIGHT: 45px; WIDTH: 192px" src="cid:TOMRA_CMYK_final_size_times_two_cd761a01-1d1f-446e-9316-8012271820b6.png" width="192" height="45" border="0">
 <br>

 <a href="https://www.facebook.com/TOMRA.Food/" target="_blank"><img alt="tomra facebook" src="cid:TF-FB-icon_b77c57e4-4990-4f9d-b3a2-8e6ab45df7f2.jpg" height="30"></a> <a href="https://www.linkedin.com/company/tomra-food/" target="_blank"><img alt="tomra linkedin" src="cid:TF-LinkedIn-icon_d54c4829-dcb9-450c-9187-34b26e85ebaa.jpg" height="30"></a> <a href="https://twitter.com/TOMRAFood" target="_blank"><img alt="tomra twitter" src="cid:icons-social-media-twitter_small_2_4bae5ad2-4add-4314-a352-5b317f784956.jpg" height="30"></a> <a href="https://www.youtube.com/playlist?list=PLDD3B1A7BAE919EC6" target="_blank"><img alt="tomra youtube" src="cid:TF-Youtube-icon_8b2c830c-70d9-48da-a4db-db9191d346ba.jpg" height="30"></a> <a href="https://www.instagram.com/tomrafood/" target="_blank"><img alt="tomra instragram" src="cid:TOMRAinstagram_45b30c55-490a-4f32-8fd3-998c152e3494.jpg" height="30"></a><br>
<span style="FONT-SIZE: 75%; FONT-FAMILY: Calibri, Candara, Segoe, Optima, Arial, sans-serif; COLOR: #6e8186"> <b>TOMRA Food (ANZ) Limited</b> 
| 4 Henderson Place | PO Box 13 516 | Onehunga 1061 | New Zealand </span><br>
<p style="FONT-SIZE: 10pt; MARGIN-BOTTOM: 5pt; FONT-FAMILY: Arial; MARGIN-TOP: 0px"></p>
<span style="FONT-SIZE: 75%; FONT-FAMILY: Calibri, Candara, Segoe, Optima, Arial, sans-serif; COLOR: #6e8186"> Phone: +64 96 34 00 88 | <a href="https://www.tomra.com/food">https://www.tomra.com/food</a></span><br>
<span style="FONT-SIZE: 60%; FONT-FAMILY: Gotham, Calibri, 'sans-serif'; COLOR: #6e8186">The information contained in this communication and any attachment is confidential and may be legally privileged. It should only be read by the person(s) to whom it is addressed. If you have received this communication in error, please notify the sender and delete the communication. </span><br>
<span style="FONT-SIZE: 60%; FONT-FAMILY: Gotham, Calibri, 'sans-serif'; WIDTH: 75%; COLOR: #6e8186">
</span><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" style="mso-ligatures:none;mso-fareast-language:EN-NZ">From:</span></b><span lang="EN-US" style="mso-ligatures:none;mso-fareast-language:EN-NZ"> Etherlab-users <etherlab-users-bounces@etherlab.org>
<b>On Behalf Of </b>Mittermeier Franz<br>
<b>Sent:</b> Friday, 19 September 2025 2:23 am<br>
<b>To:</b> etherlab-users@etherlab.org<br>
<b>Subject:</b> [Etherlab-users] load when reading SDOs<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span lang="DE">Hello all,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE">i try to read some SDOs from a slave, the PDOs are limited and that values need not to be updated with high frequency.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE">My first trial was using the function „ecrt_master_sdo_upload“ in a non realtime task.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">Problem here besides of the blocking behaviour is, that it needs the slave position and not its alias,
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">which i think is a problem in case of dynamically connected/disconnected slaves.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE">So i tried using the methods „ecrt_slave_config_create_sdo_request, ecrt_sdo_request_timeout ,ecrt_sdo_request_read, ecrt_sdo_request_state, ecrt_sdo_request_data“<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">in the realtime task.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">That works, but with this i see a process „EtherCAT-OP“ in the task list with a cpu load of more than 20%, while my test application consumes about 1%.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">This is for reading only one SDO. Without reading the SDO „EtherCAT-OP“ is also at about 1% load.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE">So my question, does reading one SDO really cause this high cpu load? Is there something wrong? Or am i on a totally wrong way to read some SDOs?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE">My test application is mainly derived from the „user“ example, of course i can share the source if of interest.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">It uses a cycle time of 5ms, so it should be not too fast.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">It runs on a plc (Cortex A8) with Preempt_rt patch, etherCAT version is 1.6.1.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">There are 4 slaves connected, 3 Beckhoff and one NORD inverter, from which I need to read the SDOs.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE">I really appreciate receiving some tips!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE">Best regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE">Franz<o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>