Search code examples
can-buscanopen

Are unused bytes set to zero in response to SDO reads?


I send and SDO request to read a 1 byte value like this:

|11 bit COD-ID | byte 0 | byte 1 | byte 2 | byte 3   | byte 4 | byte 5 | byte 6 | byte 7 |
| 0x0601       | 0x40   |      index      | subindex | 0x00   | 0x00   | 0x00   | 0x00   |

and the device responds with:

|11 bit COD-ID | byte 0 | byte 1 | byte 2 | byte 3   | byte 4 | byte 5 | byte 6 | byte 7 |
| 0x581        | 0x4F   |      index      | subindex | 0xFF   | 0x00   | 0x00   | 0x00   |

0x4F means that the returned value is only 8 bit wide, only byte 4 is set. What about byte 5, 6, and 7. Are they guaranteed to be zero by the standard?


Solution

  • Yes, CAN frames involved in SDO requests always have an 8-byte payload. Unused bytes are set to 0 and should be ignored by the recipient.

    This is guaranteed by CiA 301 section 7.2.4.3, which describes the SDO protocol.