硬汉嵌入式论坛

 找回密码
 立即注册
查看: 369|回复: 1
收起左侧

[CAN/FDCAN] CANopen紧急报文的错误位信息

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107003
QQ
发表于 2023-10-4 15:39:05 | 显示全部楼层 |阅读模式


下面这些是CANopenNode的整理:

[C] 纯文本查看 复制代码
/**
 * Error status bits
 *
 * Bits for internal indication of the error condition. Each error condition is
 * specified by unique index from 0x00 up to 0xFF.
 *
 * If specific error occurs in the stack or in the application, CO_errorReport()
 * sets specific bit in the _errorStatusBit_ variable from @ref CO_EM_t. If bit
 * was already set, function returns without any action. Otherwise it prepares
 * emergency message.
 *
 * Maximum size (in bits) of the _errorStatusBit_ variable is specified by
 * @ref CO_CONFIG_EM_ERR_STATUS_BITS_COUNT (set to 10*8 bits by default). Stack
 * uses first 6 bytes. Additional 4 bytes are pre-defined for manufacturer
 * or device specific error indications, by default.
 */
typedef enum {
    /** 0x00, Error Reset or No Error */
    CO_EM_NO_ERROR                  = 0x00U,
    /** 0x01, communication, info, CAN bus warning limit reached */
    CO_EM_CAN_BUS_WARNING           = 0x01U,
    /** 0x02, communication, info, Wrong data length of the received CAN
     * message */
    CO_EM_RXMSG_WRONG_LENGTH        = 0x02U,
    /** 0x03, communication, info, Previous received CAN message wasn't
     * processed yet */
    CO_EM_RXMSG_OVERFLOW            = 0x03U,
    /** 0x04, communication, info, Wrong data length of received PDO */
    CO_EM_RPDO_WRONG_LENGTH         = 0x04U,
    /** 0x05, communication, info, Previous received PDO wasn't processed yet */
    CO_EM_RPDO_OVERFLOW             = 0x05U,
    /** 0x06, communication, info, CAN receive bus is passive */
    CO_EM_CAN_RX_BUS_PASSIVE        = 0x06U,
    /** 0x07, communication, info, CAN transmit bus is passive */
    CO_EM_CAN_TX_BUS_PASSIVE        = 0x07U,
    /** 0x08, communication, info, Wrong NMT command received */
    CO_EM_NMT_WRONG_COMMAND         = 0x08U,
    /** 0x09, communication, info, TIME message timeout */
    CO_EM_TIME_TIMEOUT              = 0x09U,
    /** 0x0A, communication, info, (unused) */
    CO_EM_0A_unused                 = 0x0AU,
    /** 0x0B, communication, info, (unused) */
    CO_EM_0B_unused                 = 0x0BU,
    /** 0x0C, communication, info, (unused) */
    CO_EM_0C_unused                 = 0x0CU,
    /** 0x0D, communication, info, (unused) */
    CO_EM_0D_unused                 = 0x0DU,
    /** 0x0E, communication, info, (unused) */
    CO_EM_0E_unused                 = 0x0EU,
    /** 0x0F, communication, info, (unused) */
    CO_EM_0F_unused                 = 0x0FU,

    /** 0x10, communication, critical, (unused) */
    CO_EM_10_unused                 = 0x10U,
    /** 0x11, communication, critical, (unused) */
    CO_EM_11_unused                 = 0x11U,
    /** 0x12, communication, critical, CAN transmit bus is off */
    CO_EM_CAN_TX_BUS_OFF            = 0x12U,
    /** 0x13, communication, critical, CAN module receive buffer has
     * overflowed */
    CO_EM_CAN_RXB_OVERFLOW          = 0x13U,
    /** 0x14, communication, critical, CAN transmit buffer has overflowed */
    CO_EM_CAN_TX_OVERFLOW           = 0x14U,
    /** 0x15, communication, critical, TPDO is outside SYNC window */
    CO_EM_TPDO_OUTSIDE_WINDOW       = 0x15U,
    /** 0x16, communication, critical, (unused) */
    CO_EM_16_unused                 = 0x16U,
    /** 0x17, communication, critical, RPDO message timeout */
    CO_EM_RPDO_TIME_OUT             = 0x17U,
    /** 0x18, communication, critical, SYNC message timeout */
    CO_EM_SYNC_TIME_OUT             = 0x18U,
    /** 0x19, communication, critical, Unexpected SYNC data length */
    CO_EM_SYNC_LENGTH               = 0x19U,
    /** 0x1A, communication, critical, Error with PDO mapping */
    CO_EM_PDO_WRONG_MAPPING         = 0x1AU,
    /** 0x1B, communication, critical, Heartbeat consumer timeout */
    CO_EM_HEARTBEAT_CONSUMER        = 0x1BU,
    /** 0x1C, communication, critical, Heartbeat consumer detected remote node
     * reset */
    CO_EM_HB_CONSUMER_REMOTE_RESET  = 0x1CU,
    /** 0x1D, communication, critical, (unused) */
    CO_EM_1D_unused                 = 0x1DU,
    /** 0x1E, communication, critical, (unused) */
    CO_EM_1E_unused                 = 0x1EU,
    /** 0x1F, communication, critical, (unused) */
    CO_EM_1F_unused                 = 0x1FU,

    /** 0x20, generic, info, Emergency buffer is full, Emergency message wasn't
     * sent */
    CO_EM_EMERGENCY_BUFFER_FULL     = 0x20U,
    /** 0x21, generic, info, (unused) */
    CO_EM_21_unused                 = 0x21U,
    /** 0x22, generic, info, Microcontroller has just started */
    CO_EM_MICROCONTROLLER_RESET     = 0x22U,
    /** 0x23, generic, info, (unused) */
    CO_EM_23_unused                 = 0x23U,
    /** 0x24, generic, info, (unused) */
    CO_EM_24_unused                 = 0x24U,
    /** 0x25, generic, info, (unused) */
    CO_EM_25_unused                 = 0x25U,
    /** 0x26, generic, info, (unused) */
    CO_EM_26_unused                 = 0x26U,
    /** 0x27, generic, info, Automatic store to non-volatile memory failed */
    CO_EM_NON_VOLATILE_AUTO_SAVE    = 0x27U,

    /** 0x28, generic, critical, Wrong parameters to CO_errorReport() function*/
    CO_EM_WRONG_ERROR_REPORT        = 0x28U,
    /** 0x29, generic, critical, Timer task has overflowed */
    CO_EM_ISR_TIMER_OVERFLOW        = 0x29U,
    /** 0x2A, generic, critical, Unable to allocate memory for objects */
    CO_EM_MEMORY_ALLOCATION_ERROR   = 0x2AU,
    /** 0x2B, generic, critical, Generic error, test usage */
    CO_EM_GENERIC_ERROR             = 0x2BU,
    /** 0x2C, generic, critical, Software error */
    CO_EM_GENERIC_SOFTWARE_ERROR    = 0x2CU,
    /** 0x2D, generic, critical, Object dictionary does not match the software*/
    CO_EM_INCONSISTENT_OBJECT_DICT  = 0x2DU,
    /** 0x2E, generic, critical, Error in calculation of device parameters */
    CO_EM_CALCULATION_OF_PARAMETERS = 0x2EU,
    /** 0x2F, generic, critical, Error with access to non volatile device memory
     */
    CO_EM_NON_VOLATILE_MEMORY       = 0x2FU,

    /** 0x30+, manufacturer, info or critical, Error status buts, free to use by
     * manufacturer. By default bits 0x30..0x3F are set as informational and
     * bits 0x40..0x4F are set as critical. Manufacturer critical bits sets the
     * error register, as specified by @ref CO_CONFIG_ERR_CONDITION_MANUFACTURER
     */
    CO_EM_MANUFACTURER_START        = 0x30U,
    /** (@ref CO_CONFIG_EM_ERR_STATUS_BITS_COUNT - 1), largest value of the
     * Error status bit. */
    CO_EM_MANUFACTURER_END          = CO_CONFIG_EM_ERR_STATUS_BITS_COUNT - 1
} CO_EM_errorStatusBits_t;

回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107003
QQ
 楼主| 发表于 2023-10-4 16:40:22 | 显示全部楼层
2023-10-04

完成紧急报文的常用错误消息识别


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-14 08:54 , Processed in 0.209244 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表