summaryrefslogtreecommitdiff
path: root/examples/device/usbtest/src/tusb_config.h
AgeCommit message (Collapse)Author
2026-07-08Pass the usbtest battery on CH569 at high and SuperSpeedhathach
Running the Linux kernel usbtest/testusb battery against the CH569 for the first time. Results: 30/30 at high speed (4 consecutive reflash cycles), 25/26 at SuperSpeed. DCD fixes found by the battery: - dcd_ch56x_usbhs: clear-halt on an armed bulk-OUT pipe reset the toggle but dropped the queued receive, NAKing forever (usbtest case 29 - the same defect previously found on rp2040/fsdev/ch32_usbhs/rusb2) - dcd_ch56x_usb30: endpoint halt is now latched; the endpoint event handler used to clear the response field on every completion, wiping a just-set STALL while the peer streamed, and clear-halt now re-arms a still-armed transfer with the fresh packet sequence (cases 13/29) usbtest example gains SuperSpeed support: tier 3 on SS builds, a 4-endpoint SS descriptor set with companions, EP0 512 config and 1024-byte receive buffers. test/hil/usbtest.py gains SuperSpeed-aware case parameters: bulk sizes and vary steps must be 1024-multiples at SS or the device's whole-packet source overruns the host request (case 4 EOVERFLOW). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019MRGjBT2NBkCoWwyDT4LaE
2026-07-06fix CI: clang/IAR unused helpers, LTO-dropped ISR symbol, LPC11/13 USB RAM ↵hathach
overflow Four PR-CI failures, each with a distinct root cause: - class/vendor: mark the shared non-buffered transfer helpers TU_ATTR_UNUSED. In buffered mode with the int/iso endpoint gates off none is referenced, and clang (-Wunused-function -Werror) and IAR (Error[Pe177]) reject an unused static — gcc does not, which is why only the clang/IAR matrix failed. - bsp/ch32v20x: keep dcd_int_handler alive under LTO. The `call` sits inside naked asm where LTO cannot see it, so -flto make builds internalized the symbol and every ch32v20x device example failed to link (cmake has no LTO, which masked it). A TU_ATTR_USED function-pointer reference pins it. - usbtest: LPC11/13 (ip3511 FS) keep endpoint buffers in a dedicated 2 KB USB RAM; the 2048 B bulk epbuf overflowed it (RamUsb2 150%) in make builds. Use 512 B (= 8 FS packets) on those parts; lpcxpresso11u37 still passes 30/30. - test/hil: skip device/usbtest on lpcxpresso43s67 (hfp rig) — its ip3511 HS port wedges from the first control case (1/30) and needs on-rig debugging. Verified: make builds link for nanoch32v203 (dfu_runtime + usbtest), lpcxpresso11u37 and lpcxpresso1347 (RamUsb2 75%); buffered-mode webusb_serial builds; 61/61 unit tests; lpcxpresso11u37 usbtest 30/30 on hardware with the smaller epbuf. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-05usbtest: support CH32V203 (fsdev + usbfs ports), both pass tier-4 30/30hathach
Neither of the CH32V203's two USB device IPs could run the usbtest tier-4 battery. usbfs (port 1): - 128 B iso doesn't fit its fixed 64 B/ep buffers -> drop iso mps to 64 on CH32 (usb_descriptors.h). - dcd_ch32_usbfs.c: clear-halt on an armed OUT endpoint forced it to NAK, so a submitted read NAK'd forever and the host timed out. Re-assert ACK when a receive is still armed (usbtest toggle test 29). fsdev (port 0, the shared stm32_fsdev driver): - The descriptor hard-coded the interrupt mps, so USBTEST_INT_EP_MPS never took effect; all six tier-4 endpoints then overflowed the 512 B PMA and SET_CONFIG timed out. Wire the interrupt mps to the macro and use 16 on the fsdev port. - The USBD raises three IRQ lines (LP/HP/WakeUp) into one non-reentrant handler and they nest (HP preempts LP) with QingKe HWSTK enabled. The mainline toolchain's plain __attribute__((interrupt)) emits a software prologue that fights the hardware context stack and corrupts the return on nesting -> wild jump / illegal-instruction crash. Emit naked handlers that rely on HWSTK for context save/restore -- the equivalent of WCH's "WCH-Interrupt-fast", which mainline riscv-none-elf-gcc ignores -- so nesting is safe. - Single-buffered iso IN can't stay fed under load; double-buffer it (CFG_TUD_FSDEV_DOUBLE_BUFFERED_ISO_EP in the example tusb_config.h). iso mps 32 x2 = 64 B/ep keeps the same PMA budget. Left single for other fsdev parts (audio's larger iso would overflow their PMA too). Verified on nanoch32v203 (CH32V203D6): Linux testusb tier-4 (30 cases across bulk/control/interrupt/isochronous) = 30/30 on both the fsdev and usbfs variant, each across 5 reflash cycles. Full CH32V20X example set builds; cdc_msc still enumerates CDC+MSC on the fsdev port (naked-handler regression check). Drop CH32V20X from the usbtest skip list. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-04feat(usbtest): add FreeRTOS/espressif supporthathach
Mirror the video_capture #if pattern: dual-mode tasks that vTaskDelay under FreeRTOS and return under OS_NONE, a usb_device_task + freertos_init (xTaskCreate blinky/usbd/app), and an ESP_PLATFORM app_main. Add the ESP-IDF src/CMakeLists.txt and CFG_TUSB_OS_INC_PATH; replace the family:espressif skip with per-MCU skips for parts that can't fit the tier-4 descriptor. Verified: esp32s3 (FS) and esp32p4 (HS) both 30/30 on the usbtest battery. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-03usbtest: FS-sized ep buffers + host runner hardeninghathach
- example: interrupt/iso endpoint buffers track the per-speed max packet size instead of a fixed 512, saving ~1.6 KB of USB DMA RAM on FS builds. - test/hil/usbtest.py: re-resolve the device node after a mid-battery re-enumeration (stale node was misreported as NOTRUN); reject an out-of-range tier (a tier-0 device would run an empty battery and read green); validate --tests case numbers; run cleanup in a try/finally so a crash can't leave the dynamic id registered to hijack the next device; guard set_pattern and the pci-reset placeholder; report a sudo-password failure on the testusb fallback instead of a misleading NOTRUN. - tinyusb-sudoer: allow the foreign-driver unbind path and the testusb fallback used by the runner. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-02example(usbtest): tier 4 - isochronous source/sink (cases 15/16/22/23)hathach
Gadget-Zero parity: alt 0 carries no endpoints, alt 1 the full set (bulk + interrupt + iso IN/OUT, iso FS 128B / HS 512B). The host usbtest driver skips pipe-less altsettings and selects alt 1 itself, so no usbtest module parameters are needed. The complete 30-case battery (all four tiers) passes on stm32f407disco, stm32f723disco, stm32h743nucleo and stm32l476disco, including the ch9 case which now exercises 256 consecutive SET_INTERFACE cycles. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-02example(usbtest): tier 3 - interrupt source/sink (cases 25/26)hathach
The host usbtest driver collects interrupt pipes from the same altsetting as the bulk pair, so the interface grows to 4 endpoints (hand-rolled descriptor: bulk IN/OUT + interrupt IN/OUT, FS 64B interval 1 / HS 512B interval 4) using the vendor class with CFG_TUD_VENDOR_EP_INT_OUT/IN. The interrupt pumps mirror the bulk ones: poll + re-arm from callbacks, self-healing across the halt tests. Full tier-3 battery (26 cases, now incl. 25/26 interrupt write/read) passes on stm32f407disco, stm32f723disco, stm32h743nucleo and stm32l476disco. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-02example(usbtest): add device-side peer for Linux usbtest/testusb (tier 1: ↵hathach
bulk source/sink) Vendor interface with bulk IN source / bulk OUT sink implementing the Gadget-Zero style protocol expected by the kernel usbtest driver. Non-buffered vendor mode keeps every transfer an exact packet multiple so the data-integrity cases never see an unexpected short packet, and polling pumps self-heal after the endpoint-halt cases. Tier (bulk-only for now) is advertised in bcdDevice for the host-side runner. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg