adafruit / Adafruit_TinyUSB_Arduino

Arduino library for TinyUSB
MIT License
470 stars 124 forks source link

documentation on esp-idf use #160

Closed ultrapalace closed 2 years ago

ultrapalace commented 2 years ago

I am struggling to use my esp32s2 as a USB MIDI Device, via the esp-idf.

I would love to have an example, or some documentation, on how to achieve this, using your library!

I have added Arduino-as-a-component to esp-idf, and that is working. I have tried adding Adafruit_TinyUSB_Arduino to arduino/libraries, and adding it to the Arduino CMakeLists.txt, which compiles. I have also tried adding Adafruit_TinyUSB_Arduino as an idf component and authoring a CMakeLists.txt, etc.

In the case of adding Adafruit_TinyUSB_Arduino to arduino/libraries, the error I cannot solve is undefined reference to Adafruit_USBD_MIDI::Adafruit_USBD_MIDI(unsigned char) which I believe is related to a line in your documentation, indicating that the constructor needs to be initialized with the USB Descriptor String (my guess). Unfortunately I have no idea how to produce such a string. This section in your documentation is a little spare, and I was unable to clearly determine how to proceed.

In the case of adding Adafruit_TinyUSB_Arduino as an idf component, the error I cannot solve is something like "your board is not capable of USB" (sorry I cant find the exact error now) which I imagine is related to not having certain defines setup, and maybe the library doesn't know its on an ESP32s2.

I have opened an issue with esp-idf asking for a USB MIDI example, using the tinyusb library included in the esp-idf with no response, and I have also asked other Arduino library authors to offer an esp-idf solution, but nothing has yet worked.

I think there are very likely many people wanting to access MIDI USB DEVICE from esp-idf for their esp32s2's, it looks like your library is a great method for this, and I am hoping someone will be willing to help me establish a solution. I am very happy to contribute back to the community any way I can if I ever get this working :) Perhaps a little blog post, some documentation in your repo, or whatever seems best.

Thank you so much for any help anyone can provide!

ultrapalace commented 2 years ago

The environment I have setup is VSCODE with the esp-idf plugin, which installed the latest esp-idf and other tools The latest arduino-as-a-component from these instructions https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html

hathach commented 2 years ago

this library is meant to use with arduino only, and not as idf component.

ultrapalace commented 2 years ago

@hathach thanks for the quick response. That's good to know! Would you be willing to work with me to get this example to work on esp32s2 https://github.com/hathach/tinyusb/tree/master/examples/device/midi_test/src I could open an issue there.