[SP32 P4] tiny_usb handler never called when device is dettached

jared_s
Posts: 9
Joined: Sat Oct 04, 2025 10:22 am

[SP32 P4] tiny_usb handler never called when device is dettached

Postby jared_s » Fri Oct 31, 2025 3:09 pm

Hi,

I configured my USB OTG port to CDC+MIDI, registered handler in:

Code: Select all

 tinyusb_config_t tusb_cfg = TINYUSB_DEFAULT_CONFIG(device_event_handler, this);
handler:

Code: Select all

void device_event_handler(tinyusb_event_t *event, void *arg)
{}
device_event_handler is called when device is attached only (when I plug USB cable from host to the OTG USB on ESP board)
but it is never called when I unplug the cable.

I tried als check the status uf the tiny_usb in loop using:

Code: Select all

bool isConnected = tud_connected() && tud_mounted();
but tud_connected() or tud_mounted() are always TRUE even the cable is unplugged.

Is this a bug or I missed something?

Thanks,

J.

Code: Select all

## IDF Component Manager Manifest File
dependencies:
  idf: ">=5.2.0"   

  # TinyUSB wrapper and core:
  espressif/esp_tinyusb: "~2.0.1"
  espressif/tinyusb: ">=0.17.0"

Who is online

Users browsing this forum: Baidu [Spider], meta-externalagent, PerplexityBot, PetalBot and 6 guests