HIL: add a host transfer-abort test for every HCD

Open
#4,472 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
c, python

Research direction

Read the scratch branch claude/dwc2-abort-hil and its existing examples/host/device_info firmware and hil_test.py case to understand the prototype. Add a separate examples/host/abort_test example with its HIL case and roster entries, then enable it for the listed rig boards. Done means the transfer abort phases run on each configured host board and report pass or actionable driver failures.

Written by the indexing model from the issue text.

Description

follow-up Prio 📌

Follow-up from #4265.

Problem

No HIL test drives tuh_edpt_abort_xfer() on purpose. The current battery reaches the abort path only on a control
timeout, an endpoint close or SET_CONFIGURATION, so regressions like #4405 (an aborted bulk IN completes later with the
next data) and #4152 (the aborted buffer is written after the abort returns) go unnoticed.

Every HCD implements hcd_edpt_abort_xfer() with the same contract (EHCI, OHCI, rp2040 / PIO-USB, MAX3421,
STM32 FSDEV, DWC2), and none besides DWC2 has been checked against it.

Prototype

Branch claude/dwc2-abort-hil (33a794cf0, on top of a317f951c) holds a scratch version used to validate #4265. It is not
mergeable as is: it replaces examples/host/device_info and its hil_test.py case.

The firmware uses only the public host API (tuh_edpt_xfer(), tuh_edpt_abort_xfer(), tuh_bus_info_get()) and the
generic hcd_dcache_* hooks, and prints ABORT_TEST PASS or ABORT_TEST FAIL <reason>. 200 rounds per phase:

  • M1: abort a bulk IN on the attached MSC drive while it NAKs (no CBW sent), then a READ10 must return the right
    block and CSW (#4405).
  • M2: abort at a random point during a READ10; the aborted buffer must not change after the abort returns, and the
    next READ10 must return the right data (#4152).
  • S1: abort a NAKing bulk IN on the full-speed CP2102/CH9102 behind the hub, then talk to it again. Split
    transactions on a high-speed host; a plain hub-attached abort on a full-speed host.

Results with it:

Board Driver Slave DMA
espressif_p4_function_ev #4265 merged pass pass
stm32f723disco #4265 merged pass pass
stm32f723disco before the #4430 fold (d20ee752e) fail M2 (#4152) fail M1 (#4405)

Remaining work

  • Move the firmware into its own example (e.g. examples/host/abort_test), with a hil_test.py case and roster entries,
    leaving device_info untouched.
  • Enable it on every rig host board with an MSC drive attached: DWC2 (ESP32-P4, ESP32-S3, STM32F723), EHCI
    (mimxrt1064_evk), OHCI (ea4088_quickstart), rp2040 (pico, pico2, pico_w), PIO-USB (fruit_jam), MAX3421
    (metro_m4_express). Expect new failures on the non-DWC2 drivers; fix or file them per driver.
  • Later: a periodic (interrupt IN) phase for #4471, and an STM32F4 OTG_FS host run for #4462.
Dominant language
C
Stars
7.3k
Forks
1.6k
Avg merge
1d 19h
Merged PRs (30d)
67

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hathach/tinyusb

All issues in hathach/tinyusb

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.