0

I am trying to figure out, what state I can store the current configuration by writing to the store index 1010.01 in the CANopen object dictionary. I tried doing it in the preoperational state but got this error

Time:    2914.034 SDO slave:1 index:1010.01 error:08000022 Data cannot be transferred or stored to the application because of the present device state
uint32_t store_password =  0x65766173;
ret = ec_SDOwrite(slave, 0x1010, 0x01, FALSE, sizeof(store_password), &store_password, EC_TIMEOUTTXM);

It is worth noting that I am using CANopen over EtherCAT with the SOEM library.

Sourabh Choure
  • 723
  • 4
  • 15
Steve
  • 3
  • 4
  • Are you sure that you actually are in pre-operational state though? Do you have Heartbeat etc enabled so that you can verify this? – Lundin Aug 10 '20 at 13:29
  • Yes, i am sure, i am able to write to other object – Steve Aug 10 '20 at 20:11

1 Answers1

0

This sounds like non-compliant behavior. As far as I know, CANopen does not specify which state you must be in when writing to 1010h.

I would recommend to always do this in the pre-operational state, since writing to flash etc might be time consuming and interrupt real-time behavior, if executed from the operational state (and SDO timeouts might occur).


Non-related to the question, it would be more readable to use this:

const char store_password [4] = "save"; // null termination purposely ignored
... sizeof(store_password), store_password, ...

This also removes the endianess dependency in your current code.

Lundin
  • 195,001
  • 40
  • 254
  • 396