esp-usb-skill

Generates and debugs ESP32 USB device and host firmware using esp_tinyusb and USB Host Library APIs.

28|3|Updated Jun 24, 2026
One-click install
npx skills add https://github.com/JasonYANG170/esp-dev-skill --skill esp-usb-skill-jasonyang170
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: esp-usb-skill
Source: https://github.com/JasonYANG170/esp-dev-skill/tree/main/repos/esp-usb
Command: npx skills add https://github.com/JasonYANG170/esp-dev-skill --skill esp-usb-skill-jasonyang170

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing USB firmware for Espressif chips requires choosing between the esp_tinyusb device stack and the USB Host Library, getting Kconfig options, descriptors, PHY setup, and init ordering exactly right. This Skill grounds every API, struct, and config option in the real esp-usb repository so the AI never invents functions and avoids the 12 most common pitfalls. ## Core Features & Use Cases - USB Device Firmware: Build CDC-ACM serial ports, MSC storage (SPI-flash or SD card), HID, composite CDC+MSC devices, console/VFS redirection, NCM/RNDIS Ethernet-over-USB, external PHY, and VBUS monitoring. - USB Host Firmware: Integrate the USB Host Library plus class drivers for CDC-ACM (CP210x/FTDI/CH34x), MSC flash drives, HID keyboards/mice, UVC cameras, and UAC audio. - Verified References: Real function signatures, Kconfig options, chip support tables, and WRONG/CORRECT pitfall examples drawn from actual esp-usb headers and test apps. - Use Case: Ask the AI to make an ESP32-S3 appear as a USB serial port plus mass storage device; it produces the composite IAD descriptors, menuconfig settings, and init code that compiles on the first try. ## Quick Start Ask the AI to create a USB CDC-ACM serial device on an ESP32-S3 using esp_tinyusb, including the component dependency, menuconfig options, and callback-based echo code.

Frequently Asked Questions about esp-usb-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a USB CDC-ACM serial device on ESP32-S3?

Add the espressif/esp_tinyusb component, enable CONFIG_TINYUSB_CDC_ENABLED in menuconfig, then call tinyusb_driver_install with TINYUSB_DEFAULT_CONFIG() followed by tinyusb_cdcacm_init with your RX callback. The skill provides complete working code for single and dual CDC interfaces.

What is the difference between esp_tinyusb and the USB Host Library?

esp_tinyusb is the device stack that makes the ESP chip act as a USB device (serial, storage, HID). The USB Host Library (usb component) plus class drivers like usb_host_cdc_acm or usb_host_msc lets the ESP chip talk to attached USB peripherals. They are separate stacks with different init sequences.

Which ESP32 chips support USB device and host functionality?

ESP32-S2, ESP32-S3, ESP32-S31, ESP32-P4, and ESP32-H4 have USB-OTG peripherals. ESP32-P4 and S31 support high-speed; S2/S3/H4 are full-speed only. SD-card MSC backing is unavailable on S2 and H4 due to missing SDMMC host hardware.

Why does my TinyUSB CDC code fail with a #error at compile time?

The tinyusb_cdc_acm.h header hard-errors when CONFIG_TINYUSB_CDC_ENABLED is not set in menuconfig. Enable it under Component config, TinyUSB Stack before calling any CDC API; the same applies to MSC and HID classes.

Why does USB host uninstall fail with ESP_ERR_INVALID_STATE?

usb_host_uninstall fails if clients or devices are still allocated. Deregister all clients, call usb_host_device_free_all until it succeeds, wait for the USB_HOST_LIB_EVENT_FLAGS_ALL_FREE flag in the daemon task, then uninstall.

When should I not use this USB skill?

It does not cover USB Type-C or USB Power Delivery (the separate usb_tcpm component), PCB or schematic design, non-USB serial buses like UART/SPI/I2C, or non-Espressif USB stacks such as STM32 or NXP.