Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY

 

CANopenCSDO (FB)

Description

This function block implements SDO protocol client.

 

The application can abort the transfer with the rising edge of the variable i_Stop.

 

Limitations

This function block is for internal use. Use CANopenSDOClient (FB) instead.

 

SDO block transfer is supported as well as SDO expedited transfer.

 

The function block does not manage SDO channels. Channel reservation and release must be done separately.

 

The function block has to be in idle state to be able to start a new transfer to the server.

 

Inputs

Input variable name

Data type

Description

i_Enable

BOOL

Activate data transfer

i_pDevice

POINTER TO Device

Pointer to CANopen device.

i_pData

POINTER TO INT

Pointer to data buffer for send/received data

i_NodeID

BYTE

SDO server Node-ID

i_SDOMux

DWORD

SDO mux contains index and subindex.

mux = Index*100h  + subIndex (hex value)

i_Size

UDINT

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 transfer instead of expedited transfer.

 

Outputs

Output variable name

Data type

Description

o_AbortCode

DWORD

If transfer is aborted the abort code will be in this variable.

o_State

CSDOStates

See CSDOStates in Data Types

 

o_Size

DWORD

Size of the transferred data

o_Error

Errors

Possible error.

 

Error diagnostic

Error code

Description

COBIDAlreadyRegistered

COB-ID is already registered.

CallbackBufferFull

Number of callback FBs exceeded G_MAX_NUMBER_OF_COBIDS.

InternalError

Low level library returned error.

InputError

Device pointer or data buffer pointer NULL, or OD index 0.

Timeout

CSDO aborted to timeout.

SDOAbortReceived

Abort received from SDO server.

NotInitialized

SDO manager not initialized, or could not reserve a channel.

NoError

No errors.

 

Example code

-

See also

 

 

 

 

Source file topic001027.htm

Last updated 19-Dec-2024