# USB HID：端点0x81停滞，需要主机复位

- **ID:** `embedded/usb-hid-endpoint-stall`
- **领域:** embedded
- **类别:** protocol_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

USB HID端点因协议违规而停滞（例如，报告大小不匹配、无效的报告ID或主机发送不支持请求）。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| USB HID v1.11 | active | — | — |
| STM32 USB Device Library v2.6.0 | active | — | — |
| TinyUSB v0.15.0 | active | — | — |

## 解决方案

1. ```
   Verify HID report descriptor matches the actual report size sent. Use a USB analyzer (e.g., Wireshark with usbmon) to capture host requests and ensure firmware responds correctly.
   ```
2. ```
   Implement a callback to clear endpoint stall on host request (e.g., ClearFeature(ENDPOINT_HALT)). In STM32 USB stack, override USBD_HID_SetupStage.
   ```

## 无效尝试

- **Re-enumerate the device by power-cycling the USB cable** — The stall condition persists because the firmware does not clear the endpoint halt condition; enumeration alone does not fix the logic error. (70% 失败率)
- **Increase USB buffer size to accommodate larger reports** — Stall is caused by protocol mismatch, not buffer overflow; larger buffers do not resolve incorrect report descriptors. (85% 失败率)
- **Disable endpoint halt in firmware unconditionally** — Forces data transfer but may cause host-side timeout or data corruption if the report format is still invalid. (60% 失败率)
