CANopen Slave Documentation
Version 7.00.00
|
With Service Data Objects (SDOs) the access to entries of a device Object Dictionary is provided. As these entries may contain data of arbitrary size and data type SDOs can be used to transfer multiple data sets (each containing an arbitrary large block of data) from a client to a server and vice versa. The client can control via a multiplexor (index and sub-index of the Object Dictionary) which data set is to be transferred. The contents of the data set are defined within the Object Dictionary.
This file is part of the optional package "Mini-Master".
Data Structures | |
struct | CoObject_s |
Enumerations | |
enum | CosSdoStat_e { eCOS_SDO_STAT_EXP_RD = 1 , eCOS_SDO_STAT_SEG_RD , eCOS_SDO_STAT_BLK_RD , eCOS_SDO_STAT_EXP_WR , eCOS_SDO_STAT_SEG_WR , eCOS_SDO_STAT_BLK_WR , eCOS_SDO_STAT_SUCCESS , eCOS_SDO_STAT_ABORT , eCOS_SDO_STAT_TIMEOUT , eCOS_SDO_STAT_ERR , eCOS_SDO_STAT_EMPTY , eCOS_SDO_STAT_SIZE } |
enum | CosSdoMarker_e { eCOS_SDO_MARKER_USER_END = 200 , eCOS_SDO_MARKER_NODE_SET_HEARTBEAT } |
enum | CosSdoConfig_e { eCOS_SDO_CONFIG_DEFAULT = 0 , eCOS_SDO_CONFIG_CMD_LEN = 1 , eCOS_SDO_CONFIG_BLOCK = 2 } |
Functions | |
void | CosSdoClnEventObjectReady (uint8_t ubNodeIdV, CoObject_ts *ptsCoObjV, uint32_t *pulAbortV) |
void | CosSdoClnEventTimeout (uint8_t ubNodeIdV, CoObject_ts *ptsCoObjV) |
uint8_t | CosSdoClnGetStatus (void) |
uint8_t | CosSdoClnReadObject (uint8_t ubNodeIdV, CoObject_ts *ptsCoObjV, uint16_t uwObjCntV, uint32_t *pulErrCodeV) |
uint8_t | CosSdoClnWriteObject (uint8_t ubNodeIdV, CoObject_ts *ptsCoObjV, uint16_t uwObjCntV, uint32_t *pulErrCodeV) |
void | CosSdoClnSendAbort (uint8_t ubNodeIdV, uint16_t uwIndexV, uint8_t ubSubIndexV, uint32_t ulErrCodeV) |
void | CosSdoClnSetConfiguration (uint8_t ubConfigV) |
void | CosSdoClnSetTimeout (uint16_t uwTimeV) |
enum CosSdoConfig_e |
SDO client configuration.
The enumeration defines configuration values for the SDO client behaviour, which is set via the function CosSdoClnSetConfiguration().
enum CosSdoMarker_e |
SDO transfer marker.
The enumeration defines values for the marker field inside the CANopen object structure CoObject_s. The marker field can be evaluated inside the CosSdoClnEventObjectReady() function.
Enumerator | |
---|---|
eCOS_SDO_MARKER_USER_END | Last possible value for user-defined marker |
eCOS_SDO_MARKER_NODE_SET_HEARTBEAT | Marker for CosNmtMasterSetHeartbeat() function call |
enum CosSdoStat_e |
SDO transfer status.
The enumeration defines the status of a SDO client connection. It can be requested with the ComSdoGetStatus() function.
void CosSdoClnEventObjectReady | ( | uint8_t | ubNodeIdV, |
CoObject_ts * | ptsCoObjV, | ||
uint32_t * | pulAbortV ) |
[in] | ubNodeIdV | Node-ID value |
[in] | ptsCoObjV | Pointer to object structure |
[in] | pulAbortV | Pointer to SDO abort code |
This handler is called after the SDO data transfer has finished. If the SDO transfer has been initiated by CosSdoClnReadObject() or CosSdoClnWriteObject() the parameter ptsCoObjV points to the last object which has been read or written. Otherwise the pointer ptsCoObjV is 0L. The user defined marker within the structure CoObject_ts can be used to track SDO operations.
In case of a SDO abort, the pointer pulAbortV allows to read the last abort code. The value of pulAbortV is 0L when no SDO error occurred.
void CosSdoClnEventTimeout | ( | uint8_t | ubNodeIdV, |
CoObject_ts * | ptsCoObjV ) |
[in] | ubNodeIdV | Node-ID value |
[in] | ptsCoObjV | Pointer to object structure |
This handler is called if a SDO timer condition occurred. The parameters uwIndexV and ubSubIndexV define the object that was accessed. The SDO communication timeout can be configured by the ComSdoSetTimeout() function.
uint8_t CosSdoClnGetStatus | ( | void | ) |
Get SDO transfer status.
This function returns the status of a SDO connection, possible values are given by the enumeration CosSdoStat_e.
uint8_t CosSdoClnReadObject | ( | uint8_t | ubNodeIdV, |
CoObject_ts * | ptsCoObjV, | ||
uint16_t | uwObjCntV, | ||
uint32_t * | pulErrCodeV ) |
[in] | ubNodeIdV | Node-ID value |
[in] | ptsCoObjV | Pointer to object structure |
[in] | uwObjCntV | Number of objects to read |
[in] | pulErrCodeV | Pointer to optional abort code data |
This function will start a read request for an object that is defined by the pointer ptsCoObjV.
void CosSdoClnSendAbort | ( | uint8_t | ubNodeIdV, |
uint16_t | uwIndexV, | ||
uint8_t | ubSubIndexV, | ||
uint32_t | ulErrCodeV ) |
[in] | ubNodeIdV | Node-ID value |
[in] | uwIndexV | Index of object |
[in] | ubSubIndexV | Sub-index of object |
[in] | ulErrCodeV | SDO error code |
This function is sends a SDO abort message. The abort code is taken from the file canopen.h (SDO_ERR_XXX). The identifier for the abort message is calculated via the node address ubNodeIdV.
void CosSdoClnSetConfiguration | ( | uint8_t | ubConfigV | ) |
[in] | ubConfigV | SDO client configuration value |
This function is used to change the behaviour of the SDO client. The possible configuration values are defined via the CosSdoConfig_e enumeration.
void CosSdoClnSetTimeout | ( | uint16_t | uwTimeV | ) |
[in] | uwTimeV | - timeout value in milliseconds |
This function sets a timeout value for a SDO communication. If the response to a SDO request by the master takes longer than this timeout value, the state of the communication will be changed to eCOS_SDO_STAT_TIMEOUT. The state of the SDO communication can be evaluated by calling the function CosSdoClnGetStatus(). Please note that the timeout value is a multiple of the timer period (COS_TIMER_PERIOD). A value supplied to this function will be rounded towards the next lower value if necessary.
uint8_t CosSdoClnWriteObject | ( | uint8_t | ubNodeIdV, |
CoObject_ts * | ptsCoObjV, | ||
uint16_t | uwObjCntV, | ||
uint32_t * | pulErrCodeV ) |
[in] | ubNodeIdV | Node-ID value |
[in] | ptsCoObjV | Pointer to object structure |
[in] | uwObjCntV | Number of objects to read |
[in] | pulErrCodeV | Pointer to optional abort code data |
This function will start a write request for for an object that is defined by the pointer ptsCoObjV.