audit 0.21.0: rp2040 DCD/HCD follow-ups
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 8/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- c
- Domain
- embedded-iot
Research direction
These are four deferrable hardware-dependent defects in the RP2 DCD layer, each with cited lines: start with rp2040_usb.c:258,268,407 for the saved short/ZLP packet case, then dcd_rp2040.c:144,600,723 and rp2040_usb.c:92 for cached future bytes on cancel/stall, rp2040_usb.c:404 with dcd_rp2040.c:214 for the re-armed bulk OUT callback ordering, and dcd_rp2040.c:75,302 for reopen state retention. The adjudication notes list open spec questions (EP_ABORT_DONE quiescence, RP2350 short-packet-stop, MAIN_CTRL reads) that must be settled before any patch, and reproductions require RP2040/RP2350 boards. Done means a chosen storage/lifecycle design plus bench reproduction of consecutive short OUT transfers and ZLPs on both variants.
Written by the indexing model from the issue text.
Description
Deferred defects found in the repository audit of 0.21.0..ad7c83db8 (batch port-rp2). Each was validated against the source at ad7c83db8 and judged real but too large, or too hardware-dependent, for the audit PR's contained fixes.
1. A saved short packet smaller than the next receive is copied without completing that receive; a saved ZLP cannot be represented by future_len > 0. This differs from the normal completion path’s short-packet termination.
- Where:
rp2040_usb.c:258,268,407 - Verdict: valid; introduced: Older; severity: medium
- Hardware/spec dependence: Short/ZLP termination verified, D3; physical future-buffer reachability and RP2350 short-stop configuration need further checking
- Overlap: None found
- Remaining work and verification: Preserve packet presence separately from length and terminate on saved short/ZLP. Reproduce consecutive short OUT transfers and ZLPs on both RP2 variants before choosing storage changes.
2. Cancellation/stall paths preserve cached future bytes. A concrete MSC route is cached OUT data, a write callback failure causing OUT stall, then BOT reset and clear-halt: prepare_cbw() can consume those cached bytes. However, an ordinary ACTIVE transfer normally has no future data, and normal completion must preserve it.
- Where:
dcd_rp2040.c:144,600,723;rp2040_usb.c:92 - Verdict: valid, with narrower trigger; introduced: Older retention behavior; new abort API inherits it; severity: medium
- Hardware/spec dependence: Software replay path established; BOT flush requirements and hardware capture still pending
- Overlap: #3962 is related, not full coverage
- Remaining work and verification: Define reset/stall invalidation separately from normal
rp2usb_reset_transfer(); clearing future data in every reset would break ordinary handoff.
3. A second completion can remain pending when the first completion invokes an application class’s xfer_isr. If that callback re-arms a bulk OUT receive, the remaining status can be applied to freshly armed buffers. Current built-in bulk classes defer callbacks; the supported application-driver hook supplies the concrete synchronous route.
- Where:
rp2040_usb.c:404;dcd_rp2040.c:214 - Verdict: valid, conditional; introduced: Older; same callback-before-drain order at base; severity: medium
- Hardware/spec dependence: D2 verifies double-status reassertion; abort/status-reset sequencing remains pending
- Overlap: None found; #4476 concerns queued task events, a different mechanism
- Remaining work and verification: Add a custom bulk
xfer_isrreproducer; retire old status before allowing callback re-arm, with B0/B1 and RP2350 behavior checked.
4. Reopen resets buffer control but leaves ACTIVE/PENDING software state and pointers. E15 SOF can use that old state; cached future data also survives reopen. DPRAM capacity reuse does not create the lifecycle mismatch.
- Where:
dcd_rp2040.c:75,302 - Verdict: valid; introduced: Older; base also preserved transfer state; severity: medium
- Hardware/spec dependence: Software retention established; precise E15 wire consequence needs validation
- Overlap: #4428 covers video reopen lifecycle; future-OUT variant overlaps C-F6 and is not explicitly covered
- Remaining work and verification: Fix endpoint/class cancellation together; merely resetting DCD fields can leave usbd BUSY/CLAIMED and application ownership stranded.
Adjudication notes: port-rp2
No claim records were supplied. These are the limited inline read-doc records established during this pass; page numbers are physical PDF pages:
- D1 — verified: double-buffer allocation premise. Calibre 2125, RP2040 Datasheet, February 2025, §4.1.2.7.3–4, pp389–390; 2124, RP2350 Datasheet, July 2025, §12.7.3.7.3–4, pp1150–1151. Both describe two 64-byte buffers. Combined with the allocator and CPU copy, this establishes S-F01/C-F1. Lookups
42ecede7c555,34b255fe739c. - D2 — verified, limited: BUFF_STATUS can reassert after clearing when two buffers completed. Same books, Table 406 p405 and Table 1204 p1167, visually checked. This supports the stale-status premise, not every proposed abort/drain ordering. Lookups
92a2cf58e167,182532389361. - D3 — verified, limited: USB 2.0 DATA0 reset and short/ZLP termination. Calibre 775, USB Specification 2.0, §9.4.5 p284 and §5.8.3 p81. These do not establish stream-style overflow retention or a universal clear-halt cancellation policy. Lookups
f011c846b3f8,857c96254976. - D4 — verified: RP2040-E2 prohibits EP_ABORT on B0/B1 and is fixed in B2; RP2350 documents the fix. Book 2125, Appendix B, pp631–632; book 2124, §12.7.2.1 p1144. The checked SDK’s RP2350 compatibility function returns
2, refuting a revision-gating mismatch. Lookupsa148956b508f,eead83638517,2930a1db38d5. E15 and RP2350-E12 were also consulted; neither establishes the proposed timing bounds.
Claims still needing read-doc completion:
- S-F03/F05/F07, C-F7/F8: Precisely when do EP_ABORT_DONE and STOP_TRANS guarantee quiescence, what status survives buffer-control clearing, and when is a bounded discard safe on each affected revision?
- S-F06: Does AVAILABLE alone determine the correct next PID after every host interrupt completion/error, in both directions and at low speed?
- C-F4/F6, S-F04: What are the required device receive-overflow and BOT Reset Recovery buffer-discard semantics? Which cached bytes must survive a non-stalled clear-halt?
- C-F5/F7: How does RP2350’s short-packet-stop configuration affect the second-buffer trigger in this driver?
- S-F08/F09 and timing notes: Complete the E15-sensitive sequencing review. Maximum masked duration and XIP effects additionally require measurement.
- S-F10: Confirm MAIN_CTRL read semantics before treating removal of its volatile reads as hardware-neutral.
No builds, unit tests, hardware reproductions or proposed changes were executed. Existing PR coverage was checked from live descriptions and relevant diffs; their reported bench results were not independently reproduced. The earlier review B blanket “no introduced actionable defect” conclusion is not sustained by N1–N3.
Files touched: none.
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hathach/tinyusb
-
follow-up Port WCH USBFS Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
follow-up Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
hil-contract: a background hil_remote.py launch is killed at the Bash default 10 min timeoutPossibly taken @hathach claimed this 16 days ago. Openfollow-up Prio 📌
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
ch32v30x: debug UART loses queued bytes when its TX ring fillsPossibly taken @hathach claimed this 16 days ago. Openfollow-up Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
followup Prio 📌
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
-
Missing slice offset check in jvp_equal fast path corrupts slice comparison and aborts delpathsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
area9innovation/flow9#1805 ·
Maintainers usually reply within 3 days
-
AI:Robustness triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
open5gs/open5gs#5246 · 1 comment ·
Maintainers usually reply within 1 day