tinyusb-skill

Generates and debugs TinyUSB device and host firmware across 50+ MCU families.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developing USB device or host firmware with TinyUSB requires precise knowledge of callback conventions, descriptor macros, tusb_config.h options, and interrupt forwarding, and small mistakes like missing tud_task calls or wrong endpoint numbering cause enumeration failures that are hard to diagnose. ## Core Features & Use Cases - Scenario Recipes: Fourteen step-by-step recipes covering CDC virtual serial, HID, MSC mass storage, UAC2 audio, MIDI, DFU firmware upgrade, USBTMC, Vendor/WebUSB, host stack, and Type-C/PD, each with real code and common error tables. - API and Config Reference: Verified function signatures grouped by tud_/tuh_/tusb_ prefixes plus CFG_TUSB_* / CFG_TUD_* / CFG_TUH_* macro documentation sourced from actual TinyUSB headers. - Pitfall Diagnosis: Twelve critical pitfalls with WRONG/CORRECT code pairs covering task loops, ISR forwarding, descriptor mismatches, and buffer sizing. - Use Case: Ask the agent to create a CDC virtual serial device on ESP32-S3, and it produces tusb_config.h, usb_descriptors.c, and a main loop with correct tusb_init and tud_task calls, then verifies endpoint numbering against the descriptor macros. ## Quick Start Ask the agent to create a TinyUSB CDC virtual serial device for your target board and let it generate the configuration, descriptors, and main loop.

Frequently Asked Questions about tinyusb-skill

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

FAQPage Schema
How do I create a USB CDC virtual serial port with TinyUSB?

Enable CFG_TUD_CDC in tusb_config.h, implement the descriptor callbacks using TUD_CDC_DESCRIPTOR, then call tud_cdc_read and tud_cdc_write in your loop. Always call tud_cdc_write_flush after writing, and keep tud_task running in the main loop.

Why is my TinyUSB device not enumerating?

Enumeration usually fails because tud_task is not called frequently in the main loop, the USB ISR does not forward to tusb_int_handler, or CFG_TUSB_MCU is undefined. Also verify interface and endpoint numbers in the configuration descriptor match the TUD_*_DESCRIPTOR macros.

Which MCUs does TinyUSB support for USB device and host?

TinyUSB supports over 50 MCU families including ESP32-S2/S3/C3/C6/P4, STM32 F4/F7/H7/G0/G4/L4, RP2040, nRF52840, NXP LPC and i.MX RT, and Microchip SAMD. Host support varies by chip, and USB 3.0 SuperSpeed is not supported.

How do I build and flash TinyUSB examples with CMake?

First run python tools/get_deps.py with your board or family to fetch MCU drivers, then run cmake -DBOARD=<board> -B build and cmake --build build. Flash using targets like jlink, stlink, openocd, or uf2 depending on the board.

Can TinyUSB handle DFU firmware upgrades over USB?

Yes, TinyUSB provides DFU Runtime for declaring upgrade capability in the application and DFU mode for actual firmware transfer in the bootloader. You implement tud_dfu_download_cb and must call tud_dfu_finish_flashing after writing, with bwPollTimeout for slow flash.

What are the limitations of TinyUSB for audio devices?

UAC2 audio requires careful endpoint sizing via TUD_AUDIO_EP_SIZE and asynchronous sinks need a feedback endpoint, preferably using the FIFO_COUNT method with software buffers at least four times the endpoint size. Sample rate negotiation requires implementing Clock Unit RANGE and CUR requests.