Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY

 

List of Library's Data Types

CSDOStates (ENUM)

Name of the Member

Value

Description

CSDOStateIdle

0

CSDO is in idle state and is ready for new transfer

CSDOStateWaitDownloadResponse

1

CSDO waits server to response for downloaded data

CSDOStateWaitUploadResponse

2

CSDO waits server to upload a datapacket

CSDOStateWaitInitBlockDownloadResponse

3

Waiting response for Initiate SDO block download protocol msg.

CSDOStateBlockDownload

4

Download the all segments of one block.

CSDOStateWaitBlockDownloadResponse

5

Waiting response for Download SDO block segment protocol msg.

CSDOStateEndBlockDownload

6

Transmit end SDO block download protocol msg.

CSDOStateWaitEndBlockDownloadResponse

7

Wait response to end SDO block download protocol msg.

 

CSDOTransferStates (ENUM)

Name of the Member

Value

Description

CSDOReqInit

0

Initial status of transferring function block. SDO request is stopped.

CSDOReqWaithChn

1

Waiting for free CSDO channel.

CSDOReqTransferOn

2

Transfer going on.

CSDOReqIdle

3

Function block idle.

 

DataType (ENUM)

Supported CANopen data type objects as in CiA DS301 (2014) and CENELEC EN50325-5 (2010).

PDO/SRDO mapping (16#0021) and Identity (16#0023) data objects are handled as an array of UNSIGNED32.

Since the enumeration is set as 'qualified only', generic numbering for application specific structures is included.

 

Name of the Member

Default value (index)

Object

Description

DefType_DEFTYPE

0

 

Default type: Used with CANopenODAddLine when adding default type or default struct. Not handled as CANopen OD index.

Deftype_BOOLEAN

WORD#16#0001

Default type

BOOL

Deftype_INTEGER8

WORD#16#0002

Default type

SINT

Deftype_INTEGER16

WORD#16#0003

Default type

INT

Deftype_INTEGER32

WORD#16#0004

Default type

DINT

Deftype_UNSIGNED8

WORD#16#0005

Default type

USINT

Deftype_UNSIGNED16

WORD#16#0006

Default type

UINT

Deftype_UNSIGNED32

WORD#16#0007

Default type

UDINT

Deftype_REAL32

WORD#16#0008

Default type

REAL

Deftype_STRING

WORD#16#0009

Default type

STRING

Deftype_Domain

WORD#16#000F

Default type

STRUCT

Defstruct_PDO_Communication

WORD#16#0020

Default structure

PDO communication parameter record

Defstruct_SRDO_Communication

WORD#16#0026

Default structure

SRDO communication parameter record

 

DataUnion (UNION)

Name of the Member

Data Type

Description

pData

DWORD

Pointer to data, used when data length is over 4 bytes.

Data

DWORD

Data, used when data length is 4 bytes or less.

 

Device (STRUCT)

Name of the Member

Data Type

Description

NodeID

BYTE

The device's identification number in the CAN bus.

itfCanChannel

CANVXD_API.ICANVXD

CAN channel interface

pProtocols

POINTER TO ProtocolEntry

Pointer to first used protocol

 

Domain (STRUCT)

Name of the Member

Data Type

Description

pData

DWORD

Pointer to data.

FileSize

UDINT

Reserved memory size.

DataSize

UDINT

Used buffer size. SDO download use this when downloading data.

pFileName

DWORD

Pointer to the file name.

EMCYObject (Struct)

Name of the Member

Data Type

Description

Code

WORD

EMCY Error code. EMCY message bytes 0..1.

Field

ARRAY [1..5] OF BYTE

Manufacturer specific Error Field. EMCY message bytes 3..7.

RegisterMask

BYTE

Active bits for 1001h index. To be ORed into EMCY message byte 2 .

 

EMCYListObject (Struct)

Name of the Member

Data Type

Description

Error

EMCYObject

EMCY object data.

pPrev

POINTER TO EMCYListObject

Pointer to previous object for internal use.

pNext

POINTER TO EMCYListObject

Pointer to next object for internal use.

StateChangeTime

TIME

Time when EMCY state has changed. After sending this is zero.

Active

BOOL

EMCY object activity status.

 

EMCYData (Struct)

Name of the Member

Data Type

Description

pErrorRegister

POINTER TO BYTE

Error Register, data of OD index 1001h.

pActiveEmcyCodes

POINTER TO EMCYObject

Linked list of active EMCYs.

pCallback

POINTER TO CANopenEMCYCallback

Pointer to the first EMCY callback function.

COBID

DWORD

COB-ID Emergency Object,data of OD index 1014h.

InhibitTime

TIME

Inhibit time in milliseconds.

InhibitTimeValue

WORD

InhibitTime EMCY (100us), data of OD index 1015h.

LastTransmission

TIME

Last EMCY transmission time.

 

Errors (INT ENUM)

Name of the Member

Value

Description

NoError

0

No error

ODFull

-1400

Object dictionary is full.

SubIndexNotExist

-1399

Subindex does not exist in object dictionary.

TypedefMissing

-1398

Typedef is missing in object dictionary.

IndexZero

-1397

Index is zero.

IndexNotExist

-1396

Index does not exist in object dictionary.

TypedefIsNotTypedef

-1395

Object's code is OD_DEFTYPE, but given TypeSpec is not DefType_DEFTYPE.

DefstructMissing

-1394

Default struct is not added to object dictionary.

TypedefIsNotDefstruct

-1393

Object's code is OD_RECORD, but given TypeSpec is not DefType_DEFSTRUCT.

NotFound

-1392

Requested item is not found.

InputError

-1391

Function input is erroneous.

InterfaceError

-1390

CAN interface returns an error.

ProtocolDataMissing

-1389

Requested protocol data is not added to device.

NotInitialized

-1388

Protocol is not initialized.

DataError

-1387

Error in handled data.

Unsupported

-1386

Unsupported input value

CRCNotValid

-1385

CRC value is invalid

Timeout

-1384

Timeout.

NoFreeCSDOInstance

-1383

No free slots for SDO client.

SDOAbortReceived

-1382

SDO client received an abort.

COBIDError

-1381

COB-ID out of range.

InvalidChannel

-1380

Invalid CAN channel.

InvalidBitRate

-1379

Invalid bit rate.

InvalidCallback

-1378

Invalid receive callback function block.

UnsupportedStatus

-1377

CAN interface does not support flag.

ChannelNotInitialized

-1376

Channel is not initialized.

CallbackBufferFull

-1375

Callback data buffer full.

CallbackBufferEmpty

-1374

Callback data buffer empty.

COBIDAlreadyRegistered

-1373

COB-ID is already registered.

ChannelInitialized

-1372

Channel is already initialized.

CallbackError

-1371

IReceiveCallback.Receive returned an error.

BusNotOk

-1370

NMT mandatory slave heartbeat is missing.

 

GFCData (STRUCT)

Name of the Member

Data Type

Description

pGFCParameter

POINTER TO BYTE

GFC parameter: OD index 16#1300 value.

pGFCStatus

POINTER TO BYTE

Node's internal status. This value is to be included in SystemOk status.

 

HBData (STRUCT)

Name of the Member

Data Type

Description

HeartBeat

TON

Timer for HB producer, including index 16#1017 data.

pCallback

POINTER TO CANopenHBCallback

Pointer to the first heartbeat callback function.

pHBCTimes

POINTER TO DWORD

Pointer to index 16#1016 data, i.e. first consumer time.

 

NMTCommand (ENUM)

Name of the Member

Value

Description

Start

BYTE#16#01

NMT command start node.

Stop

BYTE#16#02

NMT command stop node.

Preoperational

BYTE#16#80

NMT command enter to preoperational.

Reset

BYTE#16#81

NMT command reset node.

ResetCommunication

BYTE#16#82

NMT command reset communication.

 

NMTData (STRUCT)

Name of the Member

Data Type

Description

NmtState

NMTState

Current NMT state. Value can be forced also in IEC application.

StateChanged

BOOL

CANopen device state has changed because of the NMT command through CAN-bus. This flag is on during one cycle.

LastNmtCommand

NMTCommand

Value of the last received NMT command. If there is multiple NMT-commands for one cycle, only latest is seen in this variable.

 

NMTStartingPhase (ENUM)

Name of the Member

Value

Description

Reset

BYTE#0

Reset slave if resetting activated.

Initialize

BYTE#1

Initialize configuration data.

ConfiguringDelay1

BYTE#2

Set configuring delay after reset/bootup.

Preoperational

BYTE#3

Configuration disabled, set slave preoperational.

CheckPresence

BYTE#4

Wait for HB or SDO message from unit.

ConfiguringDelay2

BYTE#5

Set configuring delay after reset/bootup.

Configure

BYTE#6

Configure unit if configuration exists.

Start

BYTE#7

Start unit.

MonitoringDelay

BYTE#8

Wait for interval time to be elapsed before monitoring.

Monitor

BYTE#9

Monitor the HB of the unit.

 

NMTState (ENUM)

Name of the Member

Value

Description

BootUp

BYTE#16#00

NMT state boot-up.

Stopped

BYTE#16#04

NMT state stopped.

Operational

BYTE#16#05

NMT state operational.

Preoperational

BYTE#16#7F

NMT state pre-operational.

NotAvailable

BYTE#16#3E

State missing. Heartbeat timed out.

Unknown

BYTE#16#3F

State unknown, the default value.

 

ObjectCode (ENUM)

Name of the Member

Value

Description

OD_NULL

INT#0

A dictionary entry with no data fields.

OD_CANopenDomain

INT#2

Large variable amount of data e.g. executable program code.

OD_DEFTYPE

INT#5

Denotes a type definition such as a BOOL, INT, DWORD etc.

OD_DEFSTRUCT

INT#6

Defines a new record type e.g. the PDO communication parameter record.

OD_VAR

INT#7

A single value such as a BOOL, INT, DWORD etc.

OD_ARRAY

INT#8

A multiple data field object where each data field is a simple variable of the SAME basic data type e.g. array of DWORD etc. Sub-index 0 is of UNSIGNED8 and therefore not part of the ARRAY data.

OD_RECORD

INT#9

A multiple data field object where the data fields may be any combination of simple variables. Sub-index 0 is of UNSIGNED8 and therefore not part of the RECORD data.

OD_EPEC

INT#10

Sub-index 0 is part of the OD_EPEC data.

The table above is according to DS-301. For more information refer to CiA standard DS-301 (Version 4.02).

 

OD (STRUCT)

Name of the Member

Data Type

Description

InOrder

BOOL

Indicates if the OD is organized by index numbers.

NextFree

UINT

The line number of the next free OD line.

EntryCount

UINT

The amount of the OD lines.

pODEntry

POINTER TO  ODEntry

The pointer to OD entry array

pAdditionalData

DWORD

Pointer to any additional data.

 

ODEntry (STRUCT)

Name of the Member

Data Type

Description

Index

UINT

OD index number.

ObjectCode

ObjectCode

The index type.

NumOfSubids

USINT

The amount of sub-indexes.

TypeSpec

DataType

Index where the type is specified, see DataType (ENUM).

ObjectAccess

WORD

Object access flags.

Sub0data

BYTE

The data of object's subindex 0 when the data type is ARRAY, RECORD or DEFSTRUCT.

IndexData

DataUnion

Index data.

itfSDOHandler

ICANopenSDOHandler

Interface to additional SDO handler

 

PDOCommunicationParameter (STRUCT)

Name of the Member

Data Type

Description

COBID

DWORD

Sub-index 1: COB-ID.

TransmissionType

BYTE

Sub-index 2: Transmission type.

InhibitTime

UINT

Sub-index 3: Inhibit Time.

Reserved

USINT

Sub-index 4: Reserved.

EventTime

UINT

Sub-index 5: Event Timer.

Sub-index 6: SYNC Start value not supported.

 

PDOData (STRUCT)

Name of the Member

Data Type

Description

Count

UINT

Number of PDOs.

pPDO

POINTER TO CANopenPDO

Pointer to the first PDO.

 

PDOType (ENUM)

Name of the Member

Value

Description

NotValid

BYTE#0

Does not exist / not valid.

TransmitPDO

BYTE#1

Transmit PDO.

ReceivePDO

BYTE#2

Receive PDO.

 

ProtocolEntry (STRUCT)

Name of the Member

Data Type

Description

pData

DWORD

Pointer to protocol data

itfProtocol

ICANopenProtocol

Interface for protocol initialization and update

Protocol

ProtocolType

See ProtocolType (ENUM).

pError

POINTER TO Errors

Protocol error status.

pNext

POINTER TO BYTE

Pointer to next protocol entry

 

ProtocolType (ENUM)

Name of the Member

Value

Description

NoProtocol

INT#0

 

OD

INT#1

Object Dictionary (handled partly as protocols).

NMT

INT#2

Network Management

SSDO

INT#3

Server Service Data Object

CSDO

INT#4

Client Service Data Object

PDO

INT#5

Process Data Object

SYNC

INT#6

Synchronisation Object

HB

INT#7

HeartBeat

GFC

INT#8

Global Failsafe Command

SRDO

INT#9

Safety-Related Data Object

EMCY

INT#10

Emergency Data Object (not implemented)

TS

INT#11

Time Stamp Object (not implemented)

LSS

INT#12

Layer Setting Service (not implemented)

USR1

INT#13

User specified protocol to be implemented

USR2

INT#14

User specified protocol to be implemented

USR3

INT#15

User specified protocol to be implemented

 

SlaveConfigurationStatus (ENUM)

Name of the Member

Value

Description

Fault

INT#-1

Slave configuration failed.

NotStarted

INT#0

Slave configuration not started.

Busy

INT#1

Slave configuration ongoing.

Done

INT#2

Slave configuration finished successfully.

 

SlaveData (STRUCT)

Name of the Member

Data Type

Description

pHBCallback

POINTER TO CANopenHBCallback

Pointer to Heartbeat callback FB instance.

KeepAlive

BOOL

In Monitoring state, enable changing to Start state when node enters pre-operational state from operational state.

Reset

BOOL

Enables sending NMT reset to node at start of configuration sequence.

Mandatory

BOOL

Enables setting of BusNotOk error after configuration timeout delay if the node is not operational.

QueryWithSDO

BOOL

Enables sending of consecutive SDO queries to node to determine its presence.

DisableStart

BOOL

Disables the sequence to send NMT start to node.

ConfigurationDelay

UDINT

Delay (ms) that configuration waits after reset before operation.

SDOQueryInterval

UDINT

Interval time (ms) for consecutive SDO queries.

pSlaveConfiguration

POINTER TO CANopenNMTConfigureSlave

Pointer to slave configuring FB instance.

ConfigurationTimeout

UINT

Delay time (s) of BusNotOk error. Possible SDO polling is also stopped after delay.

TimeSinceLastHeartbeat

UDINT

Time (ms) since last received heartbeat message from the node.

State

NMTState

Current state of the node. See NMTState enumeration.

Phase

NMTStartingPhase

Current configuration/starting/monitoring phase of the node.

BootUps

USINT

Number of received bootup messages.

BootTimeStamp

UDINT

Time of last received bootup message.

BootupReceived

BOOL

Bootup is used to detect slave presence when QueryWithSDO is not in use

DelayTimer

UDINT

Delay timer value for starting sequence.

PollingTimer

UDINT

Delay timer value for SDO polling.

EnablePolling

BOOL

Internal variable for enabling SDO polling after delay.

 

SlaveODConfiguration (STRUCT)

Name of the Member

Data Type

Description

Index

UINT

OD index.

SubIndex

USINT

OD subindex.

NewValue

DataUnion

New data or pointer to new data.

Size

USINT

Size of the value to write (number of bytes).

State

BYTE

State of the index/subindex:

 0 = Not written,

 1 = Written,

 2 = Fault.

AbortIfError

BOOL

TRUE = Abort configuration in case of error.

FALSE = Continue to next or jump to given line of configuration data table.

JumpToLineIfError

INT

Next configuration to handle in case of error. Value G_CANOPEN_SLAVE_CONFIG_STEP_IF_ERROR (-1) steps to next configuration without a jump.

 

SlavePDOConfiguration (STRUCT)

Name of the Member

Data Type

Default value

Description

COBID

DWORD

0

COBID of the PDO

TransmissionType

BYTE

0

Transmission type of the PDO

InhibitTime

WORD

0

Inhibit time of the PDO

EventTime

WORD

0

Event time of the PDO

State

BYTE

0

State of the PDO configuration:

 0 = Not written,

 1 = Written,

 2 = Fault

ConfigureInhibitTime

BOOL

TRUE

TRUE = TPDO inhibit time is configured.

FALSE = TPDO inhibit time is not configured.

ConfigureEventTime

BOOL

TRUE

TRUE = TPDO event time is configured.

FALSE = TPDO event time is not configured.

ConfigureMappings

BOOL

TRUE

If TRUE PDO mappings are configured to slave unit

PDONumber

WORD

WORD#1

Communication and mapping indexes are determined by PDO number

 

SYNCData (STRUCT)

Name of the Member

Data Type

Description

COBID

DWORD

SYNC COB-ID, data of OD index 0x1005.

Count

USINT

Number of the received SYNC messages.

MaxCount

USINT

SYNC counter maximum value, data of OD index 0x1019.

CyclePeriod

UDINT

Communication cycle period, data of OD index 0x1006.

 

SDOTransferPhase (ENUM)

Name of the Member

Value

Description

SDO_DL_Ind

0

Beginning of SDO data transfer to OD index, data is unchanged.

SDO_DL_End

1

Data is transferred to index. Data content is the new data.

SDO_UPL_Ind

2

Beginning of SDO data upload from OD index, the requested data is not sent yet.

SDO_UPL_End

3

Data is transferred from index to the CAN bus.

 

SSDOData (STRUCT)

Name of the Member

Data Type

Description

SDOTransmissionActive

BOOL

SDO transmission in progress

Toggle

BYTE

Normal transfer toggle mask

MUXinfo

DWORD

MUX = index*100h + subindex, for example 100900h

Post

SDOTransferPhase

See SDOTransferPhase (ENUM).

pData

DWORD

Pointer to the data to be transferred

Unitsize

DWORD

(Sub)index size in bits

SDO_Parameters

 ARRAY [0..1] OF DWORD

Receive and transmit COB-IDs. Data of index 1200h, for example 16#601,16#581 when node-ID is 1

Timeout

TON

SDO timeout timer

SDOCallbackReturn

DWORD

Return value from additional SDO handler

SDO_1F50Handling

BOOL

Used to block abort messages for certain indices.

SDO_1F50hTransferLastStamp

TIME

Last time stamp for SDO transfer.

 

SRDOCommunicationParameter (STRUCT)

Name of the Member

Data Type

Description

InfoDirection

SRDOType

Sub-index 1: 0 = not valid, 1 = SRDO producer, 2 = SRDO consumer.

SCT

UINT

Sub-index 2: Refresh Time (for producer) / Safeguard Cycle Time (for consumer), (ms).

SRVT

USINT

Sub-index 3: SR Validation Time, (ms).

TransmissionType

BYTE

Sub-index 4: Transmission type as defined in EN 50325-4.

COBID_1

DWORD

Sub-index 5: SRDO COB-ID for plain SR data, shall be an odd number.

COBID_2

DWORD

Sub-index 6: SRDO COB-ID for bitwise inverted SR data, shall be COBID_1 + 1 (even number)

 

SRDOData (STRUCT)

Name of the Member

Data Type

Description

Count

UINT

Number of SRDOs.

pSRDO

POINTER TO CANopenSRDO

Pointer to the first SRDO.

 

SRDOType (ENUM)

Name of the Member

Value

Description

NotValid

BYTE#0

Does not exist / not valid.

TransmitSRDO

BYTE#1

Transmit SRDO.

ReceiveSRDO

BYTE#2

Receive SRDO.

 

 

 

 

 

Source file topic100421.htm

Last updated 13-Jun-2024