CANopen Master Documentation
Version 6.06.04
|
The file com_defs.h holds global definitions, constants and structures for the CANopen Master protocol stack. The files 'canopen.h' and 'com_conf.h' are included by this header.
Macros | |
#define | COM_VERSION_MAJOR 6 |
#define | COM_VERSION_MINOR 06 |
#define | COM_VERSION_BUILD 04 |
#define | ComNetValid(a) ( (a >= COM_NET_MAX) ? eCOM_ERR_NET_VALUE : eCOM_ERR_NONE) |
Typedefs | |
typedef int32_t | ComStatus_tv |
typedef uint8_t | ComSdoStatus_tv |
#define ComNetValid | ( | a | ) | ( (a >= COM_NET_MAX) ? eCOM_ERR_NET_VALUE : eCOM_ERR_NONE) |
Check valid network.
This macro returns an error code if the parameter is not within the valid network range.
Callback handler used by the object dictionary (see ComSdoHandler_Fn
) return a value of type ComSdoStatus_tv
, which is defined as data type uint8_t
by default.
All functions of the CANopen Master Protocol Stack have a generic return value, which is defined as data type int32_t
by default. A negative value of ComStatus_tv
denotes an error, defined by the enumeration ComErr_e.
enum ComBuf_e |
Message buffer allocation.
Each CANopen service (i.e. identifier) is assigned to a specific message buffer in the CAN controller. For BasicCAN controllers the message buffers must be emulated in software (refer to CANpie).
Enumerator | |
---|---|
eCOM_BUF_NMT | Buffer 1 : NMT |
eCOM_BUF_SYNC | Buffer 2 : SYNC |
eCOM_BUF_EMCY_PROD | Buffer 3 : EMCY producer |
eCOM_BUF_NMT_HB_PROD | Buffer 4 : Heartbeat producer |
eCOM_BUF_NMT_HB_CONS | Buffer 5 : Heartbeat consumer |
eCOM_BUF_LSS_CLN_RCV | Buffer 8 : LSS client |
eCOM_BUF_LSS_CLN_TRM | Buffer 9 : LSS client |
eCOM_BUF_MASTER_RCV | Buffer 10 : NMT master |
eCOM_BUF_MASTER_TRM | Buffer 11 : NMT master |
eCOM_BUF_TIME | Buffer 12 : TIME |
eCOM_BUF_EMCY_CONS | Buffer 13 : EMCY consumer |
eCOM_BUF_SDO_CLN_RCV | SDO client receive, (Buffer 14) |
eCOM_BUF_SDO_CLN_TRM | SDO client transmit, (Buffer = 13 + COM_SDO_CLIENT_MAX) |
eCOM_BUF_PDO_PROD | Buffer for PDO transmission (Buffer = 12 + 2 * COM_SDO_CLIENT_MAX) The FIFO size of this buffer is configured by COM_PDO_TRM_FIFO_SIZE. |
eCOM_BUF_GLOBAL_EXT_RCV | Buffer for global message reception, extended frame (2.0B) |
eCOM_BUF_GLOBAL_STD_RCV | Buffer for global message reception, standard frame (2.0A) |
enum ComErr_e |
Error Codes of CANopen Master protocol stack.
All error codes of the CANopen Master protocol stack have the prefix eCOM_ERR_. Error return values are always negative, so it is quite simple to check in general if a functions fails.
Example:
enum ComNet_e |
This enumeration defines logical network numbers for the CANopen Master protocol stack. The logical network number is assigned to a physical CAN interface by means of the ComMgrInit() function. Please note that the maximum value that can be used from this enumeration is limited by the configuration symbol COM_NET_MAX.
enum ComSdo_e |
Return code for SDO callbacks.
The following codes are used by callback functions for object dictionary access by Service Data Objects.
Enumerator | |
---|---|
eCOM_SDO_READ_OK | Generic read success (any number of bytes) |
eCOM_SDO_READ1_OK | Read success, 1 byte of data in expedited SDO |
eCOM_SDO_READ2_OK | Read success, 2 bytes of data in expedited SDO |
eCOM_SDO_READ3_OK | Read success, 3 bytes of data in expedited SDO |
eCOM_SDO_READ4_OK | Read success, 4 bytes of data in expedited SDO |
eCOM_SDO_READ_SEG_OK | Read success, start segmented SDO |
eCOM_SDO_WRITE_OK | Write success |
eCOM_SDO_ERR_TOGGLE_BIT | Toggle bit not alternated |
eCOM_SDO_ERR_TIMEOUT | SDO protocol timed out |
eCOM_SDO_ERR_COMMAND | Client/server command specifier not valid or unknown |
eCOM_SDO_ERR_BLOCK_SIZE | Invalid block size (block mode only) |
eCOM_SDO_ERR_BLOCK_SEQUENCE | Invalid sequence number (block mode only) |
eCOM_SDO_ERR_BLOCK_CRC | CRC error (block mode only) |
eCOM_SDO_ERR_MEMORY | Out of memory |
eCOM_SDO_ERR_ACCESS_UNSUPPORTED | Unsupported access to an object |
eCOM_SDO_ERR_ACCESS_WO | Attempt to read a write only object |
eCOM_SDO_ERR_ACCESS_RO | Attempt to write a read only object |
eCOM_SDO_ERR_NO_OBJECT | Object does not exist in the object dictionary |
eCOM_SDO_ERR_MAPPING_OBJECT | Object cannot be mapped to the PDO |
eCOM_SDO_ERR_MAPPING_LENGTH | The number and length of the objects to be mapped would exceed PDO length |
eCOM_SDO_ERR_GENERAL_PARAMETER | General parameter incompatibility reason |
eCOM_SDO_ERR_GENERAL_DEVICE | General internal incompatibility in the device |
eCOM_SDO_ERR_HARDWARE | Access failed due to an hardware error |
eCOM_SDO_ERR_DATATYPE | Data type does not match, length of service parameter does not match |
eCOM_SDO_ERR_DATATYPE_HIGH | Data type does not match, length of service parameter too high |
eCOM_SDO_ERR_DATATYPE_LOW | Data type does not match, length of service parameter too low |
eCOM_SDO_ERR_NO_SUB_INDEX | Sub-index does not exist |
eCOM_SDO_ERR_VALUE_RANGE | Invalid value for parameter (download only). |
eCOM_SDO_ERR_VALUE_HIGH | Value of parameter written too high (download only).
|
eCOM_SDO_ERR_VALUE_LOW | Value of parameter written too low (download only).
|
eCOM_SDO_ERR_VALUE_MIN_MAX | Maximum value is less than minimum value.
|
eCOM_SDO_ERR_GENERAL | General error |
eCOM_SDO_ERR_DATA_STORE | Data cannot be transferred or stored to the application. |
eCOM_SDO_ERR_DATA_STORE_LOCAL | Data cannot be transferred or stored to the application because of local control. |
eCOM_SDO_ERR_DATA_STORE_STATE | Data cannot be transferred or stored to the application because of the present device state.
|
eCOM_SDO_ERR_OBJECT_DICTIONARY | Object dictionary dynamic generation fails or no object dictionary is present (e.g. object dictionary is generated from file and generation fails because of an file error). |
eCOM_SDO_ERR_NO_DATA | Data actually not available for access |