ports/espressif/supervisor/usb.c: workaround ESP32-S3 USB PHY setup JTAG vs OTG by dhalbert · Pull Request #9973 · adafruit/circuitpython · GitHub
Skip to content

ports/espressif/supervisor/usb.c: workaround ESP32-S3 USB PHY setup JTAG vs OTG#9973

Merged
dhalbert merged 1 commit into
adafruit:mainfrom
dhalbert:esp32-s3-usb-temp-fix
Jan 17, 2025
Merged

ports/espressif/supervisor/usb.c: workaround ESP32-S3 USB PHY setup JTAG vs OTG#9973
dhalbert merged 1 commit into
adafruit:mainfrom
dhalbert:esp32-s3-usb-temp-fix

Conversation

@dhalbert

Copy link
Copy Markdown
Collaborator

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.

@dhalbert dhalbert requested review from jepler and tannewt January 17, 2025 17:35

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dhalbert

Copy link
Copy Markdown
Collaborator Author

@dhalbert dhalbert merged commit b7af46b into adafruit:main Jan 17, 2025
@dhalbert dhalbert deleted the esp32-s3-usb-temp-fix branch January 17, 2025 18:21
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9.2.2: USB problems when using TinyUSB dwc2 support

2 participants