CDC_OVF_ERR embedded resource_error ai_generated true

USB CDC: ACM数据缓冲区溢出,端点0x81上丢弃64字节

USB CDC: ACM data buffer overflow, 64 bytes discarded on endpoint 0x81

ID: embedded/usb-cdc-acm-buffer-overflow

其他格式: JSON · Markdown 中文 · English
82%修复率
88%置信度
1证据数
2023-11-20首次发现

版本兼容性

版本状态引入弃用备注
STM32Cube_FW_F4 v1.27.0 active
TinyUSB v0.15.0 active
USB CDC Class v1.2.0 active

根因分析

USB CDC接收缓冲区已满,因为应用程序未能足够快地从虚拟COM端口读取数据,导致溢出。

English

The USB CDC receive buffer is full because the application does not read data fast enough from the virtual COM port, causing overflow.

generic

官方文档

https://www.st.com/resource/en/application_note/an4879-usb-hardware-and-pcb-guidelines-using-stm32-mcus-stmicroelectronics.pdf

解决方案

  1. 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.
  2. Increase the polling rate of the CDC receive function in the main loop, e.g., call CDC_Receive_FS() every 1ms instead of 10ms.

无效尝试

常见但无效的做法:

  1. Increase the USB buffer size in the CDC configuration 85% 失败

    Larger buffers only delay the overflow but do not fix the root cause of slow data consumption; eventually overflow still occurs.

  2. Reduce the baud rate of the virtual COM port to slow transmission 95% 失败

    Baud rate is irrelevant for USB CDC; data is packet-based and the host can still send at full speed.