CANopen Service Data Objects
CANopen - Service Data Objects (SDO)
All user adjustable parameters are accessible through the CAN communication interface using Service Data Objects (SDO)
The operation of SDOs is on the basis of client/server relationship. The client sends requests and the server responds to those requests.
SDO Functions
SDO message may be used for the following functions:
Read a parameter value
Write to a parameter
SDO COB-ID
By default, SDO messages have the following COB-ID's:
Client to server message has the COB-ID 600h + node ID
Server to client response will have the COB-ID 580h + node ID
The node ID is the value set in Parameter P2-07 CANopen Address.
SDO Message Format
SDO messages have the following format:
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 |
|---|---|---|---|---|---|---|---|
Control Byte | Index (16 Bit) | Sub Index (8 Bit) | Data (Up to 32 Bits) | ||||
LSB | MSB | ||||||
SDO Control Byte
The following values for the SDO Control Byte are supported:
Control Byte | Function |
|---|---|
0x40 | Read Request (Any Size Data) |
0x4F | Read Request - Single Byte |
0x4B | Read Request - Single Word |
0x43 | Read Request - Double Word |
0x2F | Write Request - Single Byte |
0x2B | Write Request - Single Word |
0x23 | Write Request - Double Word |
0x60 | Write Response - Successful |
0x80 | Write Response - Unsuccessful |
The following are examples of using the SDO to read or write data.
Example 1 - Client request the value of Index 1018h Sub Index 1 (Vendor ID) from server with node-ID = 1
SDO Message: Client to Server:
COB-ID | Control Byte | Index | Sub Index | Data | |
|---|---|---|---|---|---|
0x601 | 0x40 | 0x18 | 0x10 | 0x0 | Not Required |
Note
COB-ID of the request = 0x600 + node ID so for node ID= 1, 0x601
The Index value is transferred with MSB first
The expected response would be:
COB-ID | Control Byte | Index | Sub Index | Data | |
|---|---|---|---|---|---|
0x581 | 0x4B | 0x18 | 0x10 | 0x0 | Data Value (Single Word) |
Note
The COB-ID of the response telegram is 0x580 + Node-ID so for Node-ID = 1, the value is 0x581
The Control Byte will indicate the data length, in this example a single word value
Example 2 - Client attempts to write the value of Index 1018h Sub Index 1 (Vendor ID) from server with node-ID = 1
In this case, the message from the Client to the server becomes:
COB-ID | Control Byte | Index | Sub Index | Data | |
|---|---|---|---|---|---|
0x601 | 0x2B | 0x18 | 0x10 | 0x0 | e.g. 0x0001 |
The Vendor ID value will be read only and therefore the Server should reject the request as follows:
COB-ID | Control Byte | Index | Sub Index | Data | |
|---|---|---|---|---|---|
0x581 | 80 | 0x18 | 0x10 | 0x0 | 0x06010002 |
The server will respond with an error code, see the Section SDO Error Code Responses for details on the error codes.
If an error occurs, for instance an entry does not exist, the device returns a message containing a completion code that represents the error.
The following table lists some of the common error code response that may be received.
Data Value | Meaning |
|---|---|
0x05040000 | SDO Timeout |
0x05040001 | Invalid Control Byte |
0x06010002 | Write Access attempted to a Read Only value |
0x0602000 | SDO Object does not exist |
0x06040041 | The referenced object cannot be mapped to a PDO |
0x06020042 | The size or number of mapped objects results in an invalid PDO size |
0x06070010 | Data type or length is not compatible |
0x06090011 | SDO Sub Index does not exist |
0x06090031 | Parameter value too low |
0x06090032 | Parameter value too high |