# USB: HCD queue stall on endpoint 0x81, transfer not progressing

- **ID:** `embedded/usb-hcd-queue-stall`
- **Domain:** embedded
- **Category:** protocol_error
- **Error Code:** `HCD_ERR_STALL`
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

USB host controller driver (HCD) encountered a STALL handshake from the device on a bulk or control endpoint, and the driver did not clear the stall condition, causing the transfer queue to hang.

## Workarounds

1. **Send a CLEAR_FEATURE control request to the stalled endpoint. Example using STM32 HAL: HCD_EP_ClrStall(&hhcd, ep_addr); where ep_addr is the endpoint address (e.g., 0x81).** (85% success)
   ```
   Send a CLEAR_FEATURE control request to the stalled endpoint. Example using STM32 HAL: HCD_EP_ClrStall(&hhcd, ep_addr); where ep_addr is the endpoint address (e.g., 0x81).
   ```
2. **Implement a recovery state machine in the USB class driver that detects stall events and automatically re-enqueues the transfer after clearing the halt.** (80% success)
   ```
   Implement a recovery state machine in the USB class driver that detects stall events and automatically re-enqueues the transfer after clearing the halt.
   ```

## Dead Ends

- **** — Resetting the entire USB bus without clearing the endpoint stall causes the device to re-enter the same stall state immediately. (70% fail)
- **** — Increasing the USB transfer timeout does not resolve the stall; the device will remain stalled indefinitely. (90% fail)
