TinyUSB MIDI: Dropped packets when reading burst MIDI data

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

TinyUSB MIDI: Dropped packets when reading burst MIDI data

Postby jared_s » Thu Nov 06, 2025 2:37 pm

I created a USB OTG MIDI device using the ESP32-P4 board and based it on an example template. I have code in place to read MIDI packets, and everything seemed to be working fine until I began testing SysEx data.

When my app (running on a Mac) sends a burst of SysEx messages (each less than 12 bytes, with 16–24 messages per burst), I’m unable to read all the packets—some messages are dropped. I can’t read more than 44 bytes of SysEx data in total.

If any data is dropped, it isn’t reported in the TinyUSB debug output. Standard MIDI data (4-byte packets without bursts) is received correctly. However, as soon as the data is sent in bursts, the system fails to handle it reliably.

I also implemented RTP-MIDI to verify my source and logic, and it works correctly. All data—SysEx and non-SysEx—is received without issue from the host.

I tried different buffer sizes (what API allows), ways to read MIDI data, fullspeed, highspeed, ... but no difference.

Is this a known bug or limitation in the current version of TinyUSB for the ESP32-P4?

Thank you.

ESP IDF 5.5.1
espressif/esp_tinyusb: "~2.0.1"
espressif/tinyusb: ">=0.17.0"

It is the same with esp_tinyusb: 1.x.x

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

Re: TinyUSB MIDI: Dropped packets when reading burst MIDI data

Postby jared_s » Mon Nov 10, 2025 4:15 pm

Hi,

I reconfigured the project to use the original TinyUSB (latest build), and everything is working fine.
I also tried creating the project again using the ESP-TinyUSB fork, but it’s still dropping data on RX when sending in bursts.

It seems to be an issue with the ESP fork, but I couldn’t pinpoint or fix it, so I’ve decided to stick with the original TinyUSB for now.

There’s one small thing: I wasn’t able to get tud_mount_cb() or tud_resume_cb() to trigger in this version of TinyUSB. These callbacks are not called when the cable is plugged into the OTG port.
tud_suspend_cb() does get called when the cable is unplugged, but neither tud_mount_cb() nor tud_resume_cb() gets called when it’s plugged back in.
That said, the app still works as expected after the cable is reconnected.

tinyUSB+ESPIDF+ESP32 P4+SysEx MIDI -> works
esp_tinyUSB (2.01)+ESPIDF+ESP32 P4+SysEx MIDI -> doesn't work

J.

Who is online

Users browsing this forum: No registered users and 1 guest