rtlabs-com/c-open

PDO size mismatch EMCY

nattgris opened this issue · 1 comments

In some setups, a TPDO on another node can have slightly different setups depending on the manufacturer/type of the particular device. For example, a device profile may mandate that PDO X contains object A, while some devices are mapping both object A and B in that PDO. Even if we only want to use object A (which is guaranteed to be available) and only have it mapped in our RPDO, the stack throws an EMCY with code 0x8210 just because it receives a PDO with "additional junk" on the end.

This is covered by §7.5.2.36 in CiA 301 which states (emphasis mine):

If a CANopen device receives a PDO that is having less data bytes than the number of mapped data bytes (length), then the CANopen device shall initiate the EMCY write service, if supported, with the error code 8210 h.

And, a little earlier in the paragraph:

If the CANopen device receives a PDO that is having more data bytes than the number of mapped data bytes is (length), then the CANopen device shall use the first data bytes up to the length and may be initiate the EMCY write service, if supported.

So the case with extra data in the PDO is not necessary to write an EMCY for (it does not even state the code to use) and in cases like this also not very helpful. Can the check be disabled for this case, or if it makes sense to have it in other cases, at least be able to disable it by configuration?

The spec seems clear in that the data shall be used, so disabling the check makes sense. If possible, please send a PR including a testcase.