Solution
A single, non-segmented CANopen SDO message can carry up to 4 bytes of data. The CANopen SDO Read function in the toolkit lets you choose different data types like U8, I8, U16, I16, and so on. The buffer size for incoming data changes depending on the data type you select. For instance:
- U8/I8 uses a 1-byte buffer
- U16/I16 uses a 2-byte buffer
- U32/I32 uses a 4-byte buffer
If a CANopen device sends more data than the buffer can handle, a buffer overflow will occur. To avoid this issue, you must use an SDO Read function that matches the maximum number of bytes the device might send.
An alternative is to use the SDO Read Block function shown below, which allows you to change the buffer size and outputs an unprocessed U8 array, which you can then manipulate as needed.

Another option is to read the data as a string, which can handle any number of bytes and then typecast it to the required data type. In the example illustrated below, the string data is cast into a U16 array using the Type Cast function.
