hathach / tinyusb

An open source cross-platform USB stack for embedded system
https://www.tinyusb.org
MIT License
5.09k stars 1.07k forks source link

Support ESP32-S3 USB Host #2634

Open marchingband opened 6 months ago

marchingband commented 6 months ago

Related area

I would like to have tinyUSB support USB Host on ESP32-S3

Hardware specification

ESP32-S3

Is your feature request related to a problem?

I have USB MIDI Host working under esp-idf, but I need to port my project to Arduino, and TinyUSB does not yet support ESP32-S3 host.

Describe the solution you'd like

Add host support, and ideally a MIDI example :)

I have checked existing issues, dicussion and documentation

shufps commented 4 months ago

Would like to have the same, I hope to get USB CDC ACM (virtual com port) devices running on a ESP32 as USB Host.

Preferably with Micropython, since Micropython uses tinyusb, I thought would be a good idea to look here if Host actually is supported :face_with_peeking_eye:

tore-espressif commented 4 months ago

Hi guys, in case you are still interested in USB Host applications, we have it supported on ESP32-S2 and ESP32-S3 in esp-idf

Here's some documentation https://docs.espressif.com/projects/esp-idf/en/stable/esp32s3/api-reference/peripherals/usb_host.html

And some CDC examples https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/host/cdc

marchingband commented 4 months ago

@tore-espressif Thanks, yes I use that when I am on esp-idf. I have some projects that are on Arduino (ex. https://www.sparkfun.com/products/21307), and it would be very valuable to have USB Host available in both frameworks. Is there a brief way to explain why this is especially challenging for the developers? The question comes up fairly frequently and I never know what to say.

niklasekstrom commented 2 months ago

Hi guys, in case you are still interested in USB Host applications, we have it supported on ESP32-S2 and ESP32-S3 in esp-idf

Hi Tomas,

Does your usb stack support connecting a hub, and then connecting multiple HID devices to that hub (e.g., keyboard and mouse)?

I see in this directory https://github.com/espressif/esp-idf/tree/master/components/usb that there are some files related to hubs, but I can't find any information about if hubs are actually supported.

tore-espressif commented 2 months ago

Is there a brief way to explain why this is especially challenging for the developers?

I checked with Arduino team and this is what I got: It should be technically possible, there are two approaches

  1. Use Arduino as esp-idf component, then you can easily use USB Host Library that is part of esp-idf. Here are some resources about this option: https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html https://www.youtube.com/watch?v=8w3MmsZBa9o&ab_channel=EspressifSystems
  2. You can write your own wrapper that would enable you to use USB Host Library in esp-idf. The USB Library is rather big, so this is not a trivial thing, plus it is not documented properly. You can ask in the arduino project if you want to know more

Does your usb stack support connecting a hub, and then connecting multiple HID devices to that hub (e.g., keyboard and mouse)?

External HUB support is work in progress in esp-idf, it should be ready beginning of October