|
| 1 | +--- |
| 2 | +description: "Instructions for setting up TinyUSB in ESPHome" |
| 3 | +title: "TinyUSB" |
| 4 | +params: |
| 5 | + seo: |
| 6 | + description: Instructions for setting up TinyUSB in ESPHome |
| 7 | + image: usb.svg |
| 8 | +--- |
| 9 | + |
| 10 | +The `tinyusb` component implements a foundation for USB device functionality. It is currently supported on the |
| 11 | +following ESP32 microcontroller variants: |
| 12 | + |
| 13 | +- ESP32-P4 |
| 14 | +- ESP32-S2 |
| 15 | +- ESP32-S3 |
| 16 | + |
| 17 | +The component simply initializes the TinyUSB driver, allowing the microcontroller to act as a USB device when connected |
| 18 | +to a USB host. |
| 19 | + |
| 20 | +> [!NOTE] |
| 21 | +> This component: |
| 22 | +> |
| 23 | +> - does **not** implement any specific device functionality; it is simply a foundation for other components to do so. |
| 24 | +> - cannot be used with the {{< docref "/components/usb_host" >}}; operation as both a host and a device simultaneously |
| 25 | +> is not possible. |
| 26 | +
|
| 27 | +```yaml |
| 28 | +# Example minimal configuration entry |
| 29 | +tinyusb: |
| 30 | +``` |
| 31 | +
|
| 32 | +## Configuration variables |
| 33 | +
|
| 34 | +- **id** (*Optional*, [ID](#config-id)): Manually specify the ID for this component. |
| 35 | +- **usb_product_id** (*Optional*, int): USB product identifier. Defaults to `0x4001`. |
| 36 | +- **usb_vendor_id** (*Optional*, int): USB vendor identifier. Defaults to `0x303A` (Espressif Systems). |
| 37 | +- **usb_lang_id** (*Optional*, int): USB language identifier. Defaults to `0x0409` (English - United States). |
| 38 | +- **usb_manufacturer_str** (*Optional*, string): Manufacturer string descriptor. Defaults to `"ESPHome"`. |
| 39 | +- **usb_product_str** (*Optional*, string): Product name string descriptor. Defaults to `"ESPHome"`. |
| 40 | +- **usb_serial_str** (*Optional*, string): Serial number string descriptor. If not specified, the device's MAC address |
| 41 | + will be used. |
| 42 | + |
| 43 | +## Notes |
| 44 | + |
| 45 | +### Vendor and Product IDs |
| 46 | + |
| 47 | +When specifying custom `usb_vendor_id` and `usb_product_id` values, be aware that: |
| 48 | + |
| 49 | +- USB Vendor IDs are officially assigned by the USB Implementers Forum (USB-IF). |
| 50 | +- Using unassigned or third-party vendor/product ID combinations may result in unexpected (host) behavior. |
| 51 | +- The default vendor ID `0x303A` is assigned to Espressif Systems. |
| 52 | +- For hobbyist and development purposes, you may use test IDs, but these should not be used in production devices. |
| 53 | + |
| 54 | +### Language Identifiers |
| 55 | + |
| 56 | +The `usb_lang_id` field uses USB Language IDs as defined by the USB specification. Common values include: |
| 57 | + |
| 58 | +- `0x0409` - English (United States) - Default |
| 59 | +- `0x0809` - English (United Kingdom) |
| 60 | +- `0x0407` - German (Germany) |
| 61 | +- `0x040C` - French (France) |
| 62 | + |
| 63 | +A more complete list can be found [here](https://github.com/brookebasile/USB-langids/blob/master/USB_LANGIDs.pdf). |
| 64 | + |
| 65 | +## See Also |
| 66 | + |
| 67 | +- [TinyUSB Documentation](https://docs.tinyusb.org/) |
| 68 | +- {{< apiref "tinyusb/tinyusb_component.h" "tinyusb/tinyusb_component.h" >}} |
0 commit comments