CANopen Master Documentation
Version 6.06.04
|
Emergency (EMCY) 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.
The EMCY consumer functionality can be activated or deactivated via the preprocessor symbol COM_EMCY_CONS_SUPPORT. The EMCY consumer functionality is activated by default. Reception of an EMCY message is enabled via the function ComEmcyConsEnable() based on the node-ID of the EMCY producer. As default, no EMCY messages are received.
Upon reception of an enabled EMCY message the function ComEmcyConsEventReceive() is called., which only informs about the node-ID of the EMCY producer.
EMCY messages can be stored in a queue, the queue is disabled by default. The function ComEmcyConsQueueEnable() is used to enable a queue for EMCY messages. By means of the function ComEmcyConsQueueCount() the number of messages stored inside the queue can be retrieved. EMCY messages can be fetched from the queue by calling ComEmcyConsQueueFetch(). The following example shows how to read the EMCY queue inside the ComEmcyConsEventReceive() handler.
Macros | |
#define | EMCY_ERR_NONE 0x0000 |
#define | EMCY_ERR_GENERIC 0x1000 |
#define | EMCY_ERR_CURR_GENERIC 0x2000 |
#define | EMCY_ERR_CURR_INPUT 0x2100 |
#define | EMCY_ERR_CURR_DEVICE 0x2200 |
#define | EMCY_ERR_CURR_OUTPUT 0x2300 |
#define | EMCY_ERR_VOLT_GENERIC 0x3000 |
#define | EMCY_ERR_VOLT_INPUT 0x3100 |
#define | EMCY_ERR_VOLT_DEVICE 0x3200 |
#define | EMCY_ERR_VOLT_OUTPUT 0x3300 |
#define | EMCY_ERR_TEMP_GENERIC 0x4000 |
#define | EMCY_ERR_TEMP_AMBIENT 0x4100 |
#define | EMCY_ERR_TEMP_DEVICE 0x4200 |
#define | EMCY_ERR_HW_GENERAL 0x5000 |
#define | EMCY_ERR_MONITORING 0x8000 |
#define | EMCY_ERR_COMMUNICATION 0x8100 |
#define | EMCY_ERR_CAN_OVERRUN 0x8110 |
#define | EMCY_ERR_CAN_ERROR_PASSIVE 0x8120 |
#define | EMCY_ERR_CAN_LIFEGUARD 0x8130 |
#define | EMCY_ERR_CAN_BUSOFF_RECOVER 0x8140 |
#define | EMCY_ERR_CAN_TX_COB_COLLISION 0x8150 |
#define | EMCY_ERR_PROTOCOL 0x8200 |
#define | EMCY_ERR_PROTOCOL_PDO 0x8210 |
#define | EMCY_ERR_PROTOCOL_PDO_EXCEED 0x8210 |
#define | EMCY_ERR_DEV_GENERAL 0xFF00 |
Functions | |
ComStatus_tv | ComEmcyConsEnable (uint8_t ubNetV, uint8_t ubNodeIdV, uint8_t ubEnableV) |
void | ComEmcyConsEventReceive (uint8_t ubNetV, uint8_t ubNodeIdV) |
ComStatus_tv | ComEmcyConsGetId (uint8_t ubNetV, uint8_t ubNodeIdV, uint32_t *pulIdV) |
ComStatus_tv | ComEmcyConsIsEnabled (uint8_t ubNetV, uint8_t ubNodeIdV, uint8_t *pubEnableV) |
ComStatus_tv | ComEmcyConsSetId (uint8_t ubNetV, uint8_t ubNodeIdV, uint32_t ulIdV) |
ComStatus_tv | ComEmcyConsQueueClear (uint8_t ubNetV) |
ComStatus_tv | ComEmcyConsQueueCount (uint8_t ubNetV, uint16_t *puwCountV) |
ComStatus_tv | ComEmcyConsQueueDisable (uint8_t ubNetV) |
ComStatus_tv | ComEmcyConsQueueEnable (uint8_t ubNetV) |
ComStatus_tv | ComEmcyConsQueueFetch (uint8_t ubNetV, CpCanMsg_ts *ptsCanMsgV) |
ComStatus_tv | ComEmcyEnable (uint8_t ubNetV, uint8_t ubEnableV) |
ComStatus_tv | ComEmcyGetId (uint8_t ubNetV, uint32_t *pulIdV) |
ComStatus_tv | ComEmcyGetInhibit (uint8_t ubNetV, uint32_t *pulTimeV) |
ComStatus_tv | ComEmcyIsEnabled (uint8_t ubNetV, uint8_t *pubEnableV) |
ComStatus_tv | ComEmcySend (uint8_t ubNetV, uint16_t uwEmcyCodeV, uint8_t *pubManCodeV) |
ComStatus_tv | ComEmcySetId (uint8_t ubNetV, uint32_t ulIdV) |
ComStatus_tv | ComEmcySetInhibit (uint8_t ubNetV, uint32_t ulTimeV) |
ComStatus_tv ComEmcyConsEnable | ( | uint8_t | ubNetV, |
uint8_t | ubNodeIdV, | ||
uint8_t | ubEnableV | ||
) |
ubNetV | - CANopen Network channel |
ubNodeIdV | - Identifier of CANopen device |
ubEnableV | - Enable/Disable EMCY service |
This function enables (ubEnableV = 1) or disables (ubEnableV = 0) the EMCY consumer service for a Node ID given by ubNodeIdV. Valid values for node-ID are limited by the COM_NODE_MAX symbol in com_conf.h.
void ComEmcyConsEventReceive | ( | uint8_t | ubNetV, |
uint8_t | ubNodeIdV | ||
) |
ubNetV | - CANopen Network channel |
ubNodeIdV | - Identifier of CANopen device |
The function is called by the CANopen Master stack upon reception of an EMCY message. The EMCY message has to be enabled by ComEmcyConsEnable() in advance.
ComStatus_tv ComEmcyConsGetId | ( | uint8_t | ubNetV, |
uint8_t | ubNodeIdV, | ||
uint32_t * | pulIdV | ||
) |
Set EMCY consumer service identifier.
ubNetV | - CANopen Network channel |
ubNodeIdV | - Node Identifier of CANopen device |
pulIdV | - pointer to identifier of EMCY |
ComStatus_tv ComEmcyConsIsEnabled | ( | uint8_t | ubNetV, |
uint8_t | ubNodeIdV, | ||
uint8_t * | pubEnableV | ||
) |
Enable EMCY service.
ubNetV | - CANopen Network channel |
ubNodeIdV | - Identifier of CANopen device |
pubEnableV | - pointer to Enable/Disable EMCY service |
ComStatus_tv ComEmcyConsQueueClear | ( | uint8_t | ubNetV | ) |
[in] | ubNetV | CANopen Network channel |
The function removes all messages inside the EMCY receive queue.
ComStatus_tv ComEmcyConsQueueCount | ( | uint8_t | ubNetV, |
uint16_t * | puwCountV | ||
) |
[in] | ubNetV | CANopen Network channel |
[out] | puwCountV | Number of messages present in the queue |
The function retrieves the number of pending elements inside a EMCY receive queue.
ComStatus_tv ComEmcyConsQueueDisable | ( | uint8_t | ubNetV | ) |
[in] | ubNetV | CANopen Network channel |
The function disables the EMCY receive queue on the selected CANopen network channel.
ComStatus_tv ComEmcyConsQueueEnable | ( | uint8_t | ubNetV | ) |
[in] | ubNetV | CANopen Network channel |
The function enables the EMCY receive queue on the selected CANopen network channel.
ComStatus_tv ComEmcyConsQueueFetch | ( | uint8_t | ubNetV, |
CpCanMsg_ts * | ptsCanMsgV | ||
) |
[in] | ubNetV | CANopen Network channel |
[out] | ptsCanMsgV | Pointer to CAN message structure |
The function fetches one CAN message from the EMCY receive queue.
ComStatus_tv ComEmcyConsSetId | ( | uint8_t | ubNetV, |
uint8_t | ubNodeIdV, | ||
uint32_t | ulIdV | ||
) |
Set EMCY consumer service identifier.
ubNetV | - CANopen Network channel |
ubNodeIdV | - Node Identifier of CANopen device |
ulIdV | - Identifier value for Emcy |
ComStatus_tv ComEmcyEnable | ( | uint8_t | ubNetV, |
uint8_t | ubEnableV | ||
) |
Enable EMCY service.
ubNetV | - CANopen Network channel |
ubEnableV | - Enable/Disable EMCY service |
This function enables (ubEnableV = 1) or disables (ubEnableV = 0) the EMCY service. The EMCY service is enabled by default.
ComStatus_tv ComEmcyGetId | ( | uint8_t | ubNetV, |
uint32_t * | pulIdV | ||
) |
Get EMCY service identifier.
ubNetV | - CANopen Network channel |
pulIdV | - Pointer to identifier value |
This function reads the identifier value for the EMCY service.
ComStatus_tv ComEmcyGetInhibit | ( | uint8_t | ubNetV, |
uint32_t * | pulTimeV | ||
) |
Get EMCY message inhibit time.
ubNetV | - CANopen Network channel |
pulTimeV | - Pointer to EMCY inhibit time |
This function retrieves the inhibit time between two subsequent EMCY messages. The pointer pulTimeV points to a variable that holds the time value in multiples of one microsecond.
ComStatus_tv ComEmcyIsEnabled | ( | uint8_t | ubNetV, |
uint8_t * | pubEnableV | ||
) |
Check EMCY service.
ubNetV | - CANopen Network channel |
pubEnableV | - Pointer to Enable/Disable status |
This function checks if the EMCY service is enabled or disabled. The EMCY service is enabled by default.
ComStatus_tv ComEmcySend | ( | uint8_t | ubNetV, |
uint16_t | uwEmcyCodeV, | ||
uint8_t * | pubManCodeV | ||
) |
Send EMCY message.
ubNetV | - CANopen Network channel |
uwEmcyCodeV | - Emergency code |
pubManCodeV | - Pointer to manufacturer code |
This function sends an emergency message with the code uwEmcyCodeV and an optional manufacturer code of 5 bytes.
ComStatus_tv ComEmcySetId | ( | uint8_t | ubNetV, |
uint32_t | ulIdV | ||
) |
Set EMCY service identifier.
ubNetV | - CANopen Network channel |
ulIdV | - Identifier value |
This function changes the identifier value for the EMCY service.
ComStatus_tv ComEmcySetInhibit | ( | uint8_t | ubNetV, |
uint32_t | ulTimeV | ||
) |
Set EMCY message inhibit time.
ubNetV | - CANopen Network channel |
ulTimeV | - EMCY inhibit time |
This function sets the inhibit time between two subsequent EMCY messages. The parameter ulTimeV is given in multiples of 1 microsecond.