CO_Emergency.h
Go to the documentation of this file.
#ifndef CO_EMERGENCY_H
#define CO_EMERGENCY_H
#include "301/CO_driver.h"
#include "301/CO_ODinterface.h"
/* default configuration, see CO_config.h */
#ifndef CO_CONFIG_EM
#define CO_CONFIG_EM (CO_CONFIG_EM_PRODUCER | \
CO_CONFIG_EM_HISTORY)
#endif
#ifndef CO_CONFIG_EM_ERR_STATUS_BITS_COUNT
#define CO_CONFIG_EM_ERR_STATUS_BITS_COUNT (10*8)
#endif
#ifndef CO_CONFIG_EM_BUFFER_SIZE
#define CO_CONFIG_EM_BUFFER_SIZE 16
#endif
#ifndef CO_CONFIG_ERR_CONDITION_GENERIC
#define CO_CONFIG_ERR_CONDITION_GENERIC (em->errorStatusBits[5] != 0)
#endif
#ifndef CO_CONFIG_ERR_CONDITION_COMMUNICATION
#define CO_CONFIG_ERR_CONDITION_COMMUNICATION (em->errorStatusBits[2] \
|| em->errorStatusBits[3])
#endif
#ifndef CO_CONFIG_ERR_CONDITION_MANUFACTURER
#define CO_CONFIG_ERR_CONDITION_MANUFACTURER (em->errorStatusBits[8] \
|| em->errorStatusBits[9])
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
CO_ERR_REG_GENERIC_ERR = 0x01U,
CO_ERR_REG_CURRENT = 0x02U,
CO_ERR_REG_VOLTAGE = 0x04U,
CO_ERR_REG_TEMPERATURE = 0x08U,
CO_ERR_REG_COMMUNICATION = 0x10U,
CO_ERR_REG_DEV_PROFILE = 0x20U,
CO_ERR_REG_RESERVED = 0x40U,
CO_ERR_REG_MANUFACTURER = 0x80U
} CO_errorRegister_t;
typedef enum {
CO_EMC_NO_ERROR = 0x0000U,
CO_EMC_GENERIC = 0x1000U,
CO_EMC_CURRENT = 0x2000U,
CO_EMC_CURRENT_INPUT = 0x2100U,
CO_EMC_CURRENT_INSIDE = 0x2200U,
CO_EMC_CURRENT_OUTPUT = 0x2300U,
CO_EMC_VOLTAGE = 0x3000U,
CO_EMC_VOLTAGE_MAINS = 0x3100U,
CO_EMC_VOLTAGE_INSIDE = 0x3200U,
CO_EMC_VOLTAGE_OUTPUT = 0x3300U,
CO_EMC_TEMPERATURE = 0x4000U,
CO_EMC_TEMP_AMBIENT = 0x4100U,
CO_EMC_TEMP_DEVICE = 0x4200U,
CO_EMC_HARDWARE = 0x5000U,
CO_EMC_SOFTWARE_DEVICE = 0x6000U,
CO_EMC_SOFTWARE_INTERNAL = 0x6100U,
CO_EMC_SOFTWARE_USER = 0x6200U,
CO_EMC_DATA_SET = 0x6300U,
CO_EMC_ADDITIONAL_MODUL = 0x7000U,
CO_EMC_MONITORING = 0x8000U,
CO_EMC_COMMUNICATION = 0x8100U,
CO_EMC_CAN_OVERRUN = 0x8110U,
CO_EMC_CAN_PASSIVE = 0x8120U,
CO_EMC_HEARTBEAT = 0x8130U,
CO_EMC_BUS_OFF_RECOVERED = 0x8140U,
CO_EMC_CAN_ID_COLLISION = 0x8150U,
CO_EMC_PROTOCOL_ERROR = 0x8200U,
CO_EMC_PDO_LENGTH = 0x8210U,
CO_EMC_PDO_LENGTH_EXC = 0x8220U,
CO_EMC_DAM_MPDO = 0x8230U,
CO_EMC_SYNC_DATA_LENGTH = 0x8240U,
CO_EMC_RPDO_TIMEOUT = 0x8250U,
CO_EMC_TIME_DATA_LENGTH = 0x8260U,
CO_EMC_EXTERNAL_ERROR = 0x9000U,
CO_EMC_ADDITIONAL_FUNC = 0xF000U,
CO_EMC_DEVICE_SPECIFIC = 0xFF00U,
CO_EMC401_OUT_CUR_HI = 0x2310U,
CO_EMC401_OUT_SHORTED = 0x2320U,
CO_EMC401_OUT_LOAD_DUMP = 0x2330U,
CO_EMC401_IN_VOLT_HI = 0x3110U,
CO_EMC401_IN_VOLT_LOW = 0x3120U,
CO_EMC401_INTERN_VOLT_HI = 0x3210U,
CO_EMC401_INTERN_VOLT_LO = 0x3220U,
CO_EMC401_OUT_VOLT_HIGH = 0x3310U,
CO_EMC401_OUT_VOLT_LOW = 0x3320U,
} CO_EM_errorCode_t;
typedef enum {
CO_EM_NO_ERROR = 0x00U,
CO_EM_CAN_BUS_WARNING = 0x01U,
CO_EM_RXMSG_WRONG_LENGTH = 0x02U,
CO_EM_RXMSG_OVERFLOW = 0x03U,
CO_EM_RPDO_WRONG_LENGTH = 0x04U,
CO_EM_RPDO_OVERFLOW = 0x05U,
CO_EM_CAN_RX_BUS_PASSIVE = 0x06U,
CO_EM_CAN_TX_BUS_PASSIVE = 0x07U,
CO_EM_NMT_WRONG_COMMAND = 0x08U,
CO_EM_TIME_TIMEOUT = 0x09U,
CO_EM_TIME_LENGTH = 0x0AU,
CO_EM_0B_unused = 0x0BU,
CO_EM_0C_unused = 0x0CU,
CO_EM_0D_unused = 0x0DU,
CO_EM_0E_unused = 0x0EU,
CO_EM_0F_unused = 0x0FU,
CO_EM_10_unused = 0x10U,
CO_EM_11_unused = 0x11U,
CO_EM_CAN_TX_BUS_OFF = 0x12U,
CO_EM_CAN_RXB_OVERFLOW = 0x13U,
CO_EM_CAN_TX_OVERFLOW = 0x14U,
CO_EM_TPDO_OUTSIDE_WINDOW = 0x15U,
CO_EM_16_unused = 0x16U,
CO_EM_17_unused = 0x17U,
CO_EM_SYNC_TIME_OUT = 0x18U,
CO_EM_SYNC_LENGTH = 0x19U,
CO_EM_PDO_WRONG_MAPPING = 0x1AU,
CO_EM_HEARTBEAT_CONSUMER = 0x1BU,
CO_EM_HB_CONSUMER_REMOTE_RESET = 0x1CU,
CO_EM_1D_unused = 0x1DU,
CO_EM_1E_unused = 0x1EU,
CO_EM_1F_unused = 0x1FU,
CO_EM_EMERGENCY_BUFFER_FULL = 0x20U,
CO_EM_21_unused = 0x21U,
CO_EM_MICROCONTROLLER_RESET = 0x22U,
CO_EM_23_unused = 0x23U,
CO_EM_24_unused = 0x24U,
CO_EM_25_unused = 0x25U,
CO_EM_26_unused = 0x26U,
CO_EM_27_unused = 0x27U,
CO_EM_WRONG_ERROR_REPORT = 0x28U,
CO_EM_ISR_TIMER_OVERFLOW = 0x29U,
CO_EM_MEMORY_ALLOCATION_ERROR = 0x2AU,
CO_EM_GENERIC_ERROR = 0x2BU,
CO_EM_GENERIC_SOFTWARE_ERROR = 0x2CU,
CO_EM_INCONSISTENT_OBJECT_DICT = 0x2DU,
CO_EM_CALCULATION_OF_PARAMETERS = 0x2EU,
CO_EM_NON_VOLATILE_MEMORY = 0x2FU,
CO_EM_MANUFACTURER_START = 0x30U,
CO_EM_MANUFACTURER_END = CO_CONFIG_EM_ERR_STATUS_BITS_COUNT - 1
} CO_EM_errorStatusBits_t;
typedef struct {
uint8_t errorStatusBits[CO_CONFIG_EM_ERR_STATUS_BITS_COUNT / 8];
uint8_t *errorRegister;
uint16_t CANerrorStatusOld;
#if ((CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY)) \
|| defined CO_DOXYGEN
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) || defined CO_DOXYGEN
uint32_t fifo[CO_CONFIG_EM_BUFFER_SIZE + 1][2];
#else
uint32_t fifo[CO_CONFIG_EM_BUFFER_SIZE + 1][1];
#endif
uint8_t fifoWrPtr;
uint8_t fifoPpPtr;
uint8_t fifoOverflow;
uint8_t fifoCount;
#endif /* (CO_CONFIG_EM) & (CO_CONFIG_EM_PRODUCER | CO_CONFIG_EM_HISTORY) */
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) || defined CO_DOXYGEN
bool_t producerEnabled;
uint8_t nodeId;
CO_CANmodule_t *CANdevTx;
CO_CANtx_t *CANtxBuff;
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_CONFIGURABLE) || defined CO_DOXYGEN
uint16_t producerCanId;
uint16_t CANdevTxIdx;
#endif
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) || defined CO_DOXYGEN
uint32_t inhibitEmTime_us;
uint32_t inhibitEmTimer;
#endif
#endif /* (CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER */
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) || defined CO_DOXYGEN
void (*pFunctSignalRx)(const uint16_t ident,
const uint16_t errorCode,
const uint8_t errorRegister,
const uint8_t errorBit,
const uint32_t infoCode);
#endif
#if ((CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
void (*pFunctSignalPre)(void *object);
void *functSignalObjectPre;
#endif
} CO_EM_t;
CO_ReturnError_t CO_EM_init(CO_EM_t *em,
const OD_entry_t *OD_1001_errReg,
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PRODUCER) || defined CO_DOXYGEN
const OD_entry_t *OD_1014_cobIdEm,
CO_CANmodule_t *CANdevTx,
uint16_t CANdevTxIdx,
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_PROD_INHIBIT) || defined CO_DOXYGEN
const OD_entry_t *OD_1015_InhTime,
#endif
#endif
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_HISTORY) || defined CO_DOXYGEN
const OD_entry_t *OD_1003_preDefErr,
#endif
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_STATUS_BITS) || defined CO_DOXYGEN
const OD_entry_t *OD_statusBits,
#endif
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) || defined CO_DOXYGEN
CO_CANmodule_t *CANdevRx,
uint16_t CANdevRxIdx,
#endif
const uint8_t nodeId);
#if ((CO_CONFIG_EM) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
void CO_EM_initCallbackPre(CO_EM_t *em,
void *object,
void (*pFunctSignal)(void *object));
#endif
#if ((CO_CONFIG_EM) & CO_CONFIG_EM_CONSUMER) || defined CO_DOXYGEN
void CO_EM_initCallbackRx(CO_EM_t *em,
void (*pFunctSignalRx)(const uint16_t ident,
const uint16_t errorCode,
const uint8_t errorRegister,
const uint8_t errorBit,
const uint32_t infoCode));
#endif
void CO_EM_process(CO_EM_t *em,
bool_t NMTisPreOrOperational,
uint32_t timeDifference_us,
uint32_t *timerNext_us);
void CO_error(CO_EM_t *em, bool_t setError, const uint8_t errorBit,
uint16_t errorCode, uint32_t infoCode);
#define CO_errorReport(em, errorBit, errorCode, infoCode) \
CO_error(em, true, errorBit, errorCode, infoCode)
#define CO_errorReset(em, errorBit, infoCode) \
CO_error(em, false, errorBit, CO_EMC_NO_ERROR, infoCode)
static inline bool_t CO_isError(CO_EM_t *em, const uint8_t errorBit) {
uint8_t index = errorBit >> 3;
uint8_t bitmask = 1 << (errorBit & 0x7);
return (em == NULL || index >= (CO_CONFIG_EM_ERR_STATUS_BITS_COUNT / 8)
|| (em->errorStatusBits[index] & bitmask) != 0) ? true : false;
}
static inline uint8_t CO_getErrorRegister(CO_EM_t *em) {
return (em == NULL || em->errorRegister == NULL) ? 0 : *em->errorRegister;
}
/* CO_Emergency */
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /* CO_EMERGENCY_H */
uint32_t
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition: CO_driver.h:155
CO_EM_CALCULATION_OF_PARAMETERS
@ CO_EM_CALCULATION_OF_PARAMETERS
0x2E, generic, critical, Error in calculation of device parameters
Definition: CO_Emergency.h:349
CO_EM_t::producerCanId
uint16_t producerCanId
COB ID of emergency message, from Object dictionary.
Definition: CO_Emergency.h:412
CO_CONFIG_EM_ERR_STATUS_BITS_COUNT
#define CO_CONFIG_EM_ERR_STATUS_BITS_COUNT
Maximum number of CO_EM_errorStatusBits_t.
Definition: CO_config.h:214
CO_driver.h
Interface between CAN hardware and CANopenNode.
CO_EMC_HEARTBEAT
@ CO_EMC_HEARTBEAT
0x8130, Life Guard Error or Heartbeat Error
Definition: CO_Emergency.h:184
CO_EM_CAN_RX_BUS_PASSIVE
@ CO_EM_CAN_RX_BUS_PASSIVE
0x06, communication, info, CAN receive bus is passive
Definition: CO_Emergency.h:263
CO_EM_21_unused
@ CO_EM_21_unused
0x21, generic, info, (unused)
Definition: CO_Emergency.h:322
CO_EMC_MONITORING
@ CO_EMC_MONITORING
0x80xx, Monitoring
Definition: CO_Emergency.h:176
CO_EM_errorStatusBits_t
CO_EM_errorStatusBits_t
Error status bits.
Definition: CO_Emergency.h:247
CO_EM_GENERIC_ERROR
@ CO_EM_GENERIC_ERROR
0x2B, generic, critical, Generic error, test usage
Definition: CO_Emergency.h:343
CO_EMC401_OUT_LOAD_DUMP
@ CO_EMC401_OUT_LOAD_DUMP
0x2330, DS401, Load dump at outputs
Definition: CO_Emergency.h:215
CO_ERR_REG_VOLTAGE
@ CO_ERR_REG_VOLTAGE
bit 2, voltage
Definition: CO_Emergency.h:122
true
#define true
Logical true, for general use.
Definition: CO_driver.h:137
CO_EM_24_unused
@ CO_EM_24_unused
0x24, generic, info, (unused)
Definition: CO_Emergency.h:328
CO_EMC_ADDITIONAL_FUNC
@ CO_EMC_ADDITIONAL_FUNC
0xF0xx, Additional Functions
Definition: CO_Emergency.h:206
CO_error
void CO_error(CO_EM_t *em, bool_t setError, const uint8_t errorBit, uint16_t errorCode, uint32_t infoCode)
Set or reset error condition.
Definition: CO_Emergency.c:686
uint16_t
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition: CO_driver.h:153
CO_EM_TPDO_OUTSIDE_WINDOW
@ CO_EM_TPDO_OUTSIDE_WINDOW
0x15, communication, critical, TPDO is outside SYNC window
Definition: CO_Emergency.h:295
CO_EM_t::CANdevTxIdx
uint16_t CANdevTxIdx
From CO_EM_init()
Definition: CO_Emergency.h:414
CO_EM_t::CANerrorStatusOld
uint16_t CANerrorStatusOld
Old CAN error status bitfield.
Definition: CO_Emergency.h:375
CO_EM_t::producerEnabled
bool_t producerEnabled
True, if emergency producer is enabled, from Object dictionary.
Definition: CO_Emergency.h:403
CO_EMC_CAN_ID_COLLISION
@ CO_EMC_CAN_ID_COLLISION
0x8150, CAN-ID collision
Definition: CO_Emergency.h:188
CO_EM_t::CANtxBuff
CO_CANtx_t * CANtxBuff
CAN transmit buffer.
Definition: CO_Emergency.h:409
CO_ReturnError_t
CO_ReturnError_t
Return values of some CANopen functions.
Definition: CO_driver.h:488
CO_EMC_GENERIC
@ CO_EMC_GENERIC
0x10xx, Generic Error
Definition: CO_Emergency.h:140
CO_EM_RXMSG_WRONG_LENGTH
@ CO_EM_RXMSG_WRONG_LENGTH
0x02, communication, info, Wrong data length of the received CAN message
Definition: CO_Emergency.h:254
CO_EM_SYNC_TIME_OUT
@ CO_EM_SYNC_TIME_OUT
0x18, communication, critical, SYNC message timeout
Definition: CO_Emergency.h:301
CO_ERR_REG_COMMUNICATION
@ CO_ERR_REG_COMMUNICATION
bit 4, communication error
Definition: CO_Emergency.h:124
CO_EMC401_INTERN_VOLT_HI
@ CO_EMC401_INTERN_VOLT_HI
0x3210, DS401, Internal voltage too high
Definition: CO_Emergency.h:221
CO_EMC_COMMUNICATION
@ CO_EMC_COMMUNICATION
0x81xx, Communication
Definition: CO_Emergency.h:178
bool_t
unsigned char bool_t
Boolean data type for general use.
Definition: CO_driver.h:141
CO_ERR_REG_RESERVED
@ CO_ERR_REG_RESERVED
bit 6, reserved (always 0)
Definition: CO_Emergency.h:126
CO_EMC_PDO_LENGTH
@ CO_EMC_PDO_LENGTH
0x8210, PDO not processed due to length error
Definition: CO_Emergency.h:192
CO_ERR_REG_GENERIC_ERR
@ CO_ERR_REG_GENERIC_ERR
bit 0, generic error
Definition: CO_Emergency.h:120
CO_EM_0F_unused
@ CO_EM_0F_unused
0x0F, communication, info, (unused)
Definition: CO_Emergency.h:281
CO_EM_1D_unused
@ CO_EM_1D_unused
0x1D, communication, critical, (unused)
Definition: CO_Emergency.h:312
CO_EMC_DAM_MPDO
@ CO_EMC_DAM_MPDO
0x8230, DAM MPDO not processed, destination object not available
Definition: CO_Emergency.h:196
CO_EM_MICROCONTROLLER_RESET
@ CO_EM_MICROCONTROLLER_RESET
0x22, generic, info, Microcontroller has just started
Definition: CO_Emergency.h:324
CO_ERR_REG_CURRENT
@ CO_ERR_REG_CURRENT
bit 1, current
Definition: CO_Emergency.h:121
CO_EMC_ADDITIONAL_MODUL
@ CO_EMC_ADDITIONAL_MODUL
0x70xx, Additional Modules
Definition: CO_Emergency.h:174
CO_EM_WRONG_ERROR_REPORT
@ CO_EM_WRONG_ERROR_REPORT
0x28, generic, critical, Wrong parameters to CO_errorReport() function
Definition: CO_Emergency.h:337
CO_EMC_PROTOCOL_ERROR
@ CO_EMC_PROTOCOL_ERROR
0x82xx, Protocol Error
Definition: CO_Emergency.h:190
CO_EM_27_unused
@ CO_EM_27_unused
0x27, generic, info, (unused)
Definition: CO_Emergency.h:334
CO_EMC_BUS_OFF_RECOVERED
@ CO_EMC_BUS_OFF_RECOVERED
0x8140, recovered from bus off
Definition: CO_Emergency.h:186
CO_EM_NON_VOLATILE_MEMORY
@ CO_EM_NON_VOLATILE_MEMORY
0x2F, generic, critical, Error with access to non volatile device memory
Definition: CO_Emergency.h:352
CO_EM_SYNC_LENGTH
@ CO_EM_SYNC_LENGTH
0x19, communication, critical, Unexpected SYNC data length
Definition: CO_Emergency.h:303
CO_EM_GENERIC_SOFTWARE_ERROR
@ CO_EM_GENERIC_SOFTWARE_ERROR
0x2C, generic, critical, Software error
Definition: CO_Emergency.h:345
CO_ERR_REG_DEV_PROFILE
@ CO_ERR_REG_DEV_PROFILE
bit 5, device profile specific
Definition: CO_Emergency.h:125
CO_EM_10_unused
@ CO_EM_10_unused
0x10, communication, critical, (unused)
Definition: CO_Emergency.h:284
CO_EM_EMERGENCY_BUFFER_FULL
@ CO_EM_EMERGENCY_BUFFER_FULL
0x20, generic, info, Emergency buffer is full, Emergency message wasn't sent
Definition: CO_Emergency.h:320
CO_EMC_DATA_SET
@ CO_EMC_DATA_SET
0x63xx, Data Set
Definition: CO_Emergency.h:172
CO_EM_0B_unused
@ CO_EM_0B_unused
0x0B, communication, info, (unused)
Definition: CO_Emergency.h:273
CO_EMC401_OUT_CUR_HI
@ CO_EMC401_OUT_CUR_HI
0x2310, DS401, Current at outputs too high (overload)
Definition: CO_Emergency.h:211
CO_EMC_SOFTWARE_INTERNAL
@ CO_EMC_SOFTWARE_INTERNAL
0x61xx, Internal Software
Definition: CO_Emergency.h:168
CO_EM_MANUFACTURER_END
@ CO_EM_MANUFACTURER_END
(CO_CONFIG_EM_ERR_STATUS_BITS_COUNT - 1), largest value of the Error status bit.
Definition: CO_Emergency.h:362
CO_EMC_CURRENT
@ CO_EMC_CURRENT
0x20xx, Current
Definition: CO_Emergency.h:142
CO_EM_1E_unused
@ CO_EM_1E_unused
0x1E, communication, critical, (unused)
Definition: CO_Emergency.h:314
CO_EM_CAN_RXB_OVERFLOW
@ CO_EM_CAN_RXB_OVERFLOW
0x13, communication, critical, CAN module receive buffer has overflowed
Definition: CO_Emergency.h:291
CO_EMC_SOFTWARE_DEVICE
@ CO_EMC_SOFTWARE_DEVICE
0x60xx, Device Software
Definition: CO_Emergency.h:166
CO_EM_NMT_WRONG_COMMAND
@ CO_EM_NMT_WRONG_COMMAND
0x08, communication, info, Wrong NMT command received
Definition: CO_Emergency.h:267
CO_EM_INCONSISTENT_OBJECT_DICT
@ CO_EM_INCONSISTENT_OBJECT_DICT
0x2D, generic, critical, Object dictionary does not match the software
Definition: CO_Emergency.h:347
CO_EMC401_OUT_SHORTED
@ CO_EMC401_OUT_SHORTED
0x2320, DS401, Short circuit at outputs
Definition: CO_Emergency.h:213
CO_EMC_CURRENT_OUTPUT
@ CO_EMC_CURRENT_OUTPUT
0x23xx, Current, device output side
Definition: CO_Emergency.h:148
CO_EMC_VOLTAGE_OUTPUT
@ CO_EMC_VOLTAGE_OUTPUT
0x33xx, Output Voltage
Definition: CO_Emergency.h:156
CO_EM_t::CANdevTx
CO_CANmodule_t * CANdevTx
From CO_EM_init()
Definition: CO_Emergency.h:407
CO_EM_CAN_TX_BUS_PASSIVE
@ CO_EM_CAN_TX_BUS_PASSIVE
0x07, communication, info, CAN transmit bus is passive
Definition: CO_Emergency.h:265
CO_EM_CAN_TX_BUS_OFF
@ CO_EM_CAN_TX_BUS_OFF
0x12, communication, critical, CAN transmit bus is off
Definition: CO_Emergency.h:288
CO_EM_CAN_TX_OVERFLOW
@ CO_EM_CAN_TX_OVERFLOW
0x14, communication, critical, CAN transmit buffer has overflowed
Definition: CO_Emergency.h:293
CO_EM_MANUFACTURER_START
@ CO_EM_MANUFACTURER_START
0x30+, manufacturer, info or critical, Error status buts, free to use by manufacturer.
Definition: CO_Emergency.h:359
CO_EM_RPDO_OVERFLOW
@ CO_EM_RPDO_OVERFLOW
0x05, communication, info, Previous received PDO wasn't processed yet
Definition: CO_Emergency.h:261
CO_EMC_DEVICE_SPECIFIC
@ CO_EMC_DEVICE_SPECIFIC
0xFFxx, Device specific
Definition: CO_Emergency.h:208
CO_EMC401_OUT_VOLT_LOW
@ CO_EMC401_OUT_VOLT_LOW
0x3320, DS401, Output voltage too low
Definition: CO_Emergency.h:227
CO_EM_errorCode_t
CO_EM_errorCode_t
CANopen Error code.
Definition: CO_Emergency.h:136
CO_EMC_VOLTAGE_INSIDE
@ CO_EMC_VOLTAGE_INSIDE
0x32xx, Voltage inside the device
Definition: CO_Emergency.h:154
CO_EMC401_INTERN_VOLT_LO
@ CO_EMC401_INTERN_VOLT_LO
0x3220, DS401, Internal voltage too low
Definition: CO_Emergency.h:223
CO_EMC_HARDWARE
@ CO_EMC_HARDWARE
0x50xx, Device Hardware
Definition: CO_Emergency.h:164
CO_EM_t::nodeId
uint8_t nodeId
Copy of CANopen node ID, from CO_EM_init()
Definition: CO_Emergency.h:405
CO_EM_t::fifoCount
uint8_t fifoCount
Count of emergency messages in fifo, used for OD object 0x1003.
Definition: CO_Emergency.h:398
CO_EM_NO_ERROR
@ CO_EM_NO_ERROR
0x00, Error Reset or No Error
Definition: CO_Emergency.h:249
CO_CONFIG_EM_BUFFER_SIZE
#define CO_CONFIG_EM_BUFFER_SIZE
Size of the internal buffer, where emergencies are stored after error indication with CO_error() func...
Definition: CO_config.h:228
CO_errorRegister_t
CO_errorRegister_t
CANopen Error register.
Definition: CO_Emergency.h:119
CO_EM_HB_CONSUMER_REMOTE_RESET
@ CO_EM_HB_CONSUMER_REMOTE_RESET
0x1C, communication, critical, Heartbeat consumer detected remote node reset
Definition: CO_Emergency.h:310
CO_EM_t::errorRegister
uint8_t * errorRegister
Pointer to error register in object dictionary at 0x1001,00.
Definition: CO_Emergency.h:373
CO_EM_initCallbackPre
void CO_EM_initCallbackPre(CO_EM_t *em, void *object, void(*pFunctSignal)(void *object))
Initialize Emergency callback function.
CO_EM_t::fifoOverflow
uint8_t fifoOverflow
Indication of overflow - messages in buffer are not post-processed.
Definition: CO_Emergency.h:396
CO_EM_HEARTBEAT_CONSUMER
@ CO_EM_HEARTBEAT_CONSUMER
0x1B, communication, critical, Heartbeat consumer timeout
Definition: CO_Emergency.h:307
CO_EMC_TEMP_AMBIENT
@ CO_EMC_TEMP_AMBIENT
0x41xx, Ambient Temperature
Definition: CO_Emergency.h:160
CO_EM_CAN_BUS_WARNING
@ CO_EM_CAN_BUS_WARNING
0x01, communication, info, CAN bus warning limit reached
Definition: CO_Emergency.h:251
CO_getErrorRegister
static uint8_t CO_getErrorRegister(CO_EM_t *em)
Get error register.
Definition: CO_Emergency.h:620
CO_EM_t::fifoPpPtr
uint8_t fifoPpPtr
Pointer for the fifo, where next emergency message has to be post-processed by CO_EM_process() functi...
Definition: CO_Emergency.h:394
CO_EM_11_unused
@ CO_EM_11_unused
0x11, communication, critical, (unused)
Definition: CO_Emergency.h:286
CO_EM_t
Emergency object.
Definition: CO_Emergency.h:369
CO_EM_23_unused
@ CO_EM_23_unused
0x23, generic, info, (unused)
Definition: CO_Emergency.h:326
CO_EMC401_IN_VOLT_HI
@ CO_EMC401_IN_VOLT_HI
0x3110, DS401, Input voltage too high
Definition: CO_Emergency.h:217
CO_EM_t::fifoWrPtr
uint8_t fifoWrPtr
Pointer for the fifo buffer, where next emergency message will be written by CO_error() function.
Definition: CO_Emergency.h:390
CO_CONFIG_EM
#define CO_CONFIG_EM
Configuration of Emergency.
Definition: CO_config.h:197
CO_EMC_CAN_PASSIVE
@ CO_EMC_CAN_PASSIVE
0x8120, CAN in Error Passive Mode
Definition: CO_Emergency.h:182
CO_EM_1F_unused
@ CO_EM_1F_unused
0x1F, communication, critical, (unused)
Definition: CO_Emergency.h:316
CO_EMC_SYNC_DATA_LENGTH
@ CO_EMC_SYNC_DATA_LENGTH
0x8240, Unexpected SYNC data length
Definition: CO_Emergency.h:198
CO_EM_t::errorStatusBits
uint8_t errorStatusBits[CO_CONFIG_EM_ERR_STATUS_BITS_COUNT/8]
Bitfield for the internal indication of the error condition.
Definition: CO_Emergency.h:371
CO_ODinterface.h
CANopen Object Dictionary interface.
CO_EM_t::functSignalObjectPre
void * functSignalObjectPre
From CO_EM_initCallbackPre() or NULL.
Definition: CO_Emergency.h:437
CO_EM_25_unused
@ CO_EM_25_unused
0x25, generic, info, (unused)
Definition: CO_Emergency.h:330
CO_EMC_TIME_DATA_LENGTH
@ CO_EMC_TIME_DATA_LENGTH
0x8260, Unexpected TIME data length
Definition: CO_Emergency.h:202
CO_EMC_PDO_LENGTH_EXC
@ CO_EMC_PDO_LENGTH_EXC
0x8220, PDO length exceeded
Definition: CO_Emergency.h:194
CO_EM_init
CO_ReturnError_t CO_EM_init(CO_EM_t *em, const OD_entry_t *OD_1001_errReg, const OD_entry_t *OD_1014_cobIdEm, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx, const OD_entry_t *OD_1015_InhTime, const OD_entry_t *OD_1003_preDefErr, const OD_entry_t *OD_statusBits, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx, const uint8_t nodeId)
Initialize Emergency object.
CO_EMC_EXTERNAL_ERROR
@ CO_EMC_EXTERNAL_ERROR
0x90xx, External Error
Definition: CO_Emergency.h:204
CO_EM_0C_unused
@ CO_EM_0C_unused
0x0C, communication, info, (unused)
Definition: CO_Emergency.h:275
CO_EM_TIME_LENGTH
@ CO_EM_TIME_LENGTH
0x0A, communication, info, Unexpected TIME data length
Definition: CO_Emergency.h:271
CO_EMC401_OUT_VOLT_HIGH
@ CO_EMC401_OUT_VOLT_HIGH
0x3310, DS401, Output voltage too high
Definition: CO_Emergency.h:225
CO_EMC_VOLTAGE_MAINS
@ CO_EMC_VOLTAGE_MAINS
0x31xx, Mains Voltage
Definition: CO_Emergency.h:152
CO_EM_17_unused
@ CO_EM_17_unused
0x17, communication, critical, (unused)
Definition: CO_Emergency.h:299
CO_EMC_TEMP_DEVICE
@ CO_EMC_TEMP_DEVICE
0x42xx, Device Temperature
Definition: CO_Emergency.h:162
CO_EM_0E_unused
@ CO_EM_0E_unused
0x0E, communication, info, (unused)
Definition: CO_Emergency.h:279
CO_EM_initCallbackRx
void CO_EM_initCallbackRx(CO_EM_t *em, void(*pFunctSignalRx)(const uint16_t ident, const uint16_t errorCode, const uint8_t errorRegister, const uint8_t errorBit, const uint32_t infoCode))
Initialize Emergency received callback function.
CO_isError
static bool_t CO_isError(CO_EM_t *em, const uint8_t errorBit)
Check specific error condition.
Definition: CO_Emergency.h:605
CO_EM_0D_unused
@ CO_EM_0D_unused
0x0D, communication, info, (unused)
Definition: CO_Emergency.h:277
CO_ERR_REG_MANUFACTURER
@ CO_ERR_REG_MANUFACTURER
bit 7, manufacturer specific
Definition: CO_Emergency.h:127
CO_EMC_RPDO_TIMEOUT
@ CO_EMC_RPDO_TIMEOUT
0x8250, RPDO timeout
Definition: CO_Emergency.h:200
NULL
#define NULL
NULL, for general usage.
Definition: CO_driver.h:135
CO_EM_RXMSG_OVERFLOW
@ CO_EM_RXMSG_OVERFLOW
0x03, communication, info, Previous received CAN message wasn't processed yet
Definition: CO_Emergency.h:257
CO_EMC_CAN_OVERRUN
@ CO_EMC_CAN_OVERRUN
0x8110, CAN Overrun (Objects lost)
Definition: CO_Emergency.h:180
CO_CANmodule_t
Complete CAN module object.
Definition: CO_driver.h:319
CO_EM_ISR_TIMER_OVERFLOW
@ CO_EM_ISR_TIMER_OVERFLOW
0x29, generic, critical, Timer task has overflowed
Definition: CO_Emergency.h:339
CO_EM_process
void CO_EM_process(CO_EM_t *em, bool_t NMTisPreOrOperational, uint32_t timeDifference_us, uint32_t *timerNext_us)
Process Error control and Emergency object.
Definition: CO_Emergency.c:538
CO_EMC401_IN_VOLT_LOW
@ CO_EMC401_IN_VOLT_LOW
0x3120, DS401, Input voltage too low
Definition: CO_Emergency.h:219
CO_EM_TIME_TIMEOUT
@ CO_EM_TIME_TIMEOUT
0x09, communication, info, TIME message timeout
Definition: CO_Emergency.h:269
OD_entry_t
Object Dictionary entry for one OD object.
Definition: CO_ODinterface.h:336
CO_EMC_SOFTWARE_USER
@ CO_EMC_SOFTWARE_USER
0x62xx, User Software
Definition: CO_Emergency.h:170
CO_EM_MEMORY_ALLOCATION_ERROR
@ CO_EM_MEMORY_ALLOCATION_ERROR
0x2A, generic, critical, Unable to allocate memory for objects
Definition: CO_Emergency.h:341
CO_EMC_VOLTAGE
@ CO_EMC_VOLTAGE
0x30xx, Voltage
Definition: CO_Emergency.h:150
CO_EM_16_unused
@ CO_EM_16_unused
0x16, communication, critical, (unused)
Definition: CO_Emergency.h:297
CO_EM_PDO_WRONG_MAPPING
@ CO_EM_PDO_WRONG_MAPPING
0x1A, communication, critical, Error with PDO mapping
Definition: CO_Emergency.h:305
CO_EMC_TEMPERATURE
@ CO_EMC_TEMPERATURE
0x40xx, Temperature
Definition: CO_Emergency.h:158
CO_ERR_REG_TEMPERATURE
@ CO_ERR_REG_TEMPERATURE
bit 3, temperature
Definition: CO_Emergency.h:123
CO_EMC_CURRENT_INSIDE
@ CO_EMC_CURRENT_INSIDE
0x22xx, Current inside the device
Definition: CO_Emergency.h:146
CO_EMC_CURRENT_INPUT
@ CO_EMC_CURRENT_INPUT
0x21xx, Current, device input side
Definition: CO_Emergency.h:144
CO_CANtx_t
Configuration object for CAN transmit message for specific CANopenNode Object.
Definition: CO_driver.h:299
CO_EMC_NO_ERROR
@ CO_EMC_NO_ERROR
0x00xx, error Reset or No Error
Definition: CO_Emergency.h:138
CO_EM_t::inhibitEmTime_us
uint32_t inhibitEmTime_us
Inhibit time for emergency message, from Object dictionary.
Definition: CO_Emergency.h:418
CO_EM_26_unused
@ CO_EM_26_unused
0x26, generic, info, (unused)
Definition: CO_Emergency.h:332
uint8_t
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition: CO_driver.h:151
CO_EM_RPDO_WRONG_LENGTH
@ CO_EM_RPDO_WRONG_LENGTH
0x04, communication, info, Wrong data length of received PDO
Definition: CO_Emergency.h:259