1| Supported Targets | ESP32-S2 | ESP32-S3 | 2| ----------------- | -------- | -------- | 3 4# TinyUSB Sample Descriptor 5 6(See the README.md file in the upper level 'examples' directory for more information about examples.) 7 8This example shows how to set up ESP chip to work as a USB Serial Device. 9 10As a USB stack, a TinyUSB component is used. 11 12## How to use example 13 14### Hardware Required 15 16Any ESP boards that have USB-OTG supported. 17 18#### Pin Assignment 19 20See common pin assignments for USB Device examples from [upper level](../README.md#common-pin-assignments). 21 22### Build and Flash 23 24Build the project and flash it to the board, then run monitor tool to view serial output: 25 26```bash 27idf.py -p PORT flash monitor 28``` 29 30(Replace PORT with the name of the serial port to use.) 31 32(To exit the serial monitor, type ``Ctrl-]``.) 33 34See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. 35 36## Example Output 37 38After the flashing you should see the output: 39 40``` 41I (285) example: USB initialization 42I (285) tusb_desc: 43┌─────────────────────────────────┐ 44│ USB Device Descriptor Summary │ 45├───────────────────┬─────────────┤ 46│bDeviceClass │ 239 │ 47├───────────────────┼─────────────┤ 48│bDeviceSubClass │ 2 │ 49├───────────────────┼─────────────┤ 50│bDeviceProtocol │ 1 │ 51├───────────────────┼─────────────┤ 52│bMaxPacketSize0 │ 64 │ 53├───────────────────┼─────────────┤ 54│idVendor │ 0x303a │ 55├───────────────────┼─────────────┤ 56│idProduct │ 0x4001 │ 57├───────────────────┼─────────────┤ 58│bcdDevice │ 0x100 │ 59├───────────────────┼─────────────┤ 60│iManufacturer │ 0x1 │ 61├───────────────────┼─────────────┤ 62│iProduct │ 0x2 │ 63├───────────────────┼─────────────┤ 64│iSerialNumber │ 0x3 │ 65├───────────────────┼─────────────┤ 66│bNumConfigurations │ 0x1 │ 67└───────────────────┴─────────────┘ 68I (455) TinyUSB: TinyUSB Driver installed 69I (465) example: USB initialization DONE 70``` 71 72Connect to the serial port (e.g. on Linux, it should be `/dev/ttyACM0`) by any terminal application (e.g. `picocom /dev/ttyACM0`), typing a string "espressif" and you will get the exactly same string returned. 73 74The monitor tool will also print the communication process: 75 76``` 77I (146186) example: Line state changed! dtr:1, rst:1 78I (147936) example: Got data (1 bytes): e 79I (148136) example: Got data (1 bytes): s 80I (148336) example: Got data (1 bytes): p 81I (148416) example: Got data (1 bytes): r 82I (148446) example: Got data (1 bytes): e 83I (148676) example: Got data (1 bytes): s 84I (148836) example: Got data (1 bytes): s 85I (148956) example: Got data (1 bytes): i 86I (149066) example: Got data (1 bytes): f 87``` 88