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

- **ID:** `embedded/usb-cdc-acm-buffer-overflow`
- **Domain:** embedded
- **Category:** resource_error
- **Error Code:** `CDC_OVF_ERR`
- **Verification:** ai_generated
- **Fix Rate:** 82%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| STM32Cube_FW_F4 v1.27.0 | active | — | — |
| TinyUSB v0.15.0 | active | — | — |
| USB CDC Class v1.2.0 | active | — | — |

## Workarounds

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.** (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.
   ```
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.** (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.
   ```

## Dead Ends

- **Increase the USB buffer size in the CDC configuration** — Larger buffers only delay the overflow but do not fix the root cause of slow data consumption; eventually overflow still occurs. (85% fail)
- **Reduce the baud rate of the virtual COM port to slow transmission** — Baud rate is irrelevant for USB CDC; data is packet-based and the host can still send at full speed. (95% fail)
