rppicomidi / usb_midi_host

An application level TinyUSB USB MIDI Host driver for the RP2040
MIT License
53 stars 6 forks source link

Support ESP32S3 on Arduino #12

Open rppicomidi opened 1 month ago

rppicomidi commented 1 month ago

Is your feature request related to a problem? Please describe. @marchingband attempted to compile usb_midi_host_example.ino and got the error Compilation error: #error "Please Select USB Stack: Adafruit TinyUSB Host"

Describe the solution you'd like The example should also work with the Espressif ESP32S3 Dev Module + MAX3421E host shield. The other TinyUSB dual role examples work.

Describe alternatives you've considered See discussion here

Additional context See discussion here

marchingband commented 1 month ago

Just want to be clear that I am not using any shield, or additional parts, the ESP32S3 supports usb host natively.

rppicomidi commented 1 month ago

@marchingband According to the TinyUSB website, TinyUSB does not support USB Host natively for the ESP32S3. I looked at the repository for the espressif branch of tinyusb and under tinyusb/src/portable/espressif/esp32sx and found a dcd_esp32sx.c for USB device but no corresponding hcd_esp32sx.c for the host side. The esp-idf repo has a host controller interface, but my project is an extension of TinyUSB, not the esp-idf. This driver relies on TinyUSB support for host bulk and control endpoints and implements the MIDI spec on top of it. I can probably make this driver work with the MAX3421E host shield.

Unless you or someone else adds TinyUSB support for ESP32 host hardware, this driver is not the path to Arduino support for native USB host MIDI on ESP32. Should I close this issue?

marchingband commented 1 month ago

Sorry to hear that, thanks for looking into it!

marchingband commented 1 month ago

Would it be worth asking at tinyUSB to add host support? I know so little about usb I'm unclear if that's a reasonable request or not.

rppicomidi commented 1 month ago

@marchingband Up to you. I will leave this issue open here. If others want me to support the MAX3421E host shield in this driver, I will get to it. If no one responds in a few months, I will close it due to lack of interest.

BTW, I do understand that the ESP32 is a popular ecosystem, and I see the potential benefits of it for MIDI. Nevertheless, my attraction to the RP2040 and the Pico board in particular is you can implement a USB MIDI host and a USB MIDI device at the same time with only two added resistors and a USB connector on a 4 US dollar board. For 2 dollars more, you can buy a Pico W board that adds WiFi and Bluetooth support. There are enough other I/O pins to implement UARTs for UART MIDI too.

marchingband commented 1 month ago

I certainly see the power of rp2040, although I havnt yet tried it. ESP32S3 makes a great audio target because of i2s and eMMC/SD peripherals, and the 8MB octal PSRAM available at $5, the newer P4 (out soon) has a 400mhz clock and will be even better at audio.

I am not sure if you've seen this repo, and I'm not sure if it uses tinyUSB, but I believe it works for S3 under Arduino https://github.com/touchgadget/esp32-usb-host-demos/blob/main/examples/usbhmidi/usbhmidi.ino

Maybe it helps.

In case you are curious here is my project, I am working on v2 currently.

https://www.sparkfun.com/products/21307

marchingband commented 1 month ago

https://github.com/hathach/tinyusb/issues/2634