[etherlab-users] Writing SoE IDN during real-time context
Tom Wong-Cornall
tom at wongcornall.com
Thu Jul 4 05:55:39 CEST 2019
Hello all,
First of all thanks for the terrific stack, we've made really rapid progress
integrating EtherLab into our existing software.
For reference, our kernel is 4.14 using RT-PREEMPT, EtherLab is 1.5.2 with
Gavin's patches (cribbed from https://github.com/ribalda/ethercat). We are
using the ecrt library in user-mode.
We do have one remaining issue to iron out however. We are using Beckhoff
AX5000 servo drives (all single channel AX51xx-series) which are SoE devices.
After a serious (Sercos "class 1") fault (e.g. over-current, over-temperature
etc.) they require the fault to be acknowledged by writing to IDN S-0-0099.
This IDN cannot be mapped into process data, so must be written with an
explicit SoE write request.
S-0-0099 is listed as being changeable in PreOp, SafeOp and Op, and TwinCAT is
happy to write to it while running in Op. One can also trigger the same
fault-clearing functionality through the little LCD menu on the front-panel of
the drives, which works seamlessly while our cyclic task continues to run and
is even referred to in Beckhoff's docs as corresponding to S-0-0099. Of course
we will be hiding the drives away in a cabinet so we'd like to do it through
EtherLab.
The ecrt.h prototype documentation doesn't mention that a
ecrt_master_write_idn() *can't* be called from within the realtime context,
but testing this seems to indicate it shouldn't be called within the cyclic
task; we immediately lock up our loop. In any case, given
ecrt_master_write_idn() is blocking I don't think we want to call it in a
sensitive (=many DC slaves) loop.
Using the command-line tool to write the IDN while our realtime application
continues to run *mostly* works, although frequently the IDN either fails to
write, or sometimes even blocks the command-line tool entirely from returning
until our main application is terminated. Debug output from ethercat shows the
following repeating ad infinitum:
EtherCAT DEBUG 0-main-4: SSC write request:
EtherCAT DEBUG: 03 40 63 00 00 00
EtherCAT DEBUG 0-main-4: SSC write request:
EtherCAT DEBUG: 03 40 63 00 00 00
EtherCAT DEBUG 0-main-4: SSC write request:
EtherCAT DEBUG: 03 40 63 00 00 00
We have also tried calling the same ioctl in a separate thread (outside of our
cyclic task thread) to write to the IDN; this produces basically identical
results as the command-line tool (works 80% of the time, with occasional
lockups and need to reboot or at least restart the master).
Is there something we've missed? I feel if we could request a transition back
to Idle or PreOp this might be enough, maybe even using
ecrt_slave_config_idn() to write to S-0-0099 automatically. However there are
no knobs I can see to request a slave state change (at least from user-mode),
is this correct?
The nuclear option would be to restart all slaves by using
ecrt_master_deactivate() and then starting from scratch, but this seems
somewhat brutal if it's just a matter of writing an IDN.
Thanks once again,
Tom
More information about the Etherlab-users
mailing list