Skip to content

feat: ESP32-S3 & RP2040/RP2350 examples + TinyUSB >= 0.16 compat fixes#11

Open
sauloverissimo wants to merge 7 commits intomidi2-dev:mainfrom
sauloverissimo:esp32-s3/fixes-and-example
Open

feat: ESP32-S3 & RP2040/RP2350 examples + TinyUSB >= 0.16 compat fixes#11
sauloverissimo wants to merge 7 commits intomidi2-dev:mainfrom
sauloverissimo:esp32-s3/fixes-and-example

Conversation

@sauloverissimo
Copy link
Copy Markdown

Hi @AmeNote-Michael & team,

Here's the PR I mentioned in #6. It brings ESP32-S3 and RP2040/RP2350 support to tusb_ump, with working examples and compatibility fixes for TinyUSB >= 0.16.

What's included:

TinyUSB >= 0.16 compatibility fixes - usbd_edpt_xfer() now requires a 5th parameter (is_isr), and tu_fifo_config() dropped the item_size argument in upstream TinyUSB. Version-guarded macros keep backward and forward compatibility without breaking anything. This also includes the #include "tusb.h" fix from PR #10 (@fdetro) and the MIDI_ to MIDI_1_ rename from PR #9 (@TrevorCash), both of which were needed to compile. Full credit to them. If you'd rather merge theirs first and have me rebase on top, I think that's valid and I respect whatever you decide.

ESP32-S3 example (T-Display-S3) for both Arduino IDE and PlatformIO. USB MIDI 2.0 device with Alt Setting 0/1 negotiation, UMP Endpoint Discovery, real-time display showing alt setting and UMP packets. One interesting challenge was --gc-sections in the linker silently discarding USB descriptor callbacks. Solved with __attribute__((used)) on the callbacks and build_unflags = --gc-sections in PlatformIO.

RP2040/RP2350 examples (T-PicoC3, Pico, Pico 2) for PlatformIO, using arduino-pico. The RP2040 runs upstream TinyUSB natively, no ESP-IDF fork quirks.

Arduino/PlatformIO metadata - library.json, library.properties, keywords.txt for Library Manager installation.

What the examples demonstrate (compliance-wise):

  • Alt Setting 0 (MIDI 1.0) and Alt Setting 1 (MIDI 2.0/UMP) with automatic negotiation
  • UMP Endpoint Discovery (MT=0xF Stream messages)
  • Group Terminal Block descriptors
  • MIDI 1.0 to UMP translation (when host selects Alt Setting 0)
  • Tested against Windows MIDI Services

Demo on real hardware:

ESP32-S3 T-Display-S3

RP2040 T-PicoC3

Thanks to Mike Kent for the guidance on Network MIDI 2.0. I'm studying the spec and interested in working on that as a next step.

Saulo

fdetro and others added 6 commits February 25, 2026 15:13
- Remove ROADMAP.md (internal planning)
- Remove .mp4 videos (YouTube links in CHANGES.md instead)
- Remove test.sh (internal tooling)
- Clear author fields in library.json/properties (leave for maintainers)
@AmeNote-Michael
Copy link
Copy Markdown
Contributor

@sauloverissimo I have merged the old PR with MIDI1 rename. I however am hesitant to merge the latest PR by (@fdetro) with the extra include. I will comment in that PR, but in my integration in a new project just now, the extra include was not needed nor does it exist in any of the included class drivers.

For the updates to the function calls, I prefer to have the #defines to make adjustment based on tinyUSB version. I will look at adding this detail specifically in next couple days after I release my current project, after which would like to get you to merge in latest updates.

Can you please confirm that you feel for sure you need PR#10 or is it just you do not have proper include paths? Again, I found it was not needed, but do not want to exclude it if it is really needed. Again, other drivers do not have this include.

@sauloverissimo
Copy link
Copy Markdown
Author

Hi @AmeNote-Michael, thanks for merging the MIDI1 rename and for reviewing.

About PR #10 — yes, I do believe the #include "tusb.h" is needed, and it's not an include path issue. Here's why:

The usbd_class_driver_t struct changed layout between TinyUSB 0.15 and 0.16+. The name field was conditional on CFG_TUSB_DEBUG >= 2 and became unconditional, deinit was added as a new callback, and xfer_isr was added too. When ump_device.cpp only includes device/usbd.h and device/usbd_pvt.h directly, the configuration flags from tusb_option.h are not loaded, so the compiler may see the wrong struct layout depending on the TinyUSB version.

Including tusb.h fixes this because it loads the full configuration context before the struct is defined. The built-in TinyUSB class drivers (midi_device.c, hid_device.c, etc.) also include tusb_option.h or go through tusb.h for the same reason.

Your integration probably works without it because you're building inside the TinyUSB source tree or with a version where the config flags are already in scope. For external projects pulling tusb_ump as a library with different TinyUSB versions (which is my case with ESP-IDF and arduino-pico), the include is needed to compile correctly.

In my PR #11 I included this same fix along with the version-guarded macros for usbd_edpt_xfer() and tu_fifo_config() changes. I think it's fair to merge that one first and I can rebase on my end to adjust.

- processRxUMP: check all words available before processing multi-word
  UMP packets, preventing truncated data reaching umpStreamHandleRx
- library.json: add raspberrypi to platforms (RP2040/RP2350 support)
- platformio.ini: remove hardcoded /c/pio/ build paths
- ump_stream_handler.h: mark umpStreamLabel unused to suppress warnings
- ump.h: fix Doxygen group from CDC copy-paste to MIDI/UMP
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.

4 participants