CANopenNode / CANopenLinux

CANopenNode on Linux devices
Apache License 2.0
111 stars 51 forks source link

RPDO / TPDO limit #18

Closed MaroZz closed 6 months ago

MaroZz commented 6 months ago

Trying to start canopend with more than 4 RPDOs or 4 TPDOs.

(I am editing OD.c and OD.h with ObjectDictionaryEditor as suggested in the documentation).

So far, I've tested these combinations:

4 empty RPDOs + 4 empty TPDOs = working okay. 3 empty RPDOs + 4 empty TPDOs = node starts with Emergency errorCode=0x5000, errorRegister=0x11, errorBit=0x2F. 5 empty RPDOs + 4 empty TPDOs = node starts with Emergency errorCode=0x5000, errorRegister=0x11, errorBit=0x2F. 4 empty RPDOs + 3 empty TPDOs = node starts with Emergency errorCode=0x5000, errorRegister=0x11, errorBit=0x2F. 4 empty RPDOs + 5 empty TPDOs = node starts with Emergency errorCode=0x5000, errorRegister=0x11, errorBit=0x2F.

At the same time, when I try to read communication parameters for the fifth PDO like this: ./cocomm "r 0x1804 1 x32" ./cocomm "r 0x1A04 0 u8" it's reporting correct values.

CANopen documentation says there is no limit, and I can configure up to 512 PDOs. I can't figure out what I'm doing wrong.

CANopenNode commented 6 months ago

See CO_Emergency for errorBit 0x2F. In you case this is CO_EM_NON_VOLATILE_MEMORY. Probably you have a storage file for your old object dictionary in a directory, where you are starting canopend. You can delete that file(s) (*.persist?) or ./cocomm "r 0x1010 1 vs save" or ./cocomm "r 0x1011 1 vs load"

MaroZz commented 6 months ago

It seems like my issue is not related to the number of PDOs in the Object Dictionary.

For everyone else experiencing the same behavior:

As the author mentioned above, it's all about saving node parameters to a file. After updating the Object Dictionary, you need to follow a procedure like this:

rm -rf *.persist*
./canopend can0 -i 10
/* here its throwing error 0x5000 */
./cocomm "10 w 0x1010 1 vs save"
./cocomm "10 w 0x1011 1 vs load"
/* interrupt canopend by ctrl c */
./canopend can0 -i 10
/* now it should start normally*/
CANopenNode commented 6 months ago

This situation is described in https://github.com/CANopenNode/CANopenDemo/tree/master/tutorial

however, canopend needs valid storage files, otherwise it throws CO_EM_NON_VOLATILE_MEMORY error. So it is necessary to initialize them on the beginning (if there are no storage files) and on the change of object dictionary (by CANopenEditor). Removing the files does not help. Just use this:

./cocomm "10 w 0x1011 1 vs load"
# interrupt canopend by ctrl c and restart it