Supported platforms: CODESYS 2.3, CODESYS 3.5
This program is the callback of SDO messages and handles incoming SDO messages. This function also calls the index callback function after updating the post variable in the CANopenSSDO struct. The program assumes that the CANMSGParam is a Devicenumber in G_CANDevices struct array.
Post |
State |
Description |
0 |
SDO Download indication |
Beginning of SDO data transfer to OD index, data is unchanged.
|
1 |
SDO Download end |
Data is transferred to index. Data content is the new data. |
2 |
SDO Upload indication |
Beginning of SDO data upload from OD index, the requested data is not sent yet. |
3 |
SDO Upload end |
Data is transferred from index to the CAN bus |
If the callback wants to abort the transmission, it should give an abort code in SDOCallbackReturn variable.
Possible abort codes:
05030000h Toggle bit not alternated.
05040000h SDO protocol timed out.
06010000h Unsupported access to an object.
06010001h Attempt to read a write only object.
06010002h Attempt to write a read only object.
06020000h Object does not exist in the object dictionary.
06070012h Data type does not match, Length of service too high.
06090011h Sub-index does not exist.
+ Callback function generated AbortCode(s)
(For other abort codes, refer to CiA DS-301 and device profile standards.)
This function block implements interfaces CANopen.ICANOpenProtocol and CANVXD_API.IReceiveCallback. The function block handles incoming SDO messages.
Post |
CANopenSDOTransferPhase |
Description |
0 |
SDO_DL_Ind |
SDO Download indication : Beginning of SDO data transfer to OD index, data is unchanged.
|
1 |
SDO_DL_End
|
SDO Download end : Data is transferred to index. Data content is the new data. |
2 |
SDO_UPL_Ind
|
SDO Upload indication : Beginning of SDO data upload from OD index, the requested data is not sent yet. |
3 |
SDO_UPL_End
|
SDO Upload end : Data is transferred from index to the CAN bus |
If the callback wants to abort the transmission, it should give an abort code in SDOCallbackReturn variable.
Action name |
Description |
Abort |
Sends an abort message to current SDO transfer. Action terminates SDO transfer using SDOCallbackReturn abort code . |
Init |
Function creates index 1200h and writes CANopenSSDO.SDO_Parameters[0]=600h+NodeID and CANopenSSDO.SDO_Parameters[1]=580h+NodeID if 128 > NodeID > 0 Please note that index 7h must be in OD before this action is called. |
Update |
Protocol update of SDO protocol. |
Methods
Method name |
Description |
Abort |
Sends an abort message to current SDO transfer. Action terminates SDO transfer using SDOCallbackReturn abort code . |
Init |
Method creates indexes 7h and 1200h and then writes CANopenSSDO.SDO_Parameters[0]=600h+NodeID and CANopenSSDO.SDO_Parameters[1]=580h+NodeID if 128 > NodeID > 0 |
Receive |
Handler for received messages (600h+NodeID) |
Update |
Handler for SDO timer. In case of time out, Abort method is called with abort code G_CANOPEN_SDO_ABORT_TIMEOUT |
Source file Topic000207.htm
Last updated 24-Apr-2025