[etherlab-users] New mailing list question

Gavin Lambert gavin.lambert at tomra.com
Tue Jan 14 23:13:33 CET 2020


Please keep replies on the mailing list.

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.

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 (https://sourceforge.net/u/uecasm/etherlab-patches/ci/default/tree/) adds an foe_request API that can be used asynchronously, although it’s more complex to manage.

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.


Gavin Lambert
Senior Software Developer

[cid:logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png]
[cid:compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png]<http://www.compacsort.com> [cid:facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png] <https://www.facebook.com/Compacsort>  [cid:linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png] <https://www.linkedin.com/company/compac-sorting-equipment/>  [cid:youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png] <https://vimeo.com/compacsort>  [cid:twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png] <https://twitter.com/compacsort>  [cid:insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png] <https://www.instagram.com/compacsort/>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New Zealand
Switchboard: +64 96 34 00 88 | tomra.com<http://www.tomra.com>

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.

From: Pierre Kurkdjian <pkurkdjian at gmto.org>
Sent: Wednesday, 15 January 2020 07:17
To: Gavin Lambert <gavin.lambert at tomra.com>
Subject: Re: [EXTERNAL] RE: New mailing list question

Hello Gavin,

Thank you for your answer.
Indeed I need to go to BOOT state in order to update the slave firmware.
I need to automatize the firmware loading with a C/C++ program so I need to go to BOOT.
I think the only solution consists in calling the command line “ethercat state -p0 BOOT” by a C/C++ function.

Best,
Pierre Kurkdjian
Real-Time Software Engineer
Giant Magellan Telescope Organization


From: Gavin Lambert <gavin.lambert at tomra.com<mailto:gavin.lambert at tomra.com>>
Date: Sunday, January 12, 2020 at 2:27 PM
To: Pierre Kurkdjian <pkurkdjian at gmto.org<mailto:pkurkdjian at gmto.org>>
Subject: [EXTERNAL] RE: New mailing list question

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.)

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.

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).


Gavin Lambert
Senior Software Developer


[cid:image001.png at 01D5CB94.855C6180]
[cid:image002.png at 01D5CB94.855C6180]<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>[cid:image003.png at 01D5CB94.855C6180]<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>[cid:image004.png at 01D5CB94.855C6180]<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>[cid:image005.png at 01D5CB94.855C6180]<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>[cid:image006.png at 01D5CB94.855C6180]<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>[cid:image007.png at 01D5CB94.855C6180]<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>

COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New Zealand
Switchboard: +64 96 34 00 88 | tomra.com<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>

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.

From: Pierre Kurkdjian
Sent: Saturday, 11 January 2020 08:50
To: etherlab-users at etherlab.org<mailto:etherlab-users at etherlab.org>
Subject: [etherlab-users] New mailing list question

Hello Etherlab community,

I would like to implement the entire ethercat state machine in C/C++.
Etherlab ethercat allows the users to select the ethercat state of each ethercat slave with command line, like that:

ethercat states -p0 INIT

ethercat states -p0 SAFEOP

ethercat states -p0 OP

…
My question is: Is there a way to do the same thing using the C functions?
It’s possible to go to preop by reserving a master (calling ecrt_request_master() ).
It’s possible to go to op by activating the master (calling ecrt_request_master() ).
But is there a way to go to safeop and to boot ?

Thank you for your time.

Best,
Pierre Kurkdjian
Real-Time Software Engineer
Giant Magellan Telescope Organization
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 11439 bytes
Desc: image001.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0014.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 1630 bytes
Desc: image002.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0015.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 1751 bytes
Desc: image003.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0016.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 1856 bytes
Desc: image004.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0017.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 1971 bytes
Desc: image005.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0018.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 20279 bytes
Desc: image006.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0019.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.png
Type: image/png
Size: 1507 bytes
Desc: image007.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0020.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png
Type: image/png
Size: 11438 bytes
Desc: logo_compac_5dcf97ef-52f5-498c-8b9b-728410ddffaf.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0021.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png
Type: image/png
Size: 1629 bytes
Desc: compacicon_82e8a8c7-154a-4a32-9720-a5badb6258e0.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0022.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png
Type: image/png
Size: 1750 bytes
Desc: facebook_fa85b924-53b9-45cc-8162-0564f64ec3a3.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0023.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png
Type: image/png
Size: 1855 bytes
Desc: linkedin_4ec016ad-84fa-443c-85a3-b9615a4ccef8.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0024.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png
Type: image/png
Size: 1970 bytes
Desc: youtube_32142163-fc27-4aed-b14d-e8a377f98a6d.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0025.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png
Type: image/png
Size: 20278 bytes
Desc: twitter_d89338d8-98c8-4b65-9a9e-7b1333160b0d.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0026.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png
Type: image/png
Size: 1506 bytes
Desc: insta2_1cd85de9-b3a2-4971-9904-52b2481a7c82.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200114/c7dd47a4/attachment-0027.png>


More information about the etherlab-users mailing list