Supported platforms: CODESYS 2.3, CODESYS 3.5
This function block is only for internal use. Use CANopenCSDOTransfer instead of this function block. |
The function block is used to send SDO messages to the CAN bus.
This function block includes three general actions: Init, Transfer and StartTransfer. On first call, the function block uses the Init action to add the message COB-ID to the list of the messages to be received. The Transfer action implements the actual SDO transfer. The StartTransfer action starts a new transfer.
The SDO download transfer can be either segmented transfer or faster block transfer. Block transfer is implemented by six different actions: BlockDownload, EndBlockDownload, WaitBlockDownloadResponse, WaitEndBlockDownloadResponse, WaitInitBlockDownloadResponse
and BlockTransferError.
The application can abort the transfer with the rising edge of the variable i_Stop.
The function block implements interface CANVXD_API.IReceiveCallback with method Receive.
The function block has to be in the state CSDOStateIdle to be able to start a new transfer to the server. |
Input variable name |
Data type |
Description |
i_Enable |
BOOL |
Activate data transfer |
i_Channel |
BYTE |
CAN channel number Used hardware specific VXD library defines channel number range. |
i_Data |
DWORD |
address of data buffer |
i_NodeID |
BYTE |
SDO server Node-ID |
i_SDOMux |
DWORD |
SDO mux contains index and subindex. mux = Index*100h + subIndex (hex value) |
i_Size |
DWORD |
Size of data buffer |
i_Write |
BOOL |
if i_Write=TRUE transfer id SDO download |
i_Stop |
BOOL |
Rising edge in this input will cause SDO-Abort ”General error” |
i_Timeout |
TIME |
The amount of time which is given to server for answer the message. |
i_DontChgByteOrd |
BOOL |
Flag can be used to prevent swapping of the byte order. This has meaning only in case when MOTOROLA byte order flag is set. |
i_TransferTimeout |
BOOL |
Whole SDO transfer timeout occurred = TRUE |
i_UseBlockTransfer |
BOOL |
Use SDO block download transfer |
Input variable name |
Data type |
Description |
i_Enable |
BOOL |
Activate data transfer |
i_itfChannel |
CANVXD_API.ICANVXD |
CAN channel interface. (From Code_Template_globals, for example, G_CAN1_Channel: EPEC_CANL2.Channel;) |
i_Data |
DWORD |
Address of data buffer |
i_NodeID |
BYTE |
SDO server Node-ID |
i_SDOMux |
DWORD |
SDO mux contains index and subindex. mux = Index*100h + subIndex (hex value) |
i_Size |
DWORD |
Size of data buffer |
i_Write |
BOOL |
If i_Write=TRUE transfer is SDO download |
i_Stop |
BOOL |
Rising edge in this input will cause SDO-Abort ”General error” |
i_Timeout |
TIME |
The amount of time which is given to server for answer the message. |
i_DontChgByteOrd |
BOOL |
Flag can be used to prevent swapping of the byte order. This has meaning only in case when MOTOROLA byte order flag is set. |
i_TransferTimeout |
BOOL |
Whole SDO transfer timeout occurred = TRUE |
i_UseBlockTransfer |
BOOL |
Use SDO block download transfer |
Output variable name |
Data type |
Description |
o_AbortCode |
DWORD |
If transfer is aborted the abort code will be in this variable. zero if transfer is completed successfully. |
o_State |
CANopenCSDOStates |
See CANopenCSDOStates in Data Types
|
o_Size |
DWORD |
Size of the transferred data |
Action name |
Description |
Init |
CSDO will call this action on first call |
Transfer |
Actual data transfer protocol |
StartTransfer |
Starts new transfer |
WaitInitBlockDownloadResponse |
SDO block transfer state |
BlockDownload |
SDO block transfer state |
WaitBlockDownloadResponse |
SDO block transfer state |
EndBlockDownload |
SDO block transfer state |
WaitEndBlockDownloadResponse |
SDO block transfer state |
BlockTransferError |
SDO block transfer utility action |
This method starts new transfer if received message ID matches with ID given in message.
Input variable name |
Data type |
Description |
i_pMsg |
POINTER TO CANVXD_API.Msg |
Pointer to response CAN message |
i_Argument |
DWORD |
This is only for method compatibility, do not use. |
-
CANopen initialization and transfer code examples for CODESYS 2.3 or CODESYS 3.5.
Source file Topic000211.htm
Last updated 21-Feb-2025