Hi,
I’m encountering an issue with TinyUSB and the ESP32-P4. My application configures the ESP32-P4 board’s USB1 OTG port as a MIDI interface. I based it on the tusb_midi example from Espressif’s GitHub repository. My goal is to receive MIDI packets only.
The app works well for standard messages—I’m able to read notes, CCs, and other standard data sent to the board. However, it fails to reliably receive SysEx data when sent in bursts. By “burst,” I mean SysEx messages with lengths of around 15–20 bytes, with 16–20 such messages sent consecutively. I’m using a DAW application to send this data, so it’s a real-world stream rather than synthetic MIDI.
Even though the total data load is relatively small (~320–400 bytes), many packets are missing when I inspect what’s received. I’ve tried various ways of buffering the incoming data (TinyUSB is set to DMA mode), but nothing has improved the situation—data loss still occurs randomly.
TinyUSB debug logs do not report any drops, and I’ve verified that the data is indeed being sent to the board (I’m monitoring it with another device). I’m not experienced enough to debug below the TinyUSB level, but I’ve explored everything I could think of. It seems like it could be a buffering issue within esp-tinyusb, but I haven’t found any setting to increase the input buffer size.
For example, if the buffer is set to 64 bytes, standard 3-byte MIDI messages are handled fine. But when a burst of SysEx messages comes in, I suspect it overflows and causes packet loss.
Has anyone used the ESP32-P4 in OTG mode for a similar application? Do you have any suggestions for further testing, or ideas on what else I could try?
Board: Waveshare ESP32-P4 ETH POE
Compiled against: espressif/esp_tinyusb: "~2.0.1", idf: "^5.0"
Thanks in advance,
J.
[SP32 P4] esp-tinyusb MIDI OTG SysEx burst
Re: [SP32 P4] esp-tinyusb MIDI OTG SysEx burst
Hi,
To verify whether the MIDI SysEx data sent to the board is correct, I implemented rtpMIDI/AppleMIDI and can now receive the same data over Ethernet on the ESP32 P4 board. I can confirm that the Ethernet path is working correctly—I receive all SysEx data (in bursts) sent from the DAW application, so the issue definitely lies within the esp-tinyusb code.
I’ve tried all possible settings that might fix it, but with no success—I’m still unable to receive more than ~45 bytes of MIDI data.
Any ideas? I didn’t think such a simple task could end up taking more than a couple of hours to finish…
Thank you.
JS
To verify whether the MIDI SysEx data sent to the board is correct, I implemented rtpMIDI/AppleMIDI and can now receive the same data over Ethernet on the ESP32 P4 board. I can confirm that the Ethernet path is working correctly—I receive all SysEx data (in bursts) sent from the DAW application, so the issue definitely lies within the esp-tinyusb code.
I’ve tried all possible settings that might fix it, but with no success—I’m still unable to receive more than ~45 bytes of MIDI data.
Any ideas? I didn’t think such a simple task could end up taking more than a couple of hours to finish…
Thank you.
JS
Who is online
Users browsing this forum: Baidu [Spider], PerplexityBot and 9 guests