Skip to content

ESP-IDF v5.3.3 TinyUSB can't be switched back to USB/JTAG (regression since 5.3.2) (IDFGH-15248) #15912

Closed
@johnboiles

Description

@johnboiles

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.3.3

Espressif SoC revision.

ESP32-S3 v0.1

Operating System used.

macOS

How did you build your project?

Command line with Make

If you are using Windows, please specify command line type.

None

Development Kit.

Custom Board

Power Supply used.

USB

What is the expected behavior?

Related to #9826, previously it was possible to switch out the device from being a TinyUSB peripheral and go back to the built-in USB/JTAG peripheral (e.g. for programming). You could do that with this code:

tusb_cdc_acm_deinit(TINYUSB_CDC_ACM_0);
tinyusb_driver_uninstall();
usb_phy_config_t phy_config = {.controller = USB_PHY_CTRL_SERIAL_JTAG,
                               .target = USB_PHY_TARGET_INT};
usb_phy_handle_t jtag_phy;
usb_new_phy(&phy_config, &jtag_phy);

What is the actual behavior?

This no longer works in v5.3.3 (but works in v5.3.2). I also tested v5.4.1 and master (v5.5-dev-3510-gaaebc37467) and those don't work either.

Steps to reproduce.

Build and flash my attached sample project on an ESP32-S3 device using various IDF versions. Push the GPIO0 button to switch from TinyUSB CDC mode back to USB/JTAG mode. On v5.3.2 the Espressif Device will go away and the USB JTAG/serial debug unit will show up. On v5.3.3 and above, this won't happen.

20250506_tinyusb_usb_jtag_regression_v2.zip

Debug Logs.

I (328) main_task: Calling app_main()
I (328) usb_jtag_repro: USB JTAG Reproduction Test
I (328) usb_jtag_repro: tinyusb_driver_install(&tusb_cfg)
W (338) tusb_desc: No Device descriptor provided, using default.
W (338) tusb_desc: No FullSpeed configuration descriptor provided, using default.
W (348) tusb_desc: No String descriptors provided, using default.
I (358) tusb_desc:
┌─────────────────────────────────┐
│  USB Device Descriptor Summary  │
├───────────────────┬─────────────┤
│bDeviceClass       │ 239         │
├───────────────────┼─────────────┤
│bDeviceSubClass    │ 2           │
├───────────────────┼─────────────┤
│bDeviceProtocol    │ 1           │
├───────────────────┼─────────────┤
│bMaxPacketSize0    │ 64          │
├───────────────────┼─────────────┤
│idVendor           │ 0x303a      │
├───────────────────┼─────────────┤
│idProduct          │ 0x4001      │
├───────────────────┼─────────────┤
│bcdDevice          │ 0x100       │
├───────────────────┼─────────────┤
│iManufacturer      │ 0x1         │
├───────────────────┼─────────────┤
│iProduct           │ 0x2         │
├───────────────────┼─────────────┤
│iSerialNumber      │ 0x3         │
├───────────────────┼─────────────┤
│bNumConfigurations │ 0x1         │
└───────────────────┴─────────────┘
I (528) TinyUSB: TinyUSB Driver installed
I (528) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (538) usb_jtag_repro: GPIO initialized, press button on GPIO0 to switch to JTAG mode
I (548) usb_jtag_repro: USB initialized
I (548) usb_jtag_repro: Press the button on GPIO0 to switch to JTAG mode
I (558) usb_jtag_repro: Waiting for button press...
I (5558) usb_jtag_repro: Waiting for button press...
I (8748) usb_jtag_repro: tusb_cdc_acm_deinit(TINYUSB_CDC_ACM_0)
I (8748) usb_jtag_repro: tinyusb_driver_uninstall()
I (8748) usb_jtag_repro: usb_new_phy(&phy_config, &jtag_phy)
I (8748) usb_jtag_repro: usb_new_phy succeeded```

### Diagnostic report archive.

_No response_

### More Information.

I'm testing on macOS but I doubt this is host OS specific, since the USB/JTAG device typically works consistently on every platform.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions