<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;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:12.0pt;
font-family:"Aptos",sans-serif;}
span.EmailStyle19
{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;}
--></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="mso-fareast-language:EN-US">Typically, the reference clock should be the first DC-capable device on the network (often an infrastructure device like a coupler, if present – as in your case), because the DC time only flows downstream
from that. It’s unusual for it to be your DC-consuming device directly unless you don’t have any others. Thus, it’s not usually necessary to call
</span>ecrt_master_select_reference_clock unless you have special requirements (such as DC synching across multiple networks).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Since you’re using ecrt_master_sync_reference_clock_to and you’re saying that the DC time doesn’t appear to be advancing, ensure that your code actually does advance the time in your realtime loop – that’s your responsibility when you use
that method rather than the alternatives.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">There can be many reasons why a device refuses to transition to SAFEOP (or does but then faults back to PREOP). You’ll need to review the syslog to see what error codes it’s reporting, if any. (But it could just be due to the DC time
not advancing.)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Try comparing your code against the existing examples such as dc_user, and pay close attention to your slave’s documented requirements for ecrt_slave_config_dc – in particular note that the SYNC1 time is specified in an unusual way.<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>
<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="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"> Etherlab-users <etherlab-users-bounces@etherlab.org>
<b>On Behalf Of </b>dabbede@gmail.com<br>
<b>Sent:</b> Monday, 10 February 2025 9:54 pm<br>
<b>To:</b> etherlab-users@etherlab.org<br>
<b>Subject:</b> [Etherlab-users] DC and oversampling with EL2262<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Dear Etherlab community,<br>
<br>
I have been using the EtherCAT master for a few days. I think I understand more or less how to configure the PDOs and domains for one or more slaves, but I'm having trouble with the distributed clock (DC).<br>
In particular, my setup is currently as follows:<br>
- master<br>
- Beckhoff EK1100<br>
- Beckhoff EL2262<br>
<br>
The latter is a digital output with oversampling capabilities. It can output a sample every Sync0, which in turn can be set to trigger faster than the application cycle. I used this slave successfully with other EtherCAT masters, so I know it is working properly.<br>
<br>
In my code I've set the PDOs using "ecrt_slave_config_pdos" and assigned them to the domain1 using "ecrt_slave_config_reg_pdo_entry".<br>
<br>
Then I've set this slave to be the reference clock using<br>
ecrt_master_select_reference_clock (master, sc); // Set this slave to be reference clock<br>
and finally I've set the DC settings (and Sync0/1) using "ecrt_slave_config_dc" (by the way, the AssignActivate data is 0x0730 for this slave).<br>
<br>
Then, for every application cycle I call, in order:<br>
- ecrt_master_application_time<br>
- ecrt_master_receive<br>
- ecrt_domain_process<br>
- check_domain1_state<br>
- ecrt_master_sync_reference_clock_to<br>
- ecrt_master_sync_slave_clocks<br>
- ecrt_domain_queue<br>
- ecrt_master_send<br>
<br>
The problems I see are:<br>
- the outputs are constantly OFF, even if I've set an alternating pattern of ON and OFF,<br>
- the slave stops at PREOP,<br>
- if I inspect the master from the cli using "ethercat master -v", I see that the reference clock is set to Slave 0, instead of Slave 1. Moreover, the DC reference time is set correctly every time I restart the application, but it does not update during execution.
Conversely, the application time increase as expected<br>
- during " check_domain1_state", I see that the wc_state==EC_WC_ZERO (no process data exchanged)<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I am willing to share my code if it is required. <br>
Thank you for your help and, especially, thank you for providing such powerful software as open source.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"> Davide<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>