<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:"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:"Helvetica Neue";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.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;}
p.p1, li.p1, div.p1
{mso-style-name:p1;
margin:0cm;
margin-bottom:.0001pt;
font-size:9.0pt;
font-family:"Helvetica Neue";
color:#454545;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle26
{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="font-size:11.0pt;mso-fareast-language:EN-US">Hi
</span><span lang="EN-US" style="font-size:11.0pt">Pierre,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Calling the master functions from the command line using popen works perfectly well. e.g.:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">popen("/usr/bin/ethercat states -a1 -p0 INIT 2>&1", "r")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">popen("/usr/bin/ethercat states -a1 -p0 BOOT 2>&1", "r")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">// Note: the optional password not passed in this command<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">popen("/usr/bin/ethercat foe_write -a1 -p0 -o \"firmwarename\" - < /tmp/firmware 2>&1", "r")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">popen("/usr/bin/ethercat states -a1 -p0 INIT 2>&1", "r")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">You can use something like the following to check the current state of the device to wait until it has transitioned:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">popen("/usr/bin/ethercat slaves -a1 -p0 -v 2>&1 | grep 'State:' ", "r")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">I'll assume you know how to use popen and format the commands with the appropriate alias, position and firmware info.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">In my case I have a Web control interface for my system that allows a firmware file to be uploaded with the above commands being called from a cgi.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Graeme Foot.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<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">From:</span></b><span lang="EN-US" style="font-size:11.0pt"> etherlab-users <etherlab-users-bounces@etherlab.org>
<b>On Behalf Of </b>Gavin Lambert<br>
<b>Sent:</b> Wednesday, 15 January 2020 11:14 AM<br>
<b>To:</b> Pierre Kurkdjian <pkurkdjian@gmto.org><br>
<b>Cc:</b> etherlab-users@etherlab.org<br>
<b>Subject:</b> Re: [etherlab-users] New mailing list question<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Please keep replies on the mailing list.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">As I said, you can (as an alternative to invoking the ethercat command line app) use the same IOCTL interface that it uses internally to perform the appropriate functions. FoE transfers
can be done the same way.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Note that the ioctl/ethercat-tool based FoE transfers can only update one slave at a time, as they’re blocking APIs. If you want to be able to update multiple slaves in parallel,
the unofficial patchset (<a href="https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/">https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/</a>) adds an foe_request API that can be used asynchronously, although it’s more complex
to manage.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Even if you don’t want to use foe_requests, you should probably use the patchset anyway as it contains some critical bugfixes for FoE.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p><strong><span style="font-family:"Calibri",sans-serif;color:#595959">Gavin Lambert</span></strong><b><span style="color:#595959"><br>
</span></b><span style="color:#595959">Senior Software Developer<o:p></o:p></span></p>
<table class="MsoNormalTable" border="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt"></td>
</tr>
</tbody>
</table>
<p><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><img border="0" width="360" height="102" style="width:3.75in;height:1.0625in" id="_x0000_i1025" src="cid:image008.png@01D5CB96.B1064A10"><br>
<a href="http://www.compacsort.com"><span style="text-decoration:none"><img border="0" width="33" height="37" style="width:.3437in;height:.3854in" id="_x0000_i1026" src="cid:image009.png@01D5CB96.B1064A10" alt="TOMRA"></span></a><a href="https://www.facebook.com/Compacsort"><span style="text-decoration:none"><img border="0" width="35" height="37" style="width:.3645in;height:.3854in" id="_x0000_i1027" src="cid:image010.png@01D5CB96.B1064A10" alt="Facebook"></span></a><a href="https://www.linkedin.com/company/compac-sorting-equipment/"><span style="text-decoration:none"><img border="0" width="35" height="37" style="width:.3645in;height:.3854in" id="_x0000_i1028" src="cid:image011.png@01D5CB96.B1064A10" alt="Linkedin"></span></a><a href="https://vimeo.com/compacsort"><span style="text-decoration:none"><img border="0" width="37" height="37" style="width:.3854in;height:.3854in" id="_x0000_i1029" src="cid:image012.png@01D5CB96.B1064A10" alt="Youtube"></span></a><a href="https://twitter.com/compacsort"><span style="text-decoration:none"><img border="0" width="33" height="37" style="width:.3437in;height:.3854in" id="_x0000_i1030" src="cid:image013.png@01D5CB96.B1064A10" alt="twitter"></span></a><a href="https://www.instagram.com/compacsort/"><span style="text-decoration:none"><img border="0" width="33" height="37" style="width:.3437in;height:.3854in" id="_x0000_i1031" src="cid:image014.png@01D5CB96.B1064A10" alt="instagram"></span></a><o:p></o:p></span></p>
<p><b><span style="font-size:8.5pt;color:#595959">COMPAC SORTING EQUIPMENT LTD</span></b><span style="font-size:8.5pt;color:#595959"> | 4 Henderson Pl | Onehunga | Auckland 1061 | New Zealand<br>
Switchboard: +64 96 34 00 88 | <a href="http://www.tomra.com">tomra.com</a> <o:p>
</o:p></span></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr>
<td valign="top" style="border-top:solid #595959 1.0pt;border-left:none;border-bottom:solid #595959 1.0pt;border-right:none;padding:0cm 0cm 0cm 0cm">
<p><span style="font-size:8.5pt;color:#595959">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. <o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<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">From:</span></b><span lang="EN-US" style="font-size:11.0pt"> Pierre Kurkdjian <<a href="mailto:pkurkdjian@gmto.org">pkurkdjian@gmto.org</a>>
<br>
<b>Sent:</b> Wednesday, 15 January 2020 07:17<br>
<b>To:</b> Gavin Lambert <<a href="mailto:gavin.lambert@tomra.com">gavin.lambert@tomra.com</a>><br>
<b>Subject:</b> Re: [EXTERNAL] RE: New mailing list question<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Hello Gavin, <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Thank you for your answer.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Indeed I need to go to BOOT state in order to update the slave firmware.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">I need to automatize the firmware loading with a C/C++ program so I need to go to BOOT.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">I think the only solution consists in calling the command line “ethercat state -p0 BOOT” by a C/C++ function.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Best, </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Pierre Kurkdjian</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Real-Time Software Engineer</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Giant Magellan Telescope Organization</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="color:black">From: </span></b><span lang="EN-US" style="color:black">Gavin Lambert <<a href="mailto:gavin.lambert@tomra.com">gavin.lambert@tomra.com</a>><br>
<b>Date: </b>Sunday, January 12, 2020 at 2:27 PM<br>
<b>To: </b>Pierre Kurkdjian <<a href="mailto:pkurkdjian@gmto.org">pkurkdjian@gmto.org</a>><br>
<b>Subject: </b>[EXTERNAL] RE: New mailing list question<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">There isn’t any API in ecrt.h for controlling the state of an individual slave device, but you can use the ioctl API that the ethercat command line tool uses to do that, if you wish. (It only
makes sense to do so when the master app is not running, or at least has not activated the PDO cycle.)</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Usually it’s not necessary; the master will automatically bring devices from INIT to PREOP in all cases, and if ecrt_master_activate has been called it will bring them to OP automatically.</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">There’s typically no reason to explicitly request SAFEOP mode (that’s a failsafe state that a device will drop to itself if something goes wrong in OP), and there’s not much reason for a master
application to bring a device to BOOT state (as that’s just for firmware reprogramming, which is rare and will require follow-up FoE commands).</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="EN-US"><o:p></o:p></span></p>
<p><strong><span lang="EN-US" style="font-family:"Calibri",sans-serif;color:#595959">Gavin Lambert</span></strong><b><span lang="EN-US" style="color:#595959"><br>
</span></b><span lang="EN-US" style="color:#595959">Senior Software Developer<o:p></o:p></span></p>
<table class="MsoNormalTable" border="0" cellpadding="0">
<tbody>
<tr>
<td style="padding:.75pt .75pt .75pt .75pt"></td>
</tr>
</tbody>
</table>
<p><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif"><img border="0" width="360" height="102" style="width:3.75in;height:1.0625in" id="_x0000_i1032" src="cid:image015.png@01D5CB96.B1064A10"><br>
<a href="https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.compacsort.com%2F&data=02%7C01%7Cgavin.lambert%40tomra.com%7C4b3b15b54f044eebdaa708d7991de79b%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637146226040021175&sdata=0eDszIcnkHm5ad26pjNEsiTBhBMUioZoZFA6Cb9vAWo%3D&reserved=0"><span style="text-decoration:none"><img border="0" width="33" height="37" style="width:.3437in;height:.3854in" id="_x0000_i1033" src="cid:image016.png@01D5CB96.B1064A10" alt="TOMRA"></span></a><a href="https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2FCompacsort&data=02%7C01%7Cgavin.lambert%40tomra.com%7C4b3b15b54f044eebdaa708d7991de79b%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637146226040031173&sdata=1Rq7fLg35mGP2jS%2B1yNJN2gtiFCdVVEzQh0%2B4qdIeBA%3D&reserved=0"><span style="text-decoration:none"><img border="0" width="35" height="37" style="width:.3645in;height:.3854in" id="_x0000_i1034" src="cid:image017.png@01D5CB96.B1064A10" alt="Facebook"></span></a><a href="https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fcompac-sorting-equipment%2F&data=02%7C01%7Cgavin.lambert%40tomra.com%7C4b3b15b54f044eebdaa708d7991de79b%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637146226040031173&sdata=8oqC9gF%2BpAOMtg5nATDvi%2BA4mry%2Fr9T%2BvT3IcrsNTzE%3D&reserved=0"><span style="text-decoration:none"><img border="0" width="35" height="37" style="width:.3645in;height:.3854in" id="_x0000_i1035" src="cid:image018.png@01D5CB96.B1064A10" alt="Linkedin"></span></a><a href="https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvimeo.com%2Fcompacsort&data=02%7C01%7Cgavin.lambert%40tomra.com%7C4b3b15b54f044eebdaa708d7991de79b%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637146226040041156&sdata=k9vb8wDv3nTbG73RzJB1hJwgWJu62vop%2F98FljaDqL8%3D&reserved=0"><span style="text-decoration:none"><img border="0" width="37" height="37" style="width:.3854in;height:.3854in" id="_x0000_i1036" src="cid:image019.png@01D5CB96.B1064A10" alt="Youtube"></span></a><a href="https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2Fcompacsort&data=02%7C01%7Cgavin.lambert%40tomra.com%7C4b3b15b54f044eebdaa708d7991de79b%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637146226040041156&sdata=bXRsdGYBgSVy8MMpjDMlbTBBNN4UFkKW%2FDYTUsxbc4c%3D&reserved=0"><span style="text-decoration:none"><img border="0" width="33" height="37" style="width:.3437in;height:.3854in" id="_x0000_i1037" src="cid:image020.png@01D5CB96.B1064A10" alt="twitter"></span></a><a href="https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.instagram.com%2Fcompacsort%2F&data=02%7C01%7Cgavin.lambert%40tomra.com%7C4b3b15b54f044eebdaa708d7991de79b%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637146226040041156&sdata=UG2Y7WPg%2Fb2J1lKmViy%2FtxuRlwmoVqkY8KdntuY3hV0%3D&reserved=0"><span style="text-decoration:none"><img border="0" width="33" height="37" style="width:.3437in;height:.3854in" id="_x0000_i1038" src="cid:image021.png@01D5CB96.B1064A10" alt="instagram"></span></a><o:p></o:p></span></p>
<p><b><span lang="EN-US" style="font-size:8.5pt;color:#595959">COMPAC SORTING EQUIPMENT LTD</span></b><span lang="EN-US" style="font-size:8.5pt;color:#595959"> | 4 Henderson Pl | Onehunga | Auckland 1061 | New Zealand<br>
Switchboard: +64 96 34 00 88 | <a href="https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.tomra.com&data=02%7C01%7Cgavin.lambert%40tomra.com%7C4b3b15b54f044eebdaa708d7991de79b%7C4308d118edd143008a37cfeba8ad5898%7C0%7C0%7C637146226040051153&sdata=dejDu98WBRDsRvE7srhHFlbHSHa1daBb%2BBEsuaasNJw%3D&reserved=0">
tomra.com</a> <o:p></o:p></span></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr>
<td valign="top" style="border-top:solid #595959 1.0pt;border-left:none;border-bottom:solid #595959 1.0pt;border-right:none;padding:0cm 0cm 0cm 0cm">
<p><span style="font-size:8.5pt;color:#595959">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. <o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<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;color:white">From:</span></b><span lang="EN-US" style="font-size:11.0pt"> Pierre Kurkdjian<br>
<b>Sent:</b> Saturday, 11 January 2020 08:50<br>
<b>To:</b> <a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<b>Subject:</b> [etherlab-users] New mailing list question</span><span lang="EN-US"><o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Hello Etherlab community,
</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">I would like to implement the entire ethercat state machine in C/C++.
</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Etherlab ethercat allows the users to select the ethercat state of each ethercat slave with command line, like that:
</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="p1"><span lang="EN-US">ethercat states -p0 INIT<o:p></o:p></span></p>
<p class="p1"><span lang="EN-US">ethercat states -p0 SAFEOP<o:p></o:p></span></p>
<p class="p1"><span lang="EN-US">ethercat states -p0 OP<o:p></o:p></span></p>
<p class="p1"><span lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">My question is: Is there a way to do the same thing using the C functions?</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">It’s possible to go to preop by reserving a master (calling ecrt_request_master() ).
</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">It’s possible to go to op by activating the master (calling ecrt_request_master() ).
</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">But is there a way to go to safeop and to boot ?</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Thank you for your time.
</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"> </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Best, </span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Pierre Kurkdjian</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Real-Time Software Engineer</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Giant Magellan Telescope Organization</span><span lang="EN-US"><o:p></o:p></span></p>
</div>
</body>
</html>