CAN_STUFF_ERR embedded protocol_error ai_generated true

CAN: Bit stuffing error detected at bit position 47, frame ID 0x123

ID: embedded/can-bus-bit-stuffing-error

Also available as: JSON · Markdown · 中文
78%Fix Rate
86%Confidence
1Evidence
2024-04-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
STM32Cube_FW_F1 v1.8.0 active
CANopenNode v4.0.0 active
MCP2515 v1.0.0 active

Root Cause

The CAN bus frame contained more than five consecutive bits of the same polarity, violating the bit stuffing rule, likely due to baud rate mismatch or electrical noise.

generic

中文

CAN总线帧包含超过五个连续相同极性的位,违反了位填充规则,可能是由于波特率不匹配或电气噪声。

Official Documentation

https://www.can-cia.org/can-knowledge/can/can-fd/

Workarounds

  1. 85% success Verify CAN bus baud rate using an oscilloscope to measure bit time, then configure all nodes to the same rate (e.g., 500 kbps with sample point at 87.5%).
    Verify CAN bus baud rate using an oscilloscope to measure bit time, then configure all nodes to the same rate (e.g., 500 kbps with sample point at 87.5%).
  2. 75% success Add a CAN bus error counter check and reset the CAN controller if error count exceeds 96, using HAL_CAN_ResetError() and reinitialization.
    Add a CAN bus error counter check and reset the CAN controller if error count exceeds 96, using HAL_CAN_ResetError() and reinitialization.

中文步骤

  1. Verify CAN bus baud rate using an oscilloscope to measure bit time, then configure all nodes to the same rate (e.g., 500 kbps with sample point at 87.5%).
  2. Add a CAN bus error counter check and reset the CAN controller if error count exceeds 96, using HAL_CAN_ResetError() and reinitialization.

Dead Ends

Common approaches that don't work:

  1. Increase the CAN bus termination resistor value to 150 ohms 90% fail

    Termination resistors should be 120 ohms for standard CAN; changing the value can cause signal reflections and worsen bit errors.

  2. Reduce the CAN baud rate arbitrarily without checking the bus configuration 85% fail

    Reducing baud rate may not match other nodes on the bus, causing synchronization errors and more stuffing violations.