The EMCY service provides information about the error status of the CANopen device in respect to the communication and the application. It is mapped to a producer/consumer protocol. The producer sends the EMCY message indicating some detected “errors”.
The 20-byte message contains the same information as the EMCY message of the Classic CANopen application layer (Legacy EMCY): the one-byte error register, the two-byte emergency error code, and five bytes, which are CANopen profile-specific. Some profiles allow using the five bytes for manufacturer-specific purposes. In addition, the CANopen FD EMCY message provides the related logical device number, the related CiA specification number, the status of the detected error, and the time of the error occurrence (TIME-OF-DAY). The type of error (status) indicates, if the error is recoverable or not. Also warnings may be indicated.
The error register is a variable listed in the CANopen object dictionary. It controls the Emergency state machine. If any “error” is detected, the CANopen device triggers the EMCY service and sends the EMCY message. If further “errors” occur, the CANopen device remains in the error state. Only if all “errors” are recovered, the CANopen device transits into the error-free state. The error state behavior could be defined by CANopen profiles. In the CiA 401 profile for modular I/O devices, the outputs are set to pre-defined values, when the device is in error state.
The system designer needs to configure the EMCY message consumers depending on the application requirements. This is done by means of the emergency consumer parameter listed in the CANopen object dictionary. This array parameter contains all COB-IDs of EMCY messages, which are consumed. Remember, the COB-ID is a 32-bit value providing the CAN-ID of the data frames to be consumed as well as three control bits.
The reaction on the received EMCY messages is highly application-specific. By default the EMCY message is transmitted in a single CAN FD data frame with a high-prior CAN ID: 8016 plus node-ID. The system designer assigns uniquely the node-ID to the CANopen devices. The EMCY COB-ID parameter, which contains the CAN-ID to be used, can be configured by means of an SDO write service to the CANopen object dictionary.
|0||1||2 to 3||4||5 to 6||7 to 11||12||13||14 to 19|
Structure of the EMCY protocol: New are the logical device number, the CiA specification number, the status, and the time
|00xx16||No error or reset|
|21xx16||Current, CANopen FD device input side|
|22xx16||Current inside the CANopen FD device|
|23xx16||Current, CANopen FD device output side|
|32xx16||Voltage inside the CANopen FD device|
|42xx16||CANopen FD device temperature|
|50xx16||CANopen FD device hardware|
|60xx16||CANopen FD device software|
|FFxx16||CANopen FD device specific|
16-bit error code classes
CiA 1301 specifies some detailed communication error codes. They are related to the CAN FD data link layer protocol as well as to the CANopen FD application layer protocols. The implementation of the following error codes is recommended:
- 811016: CAN overrun (data frame lost)
- 812016: CAN protocol controller in error passive mode (node cannot indicate bus errors, when it is a receiver)
- 814016: CAN node recovered from bus-off (may have missed some CAN data frames)
- 815016: CAN-ID collision (node has detected data frames with CAN-IDs that are assigned to it)
The following CANopen FD protocol error codes are also recommended to be supported:
- 813016: Heartbeat error (one of the supervised CANopen device has not sent its Heartbeat)
- 816016: USDO source client or source server number collision (this indicates a double assignment of node-IDs)
- 821016: PDO not processed due to length error (PDO receiving CANopen device detected a mismatch of the PDO length)
- 822016: PDO length exceeded (the mapped process data is longer than 8 byte)
- 823016: DAM MPDO nor processed, destination element not available
- 824016: Unexpected SYNC message length (SYNC consumer expect another SYNC format with or without SYNC counter)
- 825016: RPDO timeout (RPDO event timer elapsed)
- 8F0116 to 8F7F16: Heartbeat event caused by node-ID 1 to node-ID 127