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 get log output via Serial Device connection.
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## Serial Connection
37
38After program's start and getting of the message of readiness (`Serial device is ready to connect`) you can connect to the board using any serial port terminal application (e.g. CoolTerm).
39
40Note: if you want to send data to the target see how to implement it via `tud_cdc_rx_cb` at the `tusb_serial_device` example.
41
42## Example Output
43
44After the flashing you should see the output at idf monitor:
45
46```
47I (288) example: USB initialization
48I (288) tusb_desc:
49┌─────────────────────────────────┐
50│  USB Device Descriptor Summary  │
51├───────────────────┬─────────────┤
52│bDeviceClass       │ 239         │
53├───────────────────┼─────────────┤
54│bDeviceSubClass    │ 2           │
55├───────────────────┼─────────────┤
56│bDeviceProtocol    │ 1           │
57├───────────────────┼─────────────┤
58│bMaxPacketSize0    │ 64          │
59├───────────────────┼─────────────┤
60│idVendor           │ 0x303a      │
61├───────────────────┼─────────────┤
62│idProduct          │ 0x4001      │
63├───────────────────┼─────────────┤
64│bcdDevice          │ 0x100       │
65├───────────────────┼─────────────┤
66│iManufacturer      │ 0x1         │
67├───────────────────┼─────────────┤
68│iProduct           │ 0x2         │
69├───────────────────┼─────────────┤
70│iSerialNumber      │ 0x3         │
71├───────────────────┼─────────────┤
72│bNumConfigurations │ 0x1         │
73└───────────────────┴─────────────┘
74I (458) TinyUSB: TinyUSB Driver installed
75I (468) example: USB initialization DONE
76I (468) example: log -> UART
77example: print -> stdout
78example: print -> stderr
79...
80
81```
82
83Other log will be printed to USB:
84```
85I (3478) example: log -> USB
86example: print -> stdout
87example: print -> stderr
88```
89