[etherlab-users] AL States

Graeme Foot Graeme.Foot at touchcut.com
Fri Jul 3 01:12:44 CEST 2020

Hi Vincent,

If the master operational state is different to each slaves operational state.  If the master phase is in Operation (via the "ethercat master" command) it means that ecrt_master_activate() has been called and the master can activate the slaves that have been configured and realtime operation has begun.

If a slave is not configured the master does not know about it so it will stay in PREOP.
If a slave has a different alias to the one configured the master can not correctly connect to it so it will stay in PREOP.

For all slaves the master does know about, and can connect to, the master will attempt to bring them into OP mode.  However, each slave needs to be brought to OP mode via a state machine that takes a little time.  If you are not using Gavin Lamberts patchset the master will do so one slave at a time.  If you are using his patchset then it will do ~ 16 slaves in parallel at a time, so somewhat faster.

Conversely, when you call ecrt_master_deactivate() all known and connected slaves are returned to PREOP and then the master goes to the Idle phase.

Also, just to add a little extra, if the master is idle you can use the "ethercat states" command to manually request a state on a particular slave.  So a slave could actually be in OP state while the master is idle.

So to directly answer your question "Can master be considered as OP state if at least one slave is in OP state?": No.

If you have called ecrt_master_activate(), and it returned success, your master is operational, until you call ecrt_master_deactivate().  However, whether you consider your system ready to use will probably depend in whether all your required slaves are up and running at the OP state.

And for extra credit, slaves can be hot connected and comms can be interrupted.  If the master is active it will handle slaves disappearing and appearing and, for configured slaves, run through their state machines to get them back to OP mode automatically.  So if you have a group of slaves that can be disconnected (on purpose), put them in a separate domain and use ecrt_domain_state() to check the wc_state parameter to ensure that group of slaves is fully operational for the functions they need to perform.


From: BUSSIERES Vincent <vincent.bussieres at hemeria-group.com>
Sent: Friday, 3 July 2020 8:15 AM
To: Graeme Foot <Graeme.Foot at touchcut.com>; etherlab-users at etherlab.org
Subject: RE: AL States


Indeed, some slaves are not in OP state. There are 6 slaves on my network, two of them are in PREOP state.

I can get their states using ethercat slaves -v command but when I run ethercat master command, master is in OP state.

Can master be considered as OP state if at least one slave is in OP state?

Best reagards

De : Graeme Foot <Graeme.Foot at touchcut.com<mailto:Graeme.Foot at touchcut.com>>
Envoyé : lundi 29 juin 2020 00:12
À : BUSSIERES Vincent; etherlab-users at etherlab.org<mailto:etherlab-users at etherlab.org>
Objet : RE: AL States


If you are using ecrt_master_state() the al_states parameter is filled in by all slaves with an OR operation.  So for each bit that is set you can interpret that as at least one slave was in that state.  If there is a state bit set you are not happy with (or expecting) then you will need to interrogate each slave individually to find out which slave(s) are in that state, using ecrt_slave_config_state().

On startup (or comms interruption and recovery) you can expect to see slaves at different stages on the way to OP mode.  If you are fully operational and you have a PREOP bit set, then you likely have a device that is not known so is not configured, or has the wrong address so it is not being attached to correctly.  If a slave stays in SAFEOP then you probably have a configuration error, check the logs to figure out the problem.



From: etherlab-users <etherlab-users-bounces at etherlab.org<mailto:etherlab-users-bounces at etherlab.org>> On Behalf Of BUSSIERES Vincent
Sent: Friday, 26 June 2020 9:25 PM
To: etherlab-users at etherlab.org<mailto:etherlab-users at etherlab.org>
Subject: [etherlab-users] AL States


I'd like to display AL state in my HMI.

AL states are :
·         Bit0 : INIT
·         Bit1 : PREOP
·         Bit2 : SAFEOP
·         Bit3 : OP

But when I read AL states, states are respetively :

·         0x02      (0010)
·         0x03      (0011)
·         0x0a      (1010)
·         0x0e      (1110)
·         0x0a      (1010)

So, in some cases I don't know in which state I am ?

How can I determine AL State ?



Responsable Technique Logiciel


ZE Ma Campagne

36, Impasse Félix Nadar


Tel: 33 (0)

P Afin de contribuer au respect de l'environnement, merci de n'imprimer ce courriel qu'en cas de nécessité.

Ce message et les fichiers pouvant être attachés sont confidentiels, réservés à l'usage unique des destinataires et n'engagent HEMERIA sous aucune forme que ce soit.
This email and any files transmitted with it are confidential, intented solely for the unique use of the recipients and don't commit HEMERIA.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200702/30b547fc/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5034 bytes
Desc: image001.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200702/30b547fc/attachment-0004.png>

More information about the Etherlab-users mailing list