|
void | ComSdoEventObjectReady (uint8_t ubNetV, uint8_t ubNodeIdV, CoObject_ts *ptsCoObjV, uint32_t *pulAbortV) |
|
void | ComSdoEventProgress (uint8_t ubNetV, uint8_t ubNodeIdV, uint16_t uwIndexV, uint8_t ubSubIndexV, uint32_t ulByteCntV) |
|
void | ComSdoEventTimeout (uint8_t ubNetV, uint8_t ubNodeIdV, uint16_t uwIndexV, uint8_t ubSubIndexV) |
|
ComStatus_tv | ComSdoGetAbortCode (uint8_t ubNetV, uint8_t ubSdoV, uint32_t *pulAbortV) |
|
uint8_t | ComSdoGetClient (uint8_t ubNetV) |
|
ComStatus_tv | ComSdoGetStatus (uint8_t ubNetV, uint8_t ubSdoV) |
|
ComStatus_tv | ComSdoReadObject (uint8_t ubNetV, uint8_t ubSdoV, uint8_t ubNodeIdV, CoObject_ts *ptsCoObjV, uint32_t *pulObjCntV) |
|
ComStatus_tv | ComSdoSetTimeout (uint8_t ubNetV, uint8_t ubSdoV, uint16_t uwTimeV) |
|
ComStatus_tv | ComSdoWriteObject (uint8_t ubNetV, uint8_t ubSdoV, uint8_t ubNodeIdV, CoObject_ts *ptsCoObjV, uint32_t *pulObjCntV) |
|
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.
The communication timeout between SDO client request and SDO server response is device/application specific. The initial SDO communication timeout for the client is set to 50 milliseconds. The connection timeout value can be change with the ComSdoSetTimeout() function.
◆ ComSdoEventObjectReady()
void ComSdoEventObjectReady |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubNodeIdV, |
|
|
CoObject_ts * |
ptsCoObjV, |
|
|
uint32_t * |
pulAbortV |
|
) |
| |
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ubNodeIdV | - Node-ID value |
[in,out] | ptsCoObjV | - Pointer to object structure |
[out] | 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 ComSdoReadObject() or ComSdoWriteObject() 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.
◆ ComSdoEventProgress()
void ComSdoEventProgress |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubNodeIdV, |
|
|
uint16_t |
uwIndexV, |
|
|
uint8_t |
ubSubIndexV, |
|
|
uint32_t |
ulByteCntV |
|
) |
| |
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ubNodeIdV | - Node-ID value |
[in] | uwIndexV | - Object index value |
[in] | ubSubIndexV | - Object sub-index value |
[in] | ulByteCntV | - Byte counter value |
This handler is called during a SDO block download or upload. The parameters uwIndexV and ubSubIndexV define the object which is accessed. The value ulByteCntV denotes the number of bytes that have been transmitted.
◆ ComSdoEventTimeout()
void ComSdoEventTimeout |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubNodeIdV, |
|
|
uint16_t |
uwIndexV, |
|
|
uint8_t |
ubSubIndexV |
|
) |
| |
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ubNodeIdV | - Node-ID value |
[in] | uwIndexV | - Object index value |
[in] | ubSubIndexV | - Object sub-index value |
- See also
- ComSdoSetTimeout()
This handler is called if a SDO response time-out condition occurred. The parameters uwIndexV and ubSubIndexV define the object that was accessed. The SDO communication timeout can be configured by the ComSdoSetTimeout() function.
◆ ComSdoGetAbortCode()
ComStatus_tv ComSdoGetAbortCode |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubSdoV, |
|
|
uint32_t * |
pulAbortV |
|
) |
| |
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ubSdoV | - SDO client index |
[out] | pulAbortV | - Pointer to variable for abort code |
- Returns
- ComSdoStat_e value on success, negative ComErr_e value on failure
This function returns the last SDO abort code, if any occurred. The SDO client connection is selected by the index ubSdoV
. A negative return value indicates an error. The error values are taken from the ComErr_e enumeration. The return value eCOM_ERR_NONE indicates that there was a SDO abort on the selected SDO client, which is copied to the variable pointed by pulAbortV
.
Positive return values indicate the status of a SDO client in use.
◆ ComSdoGetClient()
uint8_t ComSdoGetClient |
( |
uint8_t |
ubNetV | ) |
|
Get available SDO client index.
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
- Returns
- SDO client index
This function returns the index of an available SDO client. If no SDO client is free, the function will return the value COM_SDO_CLIENT_MAX. The first SDO client starts at index 0.
◆ ComSdoGetStatus()
ComStatus_tv ComSdoGetStatus |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubSdoV |
|
) |
| |
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ubSdoV | - SDO client index |
- Returns
- ComSdoStat_e value on success, negative ComErr_e value on failure
This function returns the status of a SDO transmission for the SDO client connection given by its index ubSdoV
. A negative return value indicates an error. The error values are taken from the ComErr_e enumeration. The return value eCOM_SDO_STAT_EMPTY indicates that the SDO client is available for a read/write operation. Positive return values (see ComSdoStat_e) indicate the status of a SDO client in use.
◆ ComSdoReadObject()
ComStatus_tv ComSdoReadObject |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubSdoV, |
|
|
uint8_t |
ubNodeIdV, |
|
|
CoObject_ts * |
ptsCoObjV, |
|
|
uint32_t * |
pulObjCntV |
|
) |
| |
Read object from CANopen device.
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ubSdoV | - SDO client index |
[in] | ubNodeIdV | - Node-ID value |
| ptsCoObjV | - Pointer to CANopen object entry |
| pulObjCntV | - Pointer to variable for object count |
- Returns
- Value of enumeration ComErr_e
- See also
- ComSdoWriteObject()
This function will start the read request for an object that is defined by the structure CoObject_ts.
◆ ComSdoSetTimeout()
ComStatus_tv ComSdoSetTimeout |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubSdoV, |
|
|
uint16_t |
uwTimeV |
|
) |
| |
Set communication timeout.
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ubSdoV | - SDO client index |
[in] | uwTimeV | - timeout value in milliseconds |
- Returns
- Value of enumeration ComErr_e
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 eCOM_SDO_STAT_TIMEOUT. The state of the SDO communication can be evaluated by calling ComSdoGetStatus(). Please note that the timeout value is passed in multiples of 1 millisecond. The timeout value supplied to this function will be rounded towards the next lower value if necessary (depends on timer granularity).
◆ ComSdoWriteObject()
ComStatus_tv ComSdoWriteObject |
( |
uint8_t |
ubNetV, |
|
|
uint8_t |
ubSdoV, |
|
|
uint8_t |
ubNodeIdV, |
|
|
CoObject_ts * |
ptsCoObjV, |
|
|
uint32_t * |
pulObjCntV |
|
) |
| |
Write object to CANopen device.
- Parameters
-
[in] | ubNetV | - CANopen Network channel |
[in] | ubSdoV | - SDO client index |
[in] | ubNodeIdV | - Node-ID value |
[in] | ptsCoObjV | - Pointer to CANopen object entry |
[in,out] | pulObjCntV | - Pointer to variable for object count |
- Returns
- Value of enumeration ComErr_e
- See also
- ComSdoReadObject()
This function will start the write request for an object that is defined by the structure CoObject_ts.