CANopen Master Documentation
Version 6.06.04
Loading...
Searching...
No Matches
canopen.h File Reference

Detailed Description

The file canopen.h holds all definitions and structures that are necessary 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_FLAG_EXTENDED   ((uint32_t) 0x20000000)
 
#define ID_FLAG_NO_RTR   ((uint32_t) 0x40000000)
 
#define ID_FLAG_DISABLED   ((uint32_t) 0x80000000)
 
#define ID_MASK_VALUE   ((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   0x05030000
 
#define SDO_ERR_TIMEOUT   0x05040000
 
#define SDO_ERR_COMMAND   0x05040001
 
#define SDO_ERR_BLOCK_SIZE   0x05040002
 
#define SDO_ERR_BLOCK_SEQUENCE   0x05040003
 
#define SDO_ERR_BLOCK_CRC   0x05040004
 
#define SDO_ERR_MEMORY   0x05040005
 
#define SDO_ERR_ACCESS_UNSUPPORTED   0x06010000
 
#define SDO_ERR_ACCESS_WO   0x06010001
 
#define SDO_ERR_ACCESS_RO   0x06010002
 
#define SDO_ERR_NO_OBJECT   0x06020000
 
#define SDO_ERR_MAPPING_OBJECT   0x06040041
 
#define SDO_ERR_MAPPING_LENGTH   0x06040042
 
#define SDO_ERR_GENERAL_PARAMETER   0x06040043
 
#define SDO_ERR_GENERAL_DEVICE   0x06040047
 
#define SDO_ERR_HARDWARE   0x06060000
 
#define SDO_ERR_DATATYPE   0x06070010
 
#define SDO_ERR_DATATYPE_HIGH   0x06070012
 
#define SDO_ERR_DATATYPE_LOW   0x06070013
 
#define SDO_ERR_NO_SUB_INDEX   0x06090011
 
#define SDO_ERR_VALUE_RANGE   0x06090030
 
#define SDO_ERR_VALUE_HIGH   0x06090031
 
#define SDO_ERR_VALUE_LOW   0x06090032
 
#define SDO_ERR_VALUE_MIN_MAX   0x06090036
 
#define SDO_ERR_SDO_CONNECTION   0x060A0023
 
#define SDO_ERR_GENERAL   0x08000000
 
#define SDO_ERR_DATA_STORE   0x08000020
 
#define SDO_ERR_DATA_STORE_LOCAL   0x08000021
 
#define SDO_ERR_DATA_STORE_STATE   0x08000022
 
#define SDO_ERR_OBJECT_DICTIONARY   0x08000023
 
#define SDO_ERR_NO_DATA   0x08000024
 

Enumerations

enum  UsdoAbort_e {
}
 
enum  CoAttr_e {
  eCO_ATTR_ACC_RO = 0x01 ,
  eCO_ATTR_ACC_WO = 0x02 ,
  eCO_ATTR_ACC_RW = 0x03 ,
  eCO_ATTR_ACC_CONST = 0x05 ,
  eCO_ATTR_PDO_MAP = 0x10 ,
  eCO_ATTR_RES_1 = 0x20 ,
  eCO_ATTR_RES_2 = 0x40 ,
  eCO_ATTR_FUNCTION = 0x80
}
 
enum  CoDataType_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_DOMAIN = 15 ,
  eCO_DT_REAL64 = 17 ,
  eCO_DT_INTEGER64 = 21 ,
  eCO_DT_UNSIGNED64 = 27
}
 

Enumeration Type Documentation

◆ CoAttr_e

enum CoAttr_e

Access Attributes for objects in dictionary.

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

  • Read/Write
  • Write-only
  • Read-only
  • Constant (value is read-only, value in device does not change)

The member ubAttribute of the structure ComDicEntry_s is used for that purpose. This enumeration defines possible attribute values.

Enumerator
eCO_ATTR_ACC_RO 

object is read-only

eCO_ATTR_ACC_WO 

object is write-only

eCO_ATTR_ACC_RW 

object supports read-write access

eCO_ATTR_ACC_CONST 

object is constant

eCO_ATTR_FUNCTION 

function callback

◆ CoDataType_e

Data Type definitions for objects in dictionary.

Each object within the object dictionary has a specific data type. By this enumeration the possible data types are defined, which can be used in the SDO server.

Enumerator
eCO_DT_BOOLEAN 

boolean value, this data type is deprecated in CANopen FD

eCO_DT_INTEGER8 

Signed Integer, 1 byte

eCO_DT_INTEGER16 

Signed Integer, 2 bytes

eCO_DT_INTEGER32 

Signed Integer, 4 bytes

eCO_DT_UNSIGNED8 

Unsigned Integer, 1 byte

eCO_DT_UNSIGNED16 

Unsigned Integer, 2 bytes

eCO_DT_UNSIGNED32 

Unsigned Integer, 4 bytes

eCO_DT_REAL32 

Float, 32 bit according to IEEE

eCO_DT_VISIBLE_STRING 

character string

eCO_DT_OCTET_STRING 

octet string

eCO_DT_UNICODE_STRING 

unicode string

eCO_DT_TIME_OF_DAY 

time of day value

eCO_DT_TIME_DIFFERENCE 

time difference value

eCO_DT_DOMAIN 

binary data

eCO_DT_REAL64 

Double, 64 bit according to IEEE

eCO_DT_INTEGER64 

Signed Integer, 8 bytes

eCO_DT_UNSIGNED64 

Unsigned Integer, 8 bytes

◆ CoErrReg_e

enum CoErrReg_e

Error Register 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

◆ SdoCmd_e

enum SdoCmd_e

Command values for SDO 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

USDO abort codes.

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_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_UPLD_RQST 

Upload request

eUSDO_CMD_DOWN_EXP_RESP 

Download expedited response

eUSDO_CMD_UPLD_RESP_EXP 

Upload expedited response