CANopen Slave Protocol Stack 
Version 7.04.00
Loading...
Searching...
No Matches
canopen.h File Reference

Detailed Description

The file canopen.h holds common definitions and structures required for the CANopen protocol stack.

Include dependency graph for canopen.h:

Macros

#define ID_BASE_EMCY   0x080
#define ID_BASE_SDO_TX   0x580
#define ID_BASE_SDO_RX   0x600
#define ID_BASE_NMT_ERR   0x700
#define ID_MASK_IS_EXTENDED   ((uint32_t) 0x20000000)
#define ID_MASK_NO_RTR   ((uint32_t) 0x40000000)
#define ID_MASK_IS_DISABLED   ((uint32_t) 0x80000000)
#define ID_MASK_STANDARD_FRAME   ((uint32_t) 0x000007FF)
#define ID_MASK_EXTENDED_FRAME   ((uint32_t) 0x1FFFFFFF)
#define NODE_ID_MIN   ((uint8_t) 1)
#define NODE_ID_MAX   ((uint8_t) 127)
#define NODE_ID_INVALID   ((uint8_t) 255)
#define SDO_ERR_TOGGLE_BIT   ((uint32_t)(0x05030000))
#define SDO_ERR_TIMEOUT   ((uint32_t)(0x05040000))
#define SDO_ERR_COMMAND   ((uint32_t)(0x05040001))
#define SDO_ERR_BLOCK_SIZE   ((uint32_t)(0x05040002))
#define SDO_ERR_BLOCK_SEQUENCE   ((uint32_t)(0x05040003))
#define SDO_ERR_BLOCK_CRC   ((uint32_t)(0x05040004))
#define SDO_ERR_MEMORY   ((uint32_t)(0x05040005))
#define SDO_ERR_ACCESS_UNSUPPORTED   ((uint32_t)(0x06010000))
#define SDO_ERR_ACCESS_WO   ((uint32_t)(0x06010001))
#define SDO_ERR_ACCESS_RO   ((uint32_t)(0x06010002))
#define SDO_ERR_NO_OBJECT   ((uint32_t)(0x06020000))
#define SDO_ERR_MAPPING_OBJECT   ((uint32_t)(0x06040041))
#define SDO_ERR_MAPPING_LENGTH   ((uint32_t)(0x06040042))
#define SDO_ERR_GENERAL_PARAMETER   ((uint32_t)(0x06040043))
#define SDO_ERR_GENERAL_DEVICE   ((uint32_t)(0x06040047))
#define SDO_ERR_HARDWARE   ((uint32_t)(0x06060000))
#define SDO_ERR_DATATYPE   ((uint32_t)(0x06070010))
#define SDO_ERR_DATATYPE_HIGH   ((uint32_t)(0x06070012))
#define SDO_ERR_DATATYPE_LOW   ((uint32_t)(0x06070013))
#define SDO_ERR_NO_SUB_INDEX   ((uint32_t)(0x06090011))
#define SDO_ERR_VALUE_RANGE   ((uint32_t)(0x06090030))
#define SDO_ERR_VALUE_HIGH   ((uint32_t)(0x06090031))
#define SDO_ERR_VALUE_LOW   ((uint32_t)(0x06090032))
#define SDO_ERR_VALUE_MIN_MAX   ((uint32_t)(0x06090036))
#define SDO_ERR_SDO_CONNECTION   ((uint32_t)(0x060A0023))
#define SDO_ERR_GENERAL   ((uint32_t)(0x08000000))
#define SDO_ERR_DATA_STORE   ((uint32_t)(0x08000020))
#define SDO_ERR_DATA_STORE_LOCAL   ((uint32_t)(0x08000021))
#define SDO_ERR_DATA_STORE_STATE   ((uint32_t)(0x08000022))
#define SDO_ERR_OBJECT_DICTIONARY   ((uint32_t)(0x08000023))
#define SDO_ERR_NO_DATA   ((uint32_t)(0x08000024))

Enumerations

enum  SdoCmd_e {
}
enum  UsdoAbort_e {
}
enum  CoAttr_e {
  eCO_ATTR_ACC_RO = 0x01 ,
  eCO_ATTR_ACC_CONST = 0x01 ,
  eCO_ATTR_ACC_WO = 0x02 ,
  eCO_ATTR_ACC_RW = 0x03 ,
  eCO_ATTR_ACC_HIDDEN = 0x04 ,
  eCO_ATTR_RES1 = 0x08 ,
  eCO_ATTR_NOT_IN_CC = 0x10 ,
  eCO_ATTR_NOT_IN_FD = 0x20 ,
  eCO_ATTR_RES2 = 0x40 ,
  eCO_ATTR_FUNCTION = 0x80
}
enum  CoDT_e {
  eCO_DT_BOOLEAN = 1 ,
  eCO_DT_INTEGER8 = 2 ,
  eCO_DT_INTEGER16 = 3 ,
  eCO_DT_INTEGER32 = 4 ,
  eCO_DT_UNSIGNED8 = 5 ,
  eCO_DT_UNSIGNED16 = 6 ,
  eCO_DT_UNSIGNED32 = 7 ,
  eCO_DT_REAL32 = 8 ,
  eCO_DT_VISIBLE_STRING = 9 ,
  eCO_DT_OCTET_STRING = 10 ,
  eCO_DT_UNICODE_STRING = 11 ,
  eCO_DT_TIME_OF_DAY = 12 ,
  eCO_DT_TIME_DIFFERENCE = 13 ,
  eCO_DT_reserved01 = 14 ,
  eCO_DT_DOMAIN = 15 ,
  eCO_DT_INTEGER24 = 16 ,
  eCO_DT_REAL64 = 17 ,
  eCO_DT_INTEGER40 = 18 ,
  eCO_DT_INTEGER48 = 19 ,
  eCO_DT_INTEGER56 = 20 ,
  eCO_DT_INTEGER64 = 21 ,
  eCO_DT_UNSIGNED24 = 22 ,
  eCO_DT_reserved02 = 23 ,
  eCO_DT_UNSIGNED40 = 24 ,
  eCO_DT_UNSIGNED48 = 25 ,
  eCO_DT_UNSIGNED56 = 26 ,
  eCO_DT_UNSIGNED64 = 27
}
enum  LssCmd_e {
  eLSS_CMD_MODE_GLOBAL = 4 ,
  eLSS_CMD_CONFIG_NODE_ID = 17 ,
  eLSS_CMD_CONFIG_BIT_TIMING = 19 ,
  eLSS_CMD_ACTIVE_BIT_TIMING = 21 ,
  eLSS_CMD_CONFIG_STORE = 23 ,
  eLSS_CMD_MODE_SEL_VENDOR_ID = 64 ,
  eLSS_CMD_MODE_SEL_PRODUCT_CODE = 65 ,
  eLSS_CMD_MODE_SEL_REVISION_NUM = 66 ,
  eLSS_CMD_MODE_SEL_SERIAL_NUM = 67 ,
  eLSS_CMD_MODE_SEL_RESPONSE = 68 ,
  eLSS_CMD_IDENT_RMT_SLAVE_VENDOR_ID = 70 ,
  eLSS_CMD_IDENT_RMT_SLAVE_PRODUCT_CODE = 71 ,
  eLSS_CMD_IDENT_RMT_SLAVE_REV_LOW = 72 ,
  eLSS_CMD_IDENT_RMT_SLAVE_REV_HIGH = 73 ,
  eLSS_CMD_IDENT_RMT_SLAVE_SER_LOW = 74 ,
  eLSS_CMD_IDENT_RMT_SLAVE_SER_HIGH = 75 ,
  eLSS_CMD_IDENT_SLAVE_NCFG_REQ = 76 ,
  eLSS_CMD_IDENT_SLAVE_RESP = 79 ,
  eLSS_CMD_IDENT_SLAVE_NCFG_RESP = 80 ,
  eLSS_CMD_FASTSCAN = 81 ,
  eLSS_CMD_INQUIRE_VENDOR_ID = 90 ,
  eLSS_CMD_INQUIRE_PRODUCT_CODE = 91 ,
  eLSS_CMD_INQUIRE_REVISION_NUM = 92 ,
  eLSS_CMD_INQUIRE_SERIAL_NUM = 93 ,
  eLSS_CMD_INQUIRE_NODE_ID = 94 ,
  eLSS_CMD_UNKNOWN = 99
}
enum  CoErrReg_e {
  eCO_ERR_REG_GENERIC = 0x01 ,
  eCO_ERR_REG_CURRENT = 0x02 ,
  eCO_ERR_REG_VOLTAGE = 0x04 ,
  eCO_ERR_REG_TEMPERATURE = 0x08 ,
  eCO_ERR_REG_COMMUNICATION = 0x10 ,
  eCO_ERR_REG_PROFILE = 0x20 ,
  eCO_ERR_REG_RESERVED = 0x40 ,
  eCO_ERR_REG_MANUFACTURER = 0x80
}

Enumeration Type Documentation

◆ CoAttr_e

enum CoAttr_e

Each object within the object dictionary can have the following access attributes.

Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
function reserved not in FD not in CC reserved hidden write read

The member CosDicEntry_ts::ubAttribute is used for this purpose.

Enumerator
eCO_ATTR_ACC_RO 

object is read-only

eCO_ATTR_ACC_CONST 

object is constant

eCO_ATTR_ACC_WO 

object is write-only

eCO_ATTR_ACC_RW 

object supports read-write access

eCO_ATTR_ACC_HIDDEN 

object is hidden

eCO_ATTR_RES1 

reserved flag

eCO_ATTR_NOT_IN_CC 

object not supported in CANopen CC

eCO_ATTR_NOT_IN_FD 

object not supported in CANopen FD

eCO_ATTR_RES2 

reserved flag

eCO_ATTR_FUNCTION 

function callback

◆ CoDT_e

enum CoDT_e

Each object within the object dictionary has a specific data type. By this enumeration the possible data types are defined.

Enumerator
eCO_DT_BOOLEAN 

data type: boolean value (deprecated)

eCO_DT_INTEGER8 

data type: Signed Integer, 1 byte

eCO_DT_INTEGER16 

data type: Signed Integer, 2 bytes

eCO_DT_INTEGER32 

data type: Signed Integer, 4 bytes

eCO_DT_UNSIGNED8 

data type: Unsigned Integer, 1 byte

eCO_DT_UNSIGNED16 

data type: Unsigned Integer, 2 bytes

eCO_DT_UNSIGNED32 

data type: Unsigned Integer, 4 bytes

eCO_DT_REAL32 

data type: Float, 32 bit according to IEEE

eCO_DT_VISIBLE_STRING 

data type: character string

eCO_DT_OCTET_STRING 

data type: octet string

eCO_DT_UNICODE_STRING 

data type: unicode string

eCO_DT_TIME_OF_DAY 

data type: time of day value

eCO_DT_TIME_DIFFERENCE 

data type: time difference value

eCO_DT_INTEGER64 

data type: Signed Integer, 8 bytes

eCO_DT_UNSIGNED64 

data type: Unsigned Integer, 8 bytes

◆ CoErrReg_e

enum CoErrReg_e

Error Register (object 1001h) values

Enumerator
eCO_ERR_REG_GENERIC 

generic error

eCO_ERR_REG_CURRENT 

current error

eCO_ERR_REG_VOLTAGE 

voltage error

eCO_ERR_REG_TEMPERATURE 

temperature error

eCO_ERR_REG_COMMUNICATION 

communication error

eCO_ERR_REG_PROFILE 

device profile specific error

eCO_ERR_REG_MANUFACTURER 

manufacturer specific error

◆ LssCmd_e

enum LssCmd_e

LSS service command specifier

Enumerator
eLSS_CMD_MODE_GLOBAL 

Switch mode global command ( 04h - 4dec)

eLSS_CMD_CONFIG_NODE_ID 

Configure node-ID command (11h - 17dec)

eLSS_CMD_CONFIG_BIT_TIMING 

Configure bit-timing command (13h - 19dec)

eLSS_CMD_ACTIVE_BIT_TIMING 

Activate bit-timing command (15h - 21dec)

eLSS_CMD_CONFIG_STORE 

Store configuration command (17h - 23dec)

eLSS_CMD_MODE_SEL_VENDOR_ID 

Switch mode selective - vendor ID (40h - 64dec)

eLSS_CMD_MODE_SEL_PRODUCT_CODE 

Switch mode selective - product code (41h - 65dec)

eLSS_CMD_MODE_SEL_REVISION_NUM 

Switch mode selective - revision number (42h - 66dec)

eLSS_CMD_MODE_SEL_SERIAL_NUM 

Switch mode selective - serial number (43h - 67dec)

eLSS_CMD_MODE_SEL_RESPONSE 

Switch mode selective - LSS slave response (44h - 68dec)

eLSS_CMD_IDENT_RMT_SLAVE_VENDOR_ID 

Identify remote slave, vendor-id command (46h - 70dec)

eLSS_CMD_IDENT_RMT_SLAVE_PRODUCT_CODE 

Identify remote slave, product-code command (47h - 71dec)

eLSS_CMD_IDENT_RMT_SLAVE_REV_LOW 

Identify remote slave, revision-number low command (48h - 72dec)

eLSS_CMD_IDENT_RMT_SLAVE_REV_HIGH 

Identify remote slave, revision-number high command (49h - 73dec)

eLSS_CMD_IDENT_RMT_SLAVE_SER_LOW 

Identify remote slave, serial-number low command (4Ah - 74dec)

eLSS_CMD_IDENT_RMT_SLAVE_SER_HIGH 

Identify remote slave, serial-number high command (4Bh - 75dec)

eLSS_CMD_IDENT_SLAVE_NCFG_REQ 

Identify non-configured slave request (4Ch - 76dec)

eLSS_CMD_IDENT_SLAVE_RESP 

Identify slave response (4Fh - 79dec)

eLSS_CMD_IDENT_SLAVE_NCFG_RESP 

Identify non-configured slave response (50h - 80dec)

eLSS_CMD_FASTSCAN 

Fastscan command (51h - 81dec)

eLSS_CMD_INQUIRE_VENDOR_ID 

Inquire identity, vendor ID command (5Ah - 90dec)

eLSS_CMD_INQUIRE_PRODUCT_CODE 

Inquire identity, product code command (5Bh - 91dec)

eLSS_CMD_INQUIRE_REVISION_NUM 

Inquire identity, revision number command (5Ch - 92dec)

eLSS_CMD_INQUIRE_SERIAL_NUM 

Inquire identity, serial number command (5Dh - 93dec)

eLSS_CMD_INQUIRE_NODE_ID 

Inquire identity, node ID command (5Eh - 94dec)

◆ SdoCmd_e

enum SdoCmd_e

Command values for SDO transfer

Command values for USDO transfer

Enumerator
eSDO_WRITE_REQ_SEG 

response to segmented write request

eSDO_WRITE_REQ_0 

segmented write request

eSDO_WRITE_REQ_4 

write request, unspecified length

eSDO_WRITE_REQ_3 

write request, 4 bytes data

eSDO_WRITE_REQ_2 

write request, 3 bytes data

eSDO_WRITE_REQ_1 

write request, 2 bytes data

eSDO_WRITE_RESP 

write request, 1 byte data

eSDO_READ_REQ 

response to write request

eSDO_READ_RESP_SEG 

read request

eSDO_READ_RESP_0 

read response, segmented data

eSDO_READ_RESP_4 

read response, unspecified length

eSDO_READ_RESP_3 

read response, 4 bytes data

eSDO_READ_RESP_2 

read response, 3 bytes data

eSDO_READ_RESP_1 

read response, 2 bytes data

eSDO_READ_REQ_SEG_0 

read response, 1 byte data

eSDO_READ_REQ_SEG_1 

read request, segmented data

eSDO_BLK_UP_REQ_0 

read request, segmented data

eSDO_BLK_END_RESP 

Init Block upload

eSDO_BLK_UP_REQ_1 

Block Upload / Download end response

eSDO_BLK_UP_REQ_DAT 

Init Block upload, size info

eSDO_BLK_UP_REQ_2 

Start Block data transfer

eSDO_BLK_DOWN_REQ_0 

Init Block upload, CRC info

eSDO_BLK_END_REQ 

Initiate Block download

eSDO_BLK_DOWN_REQ_1 

Block Upload / Download end request

eSDO_BLK_DOWN_REQ_2 

Initiate Block download, size info

eSDO_BLK_DOWN_REQ_3 

Initiate Block download, CRC info

eSDO_ABORT 

Initiate Block download, CRC & size

◆ UsdoAbort_e

The enumeration defines USDO abort codes.

Enumerator
eUSDO_ABORT_UNKNOWN 

The error reason is unknown and does not match to one of the errors listed in this enumeration.

eUSDO_ABORT_PROTOCOL 

An error in the USDO protocol was detected and the error reason does not match to any of the reasons listed in this table.

eUSDO_ABORT_TIMEOUT 

There had been no response during the time out time.

eUSDO_ABORT_COMMAND 

The command specifier is either incorrect, unexpected or not supported.

eUSDO_ABORT_COUNTER_VALUE 

Counter value (segmented transfer) not valid

eUSDO_ABORT_DATA_SIZE 

The value in size field differs from amount of transferred bytes of application data.

eUSDO_ABORT_MEMORY 

Because of missing memory resources the transfer is aborted.

eUSDO_ABORT_ROUTING 

The remote USDO cannot be processed because of a routing error that does not match to one of the errors listed in this enumeration.

eUSDO_ABORT_DESTINATION_NET 

USDO destination network unknown: The remote USDO cannot be processed because the destination network is unknown.

eUSDO_ABORT_DESTINATION_NODE 

USDO destination node unknown: The remote USDO cannot be processed because the destination node-id is unknown.

eUSDO_ABORT_SOURCE_NET 

USDO source network unknown: USDO cannot be processed because the source network is unknown; to be used by tools e.g. for debugging purposes.

eUSDO_ABORT_SOURCE_NODE 

USDO source node unknown: The remote USDO cannot be processed because the source node-id is unknown; to be used by tools e.g. for debugging purposes.

eUSDO_ABORT_CAN_DLC 

USDO is not processed as the length of the data field differs from the expected one.

eUSDO_ABORT_MULTIPLEXER 

Unexpected multiplexer: The multiplexer provided in the USDO server’s response does not match to the multiplexer in USDO client’s request.

eUSDO_ABORT_USDO_PARALLEL 

Data transfer not possible; parallel USDO access to the very same sub-index

eUSDO_ABORT_SESSION_ID 

Session-ID wrong or unknown

eUSDO_ABORT_ACC_WRITE_ONLY 

The data element is of access type write-only and thus it cannot be read.

eUSDO_ABORT_ACC_READ_ONLY 

The data element is of access type read-only and thus it cannot be written.

eUSDO_ABORT_ACC_NO_OBJECT 

At this index, no data object is implemented. Thus no data can be transferred from or to this data object.

eUSDO_ABORT_ACC_NO_SUB_INDEX 

At this sub-index, no data element is implemented. Thus no data can be transferred from or to this data element.

eUSDO_ABORT_PARAM_VALUE_INVALID 

Invalid value for parameter: Value to be written is out of the valid value range.

eUSDO_ABORT_PARAM_VALUE_HIGH 

Invalid value for parameter: Value to be written is out of the valid value range.

eUSDO_ABORT_PDO_MAPPING 

Data element cannot be mapped to the PDO: Because of an unknown error, the data element cannot be added to the PDO mapping.

◆ UsdoCommand_e

Enumerator
eUSDO_CMD_DOWN_EXP_RQST 

Download expedited request

eUSDO_CMD_DOWN_SEG_RQST_START 

Download segmented request, first segment

eUSDO_CMD_DOWN_SEG_RQST_INTER 

Download segmented request, intermediate segments

eUSDO_CMD_DOWN_SEG_RQST_FINAL 

Download segmented request, final segment

eUSDO_CMD_UPLD_RQST 

Upload request

eUSDO_CMD_UPLD_RQST_INTER 

Upload request, intermediate segments

eUSDO_CMD_DOWN_EXP_RESP 

Download expedited response

eUSDO_CMD_DOWN_SEG_RESP_START 

Download segmented response, first segment

eUSDO_CMD_DOWN_SEG_RESP_INTER 

Download segmented response, intermediate segments

eUSDO_CMD_DOWN_SEG_RESP_FINAL 

Download segmented response, final segment

eUSDO_CMD_UPLD_RESP_EXP 

Upload expedited response

eUSDO_CMD_UPLD_RESP_SEG_START 

Upload segmented response, first segment

eUSDO_CMD_UPLD_RESP_SEG_INTER 

Upload segmented response, intermediate segments

eUSDO_CMD_UPLD_RESP_SEG_FINAL 

Upload segmented response, last segment