Skip to content

Conversation

me-no-dev
Copy link
Member

This pull request enhances TinyUSB integration in the Arduino ESP32 project by expanding support for USB host functionality alongside device mode. The changes update build configuration, add host-related source files, and introduce new host-specific settings and code patches to enable and configure the host stack.

Build system and source file updates:

  • Added host-related source files (e.g., usbh.c, hub.c, host class drivers) to the srcs list in components/arduino_tinyusb/CMakeLists.txt, enabling compilation of USB host features. Also updated device and common file inclusion for TinyUSB. [1] [2]

Configuration and settings:

  • Introduced host configuration macros in tusb_config.h, such as CFG_TUH_ENABLED, CFG_TUSB_RHPORT1_MODE, and buffer/device limits for host mode. Also added board-level defines for host port and speed.
  • Defined CFG_TUD_ENABLED when CONFIG_TINYUSB_ENABLED is set, and added board-level macros for device port and speed. Improved memory alignment handling for ESP32P4 targets. [1] [2] [3]

Code patching for host support:

  • Applied a patch (dwc2_esp32_h.diff) to the TinyUSB source, updating interrupt handler logic to call both device and host interrupt handlers as appropriate. [1] [2]

@lyusupov
Copy link

lyusupov commented Sep 7, 2025

@me-no-dev

  1. Is it an ESP32-S2/S3/P4 native USB Host or it needs an external MAX3421 IC ?
  2. FS or HS ?
image

@me-no-dev
Copy link
Member Author

@lyusupov it's for native USB host. Speed depends on the chip. FS for S2 and S3 and HS for P4

@lyusupov
Copy link

lyusupov commented Sep 7, 2025

That's great!
Waiting patiently for your merge of this PR into upcoming Release.
Will be happy to try it out on P4 in HS mode with USB RTL-SDR receiver (and libusb driver).

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.

2 participants