HCD_ERR_STALL embedded protocol_error ai_generated true

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

ID: embedded/usb-hcd-queue-stall

Also available as: JSON · Markdown · 中文
78%Fix Rate
88%Confidence
1Evidence
2023-11-20First Seen

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.

generic

中文

USB主机控制器驱动在批量或控制端点上收到了设备的STALL握手信号,但驱动未清除该停滞状态,导致传输队列挂起。

Official Documentation

https://www.usb.org/document-library/usb-20-specification

Workarounds

  1. 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).
    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. 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.
    Implement a recovery state machine in the USB class driver that detects stall events and automatically re-enqueues the transfer after clearing the halt.

中文步骤

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

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Resetting the entire USB bus without clearing the endpoint stall causes the device to re-enter the same stall state immediately.

  2. 90% fail

    Increasing the USB transfer timeout does not resolve the stall; the device will remain stalled indefinitely.