Skip to content

esp32: TinyUSB 0.21 on the S2 and S3 as well (patch 0014); prepare-micropython.sh works from a worktree - #22

Merged
bdbarnett merged 2 commits into
mainfrom
s3-tinyusb-021
Sep 26, 2026
Merged

bdbarnett merged 2 commits into
mainfrom
s3-tinyusb-021

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

Closes PyDevices/usbif#48.

The ESP32-S2 and S3 now take TinyUSB 0.21 too, from the same ref the P4 got in #21: MicroPython's own v0.21.0.1-micropython1 tag. With one ref for all three, patch 0014 goes back to a single rules entry with one version, so the matches list is gone.

Why the tag is safe on the S3. espressif's 0.21.0~1 and ~2 reset the T-Embed as soon as the host opened its CDC port (usbif#48). The tag's one extra commit, the cdcd_open flush fix that went upstream as hathach/tinyusb#3808, is what stops that.

The S2 and S3 lockfile entries move too. Their TinyUSB entries now match the P4's commit. Without that, the component manager keeps the locked 0.18 commit, because the source is unchanged. The T-Embed build log shows espressif/tinyusb (5c5c660…), and the link map has usbif's tud_audio_rx_done_isr and TinyUSB's audiod_xfer_isr.

A second commit fixes prepare-micropython.sh. Run from a worktree (micropython-pydevices/.worktrees/NAME), it looked for usbif and cameraif beside the worktree and silently skipped their patches, so the overlay built the wrong firmware. It now finds the module repositories from the main checkout, and a missing one is an error. I ran it from this branch's worktree on a fresh clone and all six module patches applied. I also ran a copy with no module repos beside it, and it stopped with exit 1 and named the missing script.

Tested on the LILYGO T-Embed (ESP32-S3, full speed)

The image was built from the shared checkout (48d1e3e32) with only this patch's two S3 changes on top, plus usbif main (c37ce17).

  • The CDC port opens with DTR raised, and the REPL answers.
  • Sound card at 48 kHz shared over Windows WASAPI, with a quiet 440 Hz tone and 10 s windows. The host sends 1,000 packets/s.
load delivered
busy (interpreter allocating in a loop) 99.96 to 100.01 %, 8 of 8 full windows (80 s)
idle 99.84 to 100.00 %, 8 of 8 full windows (80 s)
for comparison, the 0.18 pin, busy 87.4 to 93.9 %

Each run's first window includes stream start and is left out.

The P4 wasn't re-tested here. Its ref, lockfile entry and the result of this patch for it are all unchanged from #21. Not tested: the ESP32-S2.

The S2/S3 leave the 0.18 cherry-pick for v0.21.0.1-micropython1, the ref
the P4 already takes, so the dependency goes back to one ref under one
rule. The S2 and S3 lockfile entries move with it; otherwise the
component manager keeps the locked 0.18 commit, since the source is
unchanged. The tag carries hathach/tinyusb#3808, whose absence reset an
ESP32-S3 when the host opened the CDC port (usbif#48).
Run from micropython-pydevices/.worktrees/NAME, the script looked for
usbif and cameraif beside the worktree, found neither, and skipped their
patches without a word, so the overlay commit built the wrong firmware.
The siblings are now found from the main checkout (git's common dir),
and a missing module script is an error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

ESP32-S3: espressif/tinyusb 0.21.0~2 resets the chip when the host opens the CDC port; MicroPython's own 0.21 tag doesn't

1 participant