OpenEtherCATsociety / SOEM

Simple Open Source EtherCAT Master
Other
1.24k stars 653 forks source link

get EMCY values #760

Closed open04 closed 7 months ago

open04 commented 7 months ago

Hi, Is there a way to get the Emergency Messages(EMCY) values? Thanks

ArthurKetels commented 7 months ago

They are automatically handled by the mailbox receive function. Any time ecx_mbxreceive() is called it checks if an emergency message is received, if so it puts it in the error list. This can be checked by ecx_iserror(), and retrieved by ecx_poperror().

It is up to the master application to setup a mechanism to read slave mailboxes at appropriate times. The most efficient way is to program an FMMU on the slave to mirror the mailbox SM state in the PDO mapping.

As a separate remark, it is not recommended for slave manufacturers to use the emergency mailbox protocol. It is inefficient and can be difficult to implement with regards to real-time requirements. This is legacy CANopen stuff, slave errors should be handled in the PDO mapping.

open04 commented 7 months ago

Thanks Arthur for the reply, Ill give it a try still. I will just discard it if it does not fit in my application