CAN_FLAG_FOV embedded runtime_error ai_generated true

CAN error: FIFO overrun on mailbox 2, message lost

ID: embedded/can-fifo-overrun-error

Also available as: JSON · Markdown · 中文
85%Fix Rate
88%Confidence
1Evidence
2023-11-02First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
STM32CubeFW_F4 v1.27.0 active — — —
HAL_CAN v2.0.2 active — — —
CANopen stack v4.0.1 active — — —

Root Cause

CAN receive FIFO overflowed because the CPU did not read messages fast enough, causing loss of incoming frames.

generic

中文

CAN接收FIFO溢出,因为CPU读取消息速度不够快,导致传入帧丢失。

Official Documentation

https://www.st.com/resource/en/reference_manual/dm00031020.pdf

Workarounds

  1. 80% success Increase the CAN receive FIFO depth in configuration: hcan.Instance->FMR |= CAN_FMR_FINIT; hcan.Instance->FS1R |= CAN_FS1R_FSC1;
    Increase the CAN receive FIFO depth in configuration: hcan.Instance->FMR |= CAN_FMR_FINIT; hcan.Instance->FS1R |= CAN_FS1R_FSC1;
  2. 90% success Implement DMA-based CAN message reading to offload CPU: HAL_CAN_Start_DMA(&hcan, CAN_RX_FIFO0);
    Implement DMA-based CAN message reading to offload CPU: HAL_CAN_Start_DMA(&hcan, CAN_RX_FIFO0);

中文步骤

  1. Increase the CAN receive FIFO depth in configuration: hcan.Instance->FMR |= CAN_FMR_FINIT; hcan.Instance->FS1R |= CAN_FS1R_FSC1;
  2. Implement DMA-based CAN message reading to offload CPU: HAL_CAN_Start_DMA(&hcan, CAN_RX_FIFO0);

Dead Ends

Common approaches that don't work:

  1. 80% fail

    Faster baud rate increases message frequency, worsening the overflow issue.

  2. 60% fail

    Filtering reduces noise but does not address the root cause of slow message processing.