CDC_OVF_ERR
embedded
resource_error
ai_generated
true
USB CDC: ACM data buffer overflow, 64 bytes discarded on endpoint 0x81
ID: embedded/usb-cdc-acm-buffer-overflow
82%Fix Rate
88%Confidence
1Evidence
2023-11-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| STM32Cube_FW_F4 v1.27.0 | active | — | — | — |
| TinyUSB v0.15.0 | active | — | — | — |
| USB CDC Class v1.2.0 | active | — | — | — |
Root Cause
The USB CDC receive buffer is full because the application does not read data fast enough from the virtual COM port, causing overflow.
generic中文
USB CDC接收缓冲区已满,因为应用程序未能足够快地从虚拟COM端口读取数据,导致溢出。
Official Documentation
https://www.st.com/resource/en/application_note/an4879-usb-hardware-and-pcb-guidelines-using-stm32-mcus-stmicroelectronics.pdfWorkarounds
-
85% success Implement a circular buffer in the application to store incoming USB data and process it in a lower-priority task, ensuring the CDC receive interrupt never blocks.
Implement a circular buffer in the application to store incoming USB data and process it in a lower-priority task, ensuring the CDC receive interrupt never blocks.
-
78% success Increase the polling rate of the CDC receive function in the main loop, e.g., call CDC_Receive_FS() every 1ms instead of 10ms.
Increase the polling rate of the CDC receive function in the main loop, e.g., call CDC_Receive_FS() every 1ms instead of 10ms.
中文步骤
Implement a circular buffer in the application to store incoming USB data and process it in a lower-priority task, ensuring the CDC receive interrupt never blocks.
Increase the polling rate of the CDC receive function in the main loop, e.g., call CDC_Receive_FS() every 1ms instead of 10ms.
Dead Ends
Common approaches that don't work:
-
Increase the USB buffer size in the CDC configuration
85% fail
Larger buffers only delay the overflow but do not fix the root cause of slow data consumption; eventually overflow still occurs.
-
Reduce the baud rate of the virtual COM port to slow transmission
95% fail
Baud rate is irrelevant for USB CDC; data is packet-based and the host can still send at full speed.