Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Service Data Object (SDO)
[Communication Objects]
SDOs provide the access to entries in the CANopen Object Dictionary. More...
Functions | |
| UNS8 | writeNetworkDict (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 count, UNS8 dataType, void *data) |
| Used to send a SDO request frame to write the data at the index and subIndex indicated. | |
| UNS8 | writeNetworkDictCallBack (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback) |
| Used to send a SDO request frame to write in a distant node dictionnary. | |
| UNS8 | writeNetworkDictCallBackAI (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize) |
| Used to send a SDO request frame to write in a distant node dictionnary. | |
| UNS8 | readNetworkDict (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType) |
| Used to send a SDO request frame to read. | |
| UNS8 | readNetworkDictCallback (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback) |
| Used to send a SDO request frame to read in a distant node dictionnary. | |
| UNS8 | readNetworkDictCallbackAI (CO_Data *d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback) |
| Used to send a SDO request frame to read in a distant node dictionnary. | |
| UNS8 | getReadResultNetworkDict (CO_Data *d, UNS8 nodeId, void *data, UNS32 *size, UNS32 *abortCode) |
| Use this function after calling readNetworkDict to get the result. | |
| UNS8 | getWriteResultNetworkDict (CO_Data *d, UNS8 nodeId, UNS32 *abortCode) |
| Use this function after calling writeNetworkDict function to get the result of the write. | |
Detailed Description
SDOs provide the access to entries in the CANopen Object Dictionary.
An SDO is made up of at least two CAN messages with different identifiers. SDO s are always confirmed point-to-point communications services.
Function Documentation
| UNS8 getReadResultNetworkDict | ( | CO_Data * | d, |
| UNS8 | nodeId, | ||
| void * | data, | ||
| UNS32 * | size, | ||
| UNS32 * | abortCode | ||
| ) |
Use this function after calling readNetworkDict to get the result.
- Parameters:
-
*d Pointer to a CAN object data structure nodeId Node Id of the slave *data Pointer to the datas *size Pointer to the size *abortCode Pointer to the abortcode. (0 = not available. Else : SDO abort code. (received if return SDO_ABORTED_RCV)
- Returns:
- SDO_FINISHED // datas are available
- SDO_ABORTED_RCV // Transfert failed (abort SDO received)
- SDO_ABORTED_INTERNAL // Transfert failed (internal abort)
- SDO_UPLOAD_IN_PROGRESS // Datas are not yet available
- SDO_DOWNLOAD_IN_PROGRESS // Download is in progress
example :UNS32 data; UNS8 size; readNetworkDict(0, 0x05, 0x1016, 1, 0) // get the data index 1016 subindex 1 of node 5 while (getReadResultNetworkDict (0, 0x05, &data, &size) == SDO_UPLOAD_IN_PROGRESS);
- Parameters:
-
d nodeId data size pointer to expected size, changed into returned size. Expected size will be truncated to transfered data size abortCode
- Returns:
| UNS8 getWriteResultNetworkDict | ( | CO_Data * | d, |
| UNS8 | nodeId, | ||
| UNS32 * | abortCode | ||
| ) |
Use this function after calling writeNetworkDict function to get the result of the write.
It is mandatory to call this function because it is releasing the line used for the transfer.
- Parameters:
-
*d Pointer to a CAN object data structure nodeId Node Id of the slave *abortCode Pointer to the abortcode - 0 = not available.
- SDO abort code (received if return SDO_ABORTED_RCV)
- Returns:
- :
- SDO_FINISHED // datas are available
- SDO_ABORTED_RCV // Transfert failed (abort SDO received)
- SDO_ABORTED_INTERNAL // Transfert failed (Internal abort)
- SDO_DOWNLOAD_IN_PROGRESS // Datas are not yet available
- SDO_UPLOAD_IN_PROGRESS // Upload in progress
example :UNS32 data = 0x50; UNS8 size; UNS32 abortCode; writeNetworkDict(0, 0x05, 0x1016, 1, size, &data) // write the data index 1016 subindex 1 of node 5 while (getWriteResultNetworkDict (0, 0x05, &abortCode) == SDO_DOWNLOAD_IN_PROGRESS);
- Parameters:
-
d nodeId abortCode
- Returns:
| UNS8 readNetworkDict | ( | CO_Data * | d, |
| UNS8 | nodeId, | ||
| UNS16 | index, | ||
| UNS8 | subIndex, | ||
| UNS8 | dataType | ||
| ) |
Used to send a SDO request frame to read.
- Parameters:
-
*d Pointer to a CAN object data structure nodeId Node Id of the slave index At index indicated subIndex At subIndex indicated dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
- Returns:
- 0 is returned upon success.
- 0xFE is returned when no sdo client to communicate with node.
- 0xFF is returned when error occurs.
- Parameters:
-
d nodeId index subIndex dataType
- Returns:
| UNS8 readNetworkDictCallback | ( | CO_Data * | d, |
| UNS8 | nodeId, | ||
| UNS16 | index, | ||
| UNS8 | subIndex, | ||
| UNS8 | dataType, | ||
| SDOCallback_t | Callback | ||
| ) |
Used to send a SDO request frame to read in a distant node dictionnary.
The function Callback which must be defined in the user code is called at the end of the exchange. (on succes or abort).
- Parameters:
-
*d Pointer on a CAN object data structure nodeId Node Id of the slave index At index indicated subIndex At subIndex indicated dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. Callback Callback function
- Returns:
- 0 is returned upon success.
- 0xFE is returned when no sdo client to communicate with node.
- 0xFF is returned when error occurs.
- Parameters:
-
d nodeId index subIndex dataType Callback
- Returns:
| UNS8 readNetworkDictCallbackAI | ( | CO_Data * | d, |
| UNS8 | nodeId, | ||
| UNS16 | index, | ||
| UNS8 | subIndex, | ||
| UNS8 | dataType, | ||
| SDOCallback_t | Callback | ||
| ) |
Used to send a SDO request frame to read in a distant node dictionnary.
The function Callback which must be defined in the user code is called at the end of the exchange. (on succes or abort). First free SDO client parameter is automatically initialized for specific node if not already defined.
- Parameters:
-
*d Pointer on a CAN object data structure nodeId Node Id of the slave index At index indicated subIndex At subIndex indicated dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. Callback Callback function
- Returns:
- 0 is returned upon success.
- 0xFF is returned when error occurs.
| UNS8 writeNetworkDict | ( | CO_Data * | d, |
| UNS8 | nodeId, | ||
| UNS16 | index, | ||
| UNS8 | subIndex, | ||
| UNS32 | count, | ||
| UNS8 | dataType, | ||
| void * | data | ||
| ) |
Used to send a SDO request frame to write the data at the index and subIndex indicated.
- Parameters:
-
*d Pointer to a CAN object data structure nodeId Node Id of the slave index At index indicated subIndex At subIndex indicated count number of bytes to write in the dictionnary. dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. *data Pointer to data
- Returns:
- 0 is returned upon success.
- 0xFE is returned when no sdo client to communicate with node.
- 0xFF is returned when error occurs.
- Parameters:
-
d nodeId index subIndex count dataType data
- Returns:
| UNS8 writeNetworkDictCallBack | ( | CO_Data * | d, |
| UNS8 | nodeId, | ||
| UNS16 | index, | ||
| UNS8 | subIndex, | ||
| UNS32 | count, | ||
| UNS8 | dataType, | ||
| void * | data, | ||
| SDOCallback_t | Callback | ||
| ) |
Used to send a SDO request frame to write in a distant node dictionnary.
The function Callback which must be defined in the user code is called at the end of the exchange. (on succes or abort).
- Parameters:
-
*d Pointer to a CAN object data structure nodeId Node Id of the slave index At index indicated subIndex At subIndex indicated count number of bytes to write in the dictionnary. dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. *data Pointer to data Callback Callback function
- Returns:
- 0 is returned upon success.
- 0xFE is returned when no sdo client to communicate with node.
- 0xFF is returned when error occurs.
- Parameters:
-
d nodeId index subIndex count dataType data Callback
- Returns:
| UNS8 writeNetworkDictCallBackAI | ( | CO_Data * | d, |
| UNS8 | nodeId, | ||
| UNS16 | index, | ||
| UNS8 | subIndex, | ||
| UNS32 | count, | ||
| UNS8 | dataType, | ||
| void * | data, | ||
| SDOCallback_t | Callback, | ||
| UNS8 | endianize | ||
| ) |
Used to send a SDO request frame to write in a distant node dictionnary.
The function Callback which must be defined in the user code is called at the end of the exchange. (on succes or abort). First free SDO client parameter is automatically initialized for specific node if not already defined.
- Parameters:
-
*d Pointer to a CAN object data structure nodeId Node Id of the slave index At index indicated subIndex At subIndex indicated count number of bytes to write in the dictionnary. dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value. *data Pointer to data Callback Callback function endianize When not 0, data is endianized into network byte order when 0, data is not endianized and copied in machine native endianness
- Returns:
- 0 is returned upon success.
- 0xFF is returned when error occurs.
Generated on Tue Jul 12 2022 17:24:13 by
1.7.2