Files
esp-idf/examples/peripherals/usb
igor.masar 7492f9b9cd docs(usb): add ESP32-H4 support notes and pin map
- usb_device: add esp32h4 DP/DM defaults (GPIO22/21) and "only:: esp32h4";
  add H4 PHY considerations; add H4 MSC write-speed table; generalize MSC SD
  note to {IDF_TARGET_NAME}; exclude tusb_ncm on H4
- usb_host: include esp32h4 in feature gates; add H4 PHY considerations
- usb_host_notes_dwc_otg: enable H4 by extending "only::" selector
- examples/usb: add ESP32-H4 row to DP/DM pin map
- docs_not_updated: drop H4 entries for usb_device, usb_host, and related
  usb_host notes now covered
- soc(esp32h4): set internal PHY mapping to DP=22, DM=21
2025-11-07 12:19:26 +01:00
..

USB-OTG Examples

See the README.md file in the upper level examples directory for more information about examples.

Common Pin Assignments

Pin assignment is only needed for ESP chips that have a USB-OTG peripheral. If your board doesn't have a USB connector connected to the USB-OTG dedicated GPIOs, you may have to DIY a cable and connect D+ and D- to the pins listed below.

ESP BOARD       USB CONNECTOR (type A)
                   --
                  | || VBUS (5V)
[USB_DM]  ------> | || D-
[USB_DP]  ------> | || D+
                  | || GND
                   --

USB PHY pin mapping

USB_DP USB_DM
ESP32-S2/S3 GPIO20 GPIO19
ESP32-P4 2.0 pin 50 pin 49
ESP32-P4 1.1 GPIO27 GPIO26
ESP32-H4 GPIO22 GPIO21

Note: On the ESP32-P4, the USB 2.0 PHY pins are dedicated to USB-OTG functionality and cannot be used as general-purpose GPIOs.