embedded
protocol_error
ai_generated
partial
UART: overrun error (ORE) detected in DMA mode, data lost
ID: embedded/uart-overrun-error-dma-mode
80%Fix Rate
82%Confidence
1Evidence
2023-11-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| STM32Cube_FW_F4 V1.27.0 | active | — | — | — |
| HAL V1.8.0 | active | — | — | — |
Root Cause
UART overrun occurred because DMA transfer rate insufficient to empty receive buffer before next byte arrives.
generic中文
UART 溢出因 DMA 传输速率不足以在下个字节到达前清空接收缓冲区而发生。
Official Documentation
https://www.st.com/resource/en/application_note/dm00110233.pdfWorkarounds
-
85% success Increase DMA buffer size and use circular mode to allow more time for processing: `HAL_UART_Receive_DMA(&huart, buffer, BUFFER_SIZE);` with BUFFER_SIZE >= 512.
Increase DMA buffer size and use circular mode to allow more time for processing: `HAL_UART_Receive_DMA(&huart, buffer, BUFFER_SIZE);` with BUFFER_SIZE >= 512.
-
90% success Enable UART hardware flow control (RTS/CTS) to throttle sender: set `huart.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS;`
Enable UART hardware flow control (RTS/CTS) to throttle sender: set `huart.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS;`
-
75% success Reduce interrupt priority of DMA and increase priority of UART global interrupt to handle ORE flag faster.
Reduce interrupt priority of DMA and increase priority of UART global interrupt to handle ORE flag faster.
中文步骤
增加 DMA 缓冲区大小并使用循环模式以提供更多处理时间:`HAL_UART_Receive_DMA(&huart, buffer, BUFFER_SIZE);` 其中 BUFFER_SIZE >= 512。
使能 UART 硬件流控制(RTS/CTS)以限制发送端:设置 `huart.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS;`
降低 DMA 的中断优先级,提高 UART 全局中断优先级以更快处理 ORE 标志。
Dead Ends
Common approaches that don't work:
-
85% fail
Increasing UART baud rate worsens overrun as data arrives faster.
-
60% fail
Disabling DMA and using interrupt mode shifts bottleneck but does not fix root cause.