CANopen Slave Documentation
Version 6.16.04
|
Emergency objects are triggered by the occurrence of a device internal error situation and are transmitted from an emergency producer on the device. Emergency objects are suitable for interrupt type error alerts. An emergency object is transmitted only once per error event. As long as no new errors occur on a device no further emergency objects must be transmitted. The emergency object may be received by zero or more emergency consumers. The reaction on the emergency consumer(s) is not specified (see CiA 301).
EMCY error codes for possible error conditions of the CANopen device are registered inside the EMCY error state machine by means of the CosEmcyErrorRegister() function. Once a error condition is registered, it can be set by CosEmcyErrorSet() and cleared by CosEmcyErrorClr(). Setting and clearing the individual registered error conditions will trigger the transmission of the EMCY object service as well as altering the value of the error register (index 1001h). It is possible to clear all registered error conditions by calling CosEmcyErrorReset().
The following error conditions are already registered by the the protocol stack during initialization:
Error Condition | Assigned EMCY code | Set by stack | Cleared by stack |
---|---|---|---|
eEMCY_301_COMMUNICATION | EMCY_ERR_COMMUNICATION | Yes | Yes |
eEMCY_301_CAN_ERROR_PASSIVE | EMCY_ERR_CAN_ERROR_PASSIVE | Yes | Yes |
eEMCY_301_CAN_OVERRUN | EMCY_ERR_CAN_OVERRUN | Yes | No |
eEMCY_301_CAN_BUSOFF_RECOVER | EMCY_ERR_CAN_BUSOFF_RECOVER | Yes | Yes |
eEMCY_301_CAN_TX_COB_COLLISION | EMCY_ERR_CAN_TX_COB_COLLISION | Yes | No |
eEMCY_301_CAN_LIFEGUARD | EMCY_ERR_CAN_LIFEGUARD | Yes | No |
eEMCY_301_MAINS_VOLTAGE | EMCY_ERR_VOLT_GENERAL | No | No |
eEMCY_301_DEVICE_TEMPERATURE | EMCY_ERR_TEMP_DEVICE | No | No |
eEMCY_301_SYNC_LENGTH | EMCY_ERR_PROTOCOL_SYNC_LENGTH | Yes | No |
eEMCY_301_PROTOCOL_PDO | EMCY_ERR_PROTOCOL_PDO | Yes | No |
Application specific error conditions can be added inside the file cos_emcy_user.h
The registration of application specific error conditions can be done inside the CosMgrOnStart() function.
Macros | |
#define | EMCY_ERR_NONE ((uint16_t) 0x0000) |
#define | EMCY_ERR_GENERIC ((uint16_t) 0x1000) |
#define | EMCY_ERR_VOLT_GENERAL ((uint16_t) 0x3000) |
#define | EMCY_ERR_TEMP_GENERAL ((uint16_t) 0x4000) |
#define | EMCY_ERR_TEMP_DEVICE ((uint16_t) 0x4200) |
#define | EMCY_ERR_HW_GENERIC ((uint16_t) 0x5000) |
#define | EMCY_ERR_SW_GENERIC ((uint16_t) 0x6000) |
#define | EMCY_ERR_MONITORING ((uint16_t) 0x8000) |
#define | EMCY_ERR_COMMUNICATION ((uint16_t) 0x8100) |
#define | EMCY_ERR_CAN_OVERRUN ((uint16_t) 0x8110) |
#define | EMCY_ERR_CAN_ERROR_PASSIVE ((uint16_t) 0x8120) |
#define | EMCY_ERR_CAN_LIFEGUARD ((uint16_t) 0x8130) |
#define | EMCY_ERR_CAN_BUSOFF_RECOVER ((uint16_t) 0x8140) |
#define | EMCY_ERR_CAN_TX_COB_COLLISION ((uint16_t) 0x8150) |
#define | EMCY_ERR_NRL_PASSIVE_USE_DCL ((uint16_t) 0x8180) |
#define | EMCY_ERR_NRL_PASSIVE_USE_RCL ((uint16_t) 0x8181) |
#define | EMCY_ERR_PROTOCOL ((uint16_t) 0x8200) |
#define | EMCY_ERR_PROTOCOL_PDO ((uint16_t) 0x8210) |
#define | EMCY_ERR_PROTOCOL_PDO_EXCEED ((uint16_t) 0x8220) |
#define | EMCY_ERR_PROTOCOL_PDO_MPDO ((uint16_t) 0x8230) |
#define | EMCY_ERR_PROTOCOL_SYNC_LENGTH ((uint16_t) 0x8240) |
#define | EMCY_ERR_PROTOCOL_RPDO ((uint16_t) 0x8250) |
#define | EMCY_ERR_DEV_GENERAL ((uint16_t) 0xFF00) |
Enumerations | |
enum | CosEmcy301_e { } |
enum | CosEmcy_e { eEMCY_COS_MAX = eEMCY_301_MAX } |
Functions | |
Status_tv | CosEmcyErrorClr (uint8_t ubErrConditionV) |
Status_tv | CosEmcyErrorRegister (uint8_t ubErrConditionV, uint16_t uwErrCodeV, uint8_t ubErrRegisterV, uint8_t ubErrCompareV) |
void | CosEmcyErrorReset (void) |
Status_tv | CosEmcyErrorSet (uint8_t ubErrConditionV, uint8_t *pubCustomerCodeV) |
void | CosEmcySend (uint16_t uwEmcyCodeV, uint8_t *pubCustomerCodeV) |
enum CosEmcy301_e |
EMCY error index.
The following enumeration values correspond to an EMCY error index used the the error state machine. The value is used by the function CosEmcyErrorRegister():
enum CosEmcy_e |
EMCY error index.
The following enumeration calculates the highest supported error condition used the the error state machine. The value is used by the function CosEmcyErrorRegister().
Enumerator | |
---|---|
eEMCY_COS_MAX | Maximum number of supported error conditions in EMCY state machine |
Status_tv CosEmcyErrorClr | ( | uint8_t | ubErrConditionV | ) |
[in] | ubErrConditionV | Error condition, defined by CosEmcy_e |
The function clears an error condition defined by ubErrConditionV from pending state. An EMCY reset message will be transmitted via CAN bus. If other errors are still pending, then the corresponding EMCY messages will be send afterwards.
Status_tv CosEmcyErrorRegister | ( | uint8_t | ubErrConditionV, |
uint16_t | uwErrCodeV, | ||
uint8_t | ubErrRegisterV, | ||
uint8_t | ubErrCompareV | ||
) |
[in] | ubErrConditionV | Error condition, defined by CosEmcy_e |
[in] | uwErrCodeV | Corresponding Emergency Error Code |
[in] | ubErrRegisterV | Corresponding bit in error register (object 1001h) |
[in] | ubErrCompareV | Compare manufacturer specific error data |
This function registers an error condition defined by ubErrConditionV to the EMCY error state machine. Only registered error conditions can be handled by CosEmcyErrorSet() and CosEmcyErrorClr(). If ubErrCompareV is to 1, the function CosEmcyErrorSet() will compare manufacturer specific error data with previously set data. In case of a difference a EMCY message is sent, otherwise the transmission is omitted.
void CosEmcyErrorReset | ( | void | ) |
The function resets all errors inside the Emergency state machine. If errors are present, an EMCY reset message (EMCY_ERR_NONE) is sent on the bus.
Status_tv CosEmcyErrorSet | ( | uint8_t | ubErrConditionV, |
uint8_t * | pubCustomerCodeV | ||
) |
[in] | ubErrConditionV | Error condition, defined by CosEmcy_e |
[in] | pubCustomerCodeV | Pointer to manufacturer specific error data |
The functions sets an error condition defined by ubErrConditionV to pending state. If the error was not in pending state, an EMCY message with the corresponding code is sent on the bus.
void CosEmcySend | ( | uint16_t | uwEmcyCodeV, |
uint8_t * | pubCustomerCodeV | ||
) |
[in] | uwEmcyCodeV | Emergency Error Code |
[in] | pubCustomerCodeV | Customer specific code |
This function is called internally by the EMCY error state machine. It is not recommended to call this function directly by the application program.
The parameter uwEmcyCodeV defines the EMCY error code. The pointer pubCustomerCodeV refers to an array of 5 byte which contains customer specific information. The pointer pubCustomerCodeV can be 0L.