{{ message }}
ports/espressif/supervisor/usb.c: workaround ESP32-S3 USB PHY setup JTAG vs OTG#9973
Merged
Merged
Conversation
Collaborator
Author
bwhitman
added a commit
to shorepine/tulipcc
that referenced
this pull request
Jun 18, 2026
…to OTG PHY Root cause (TinyUSB hathach/tinyusb#2943, diagnosed by hathach; fix merged as adafruit/circuitpython#9973): on the ESP32-S3 the USB D+/D- pins power up muxed to the ROM USB-Serial-JTAG controller, and the app must switch the mux to the USB-OTG (TinyUSB) PHY. As of ESP-IDF >= 5.2 (we build on 5.4.1) usb_new_phy() no longer flips that mux reliably / early enough, so the host enumerates the JTAG device (303a:1001 "USB JTAG/serial debug unit") and keeps it -- our TinyUSB CDC+MIDI device (caf0:4009) never appears. Worst on Windows / direct-connect; a powered hub masks it by changing reset timing. That also explains why the earlier experiment in this PR did nothing: it was never a power problem, so bumping bMaxPower and disabling the brown-out detector couldn't help (community testers steppan_5g, trill_e, wabsta, tbullas all confirmed no change). This commit drops that experiment. Fix: on the S3, bypass usb_new_phy() and route the DP/DM pads to the internal OTG PHY by hand (USB_WRAP.otg_conf + RTCCNTL.usb_conf, max GPIO drive), matching the merged CircuitPython workaround. usb_usj_mode() (bootloader entry) is made NULL-safe because usb_init() no longer creates a phy handle on the S3. tulip/esp32s3/usb.c is shared, so this also affects the Tulip esp32s3 (TULIP4_R11) build; the change is guarded to ESP32-S3 and matches upstream. Refs #952, #980. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

See hathach/tinyusb#2943 for diagnosis and fix. Thanks @hathach for diagnosis and temporary fix, pending a probable fix in ESP-IDF.
This code is enabled only for ESP32-S3.
Tested on my own system, which manifested the bug before and now does not, with this fix.