|
| 1 | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | |
| 2 | +| ----------------- | -------- | -------- | -------- | |
| 3 | + |
| 4 | +# CherryUSB Serial Device Example |
| 5 | + |
| 6 | +Starts a CDC Device, and sends back any received data from the host. |
| 7 | + |
| 8 | +(See the README.md file in the upper level 'examples' directory for more information about examples.) |
| 9 | + |
| 10 | +## How to use example |
| 11 | + |
| 12 | +This example can also be configured to act as double serial device. |
| 13 | +Run `idf.py menuconfig` and in `Example Configuration → Enable usb cdc acm two channel` enable. |
| 14 | + |
| 15 | +### Hardware Required |
| 16 | + |
| 17 | +Any ESP board that have USB-OTG supported. |
| 18 | + |
| 19 | +#### Pin Assignment |
| 20 | + |
| 21 | +_Note:_ In case your board doesn't have micro-USB connector connected to USB-OTG peripheral, you may have to DIY a cable and connect **D+** and **D-** to the pins listed below. |
| 22 | + |
| 23 | +See common pin assignments for USB Device examples from [upper level](../../README.md#common-pin-assignments). |
| 24 | + |
| 25 | +### Build and Flash |
| 26 | + |
| 27 | +Build the project and flash it to the board, then run monitor tool to view serial output: |
| 28 | + |
| 29 | +```bash |
| 30 | +idf.py -p PORT flash monitor |
| 31 | +``` |
| 32 | + |
| 33 | +(Replace PORT with the name of the serial port to use.) |
| 34 | + |
| 35 | +(To exit the serial monitor, type ``Ctrl-]``.) |
| 36 | + |
| 37 | +See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. |
| 38 | + |
| 39 | +## Example output |
| 40 | + |
| 41 | +When running, the example will print the following output: |
| 42 | + |
| 43 | +``` |
| 44 | +I (271) main_task: Started on CPU0 |
| 45 | +I (291) main_task: Calling app_main() |
| 46 | +[I/USB] cherryusb, version: v1.4.3 |
| 47 | +[I/USB] ========== dwc2 udc params ========== |
| 48 | +[I/USB] CID:00000000 |
| 49 | +[I/USB] GSNPSID:4f54400a |
| 50 | +[I/USB] GHWCFG1:00000000 |
| 51 | +[I/USB] GHWCFG2:224dd930 |
| 52 | +[I/USB] GHWCFG3:00c804b5 |
| 53 | +[I/USB] GHWCFG4:d3f0a030 |
| 54 | +[I/USB] dwc2 fsphy type:1, hsphy type:0, dma support:2 |
| 55 | +[I/USB] dwc2 has 7 endpoints and dfifo depth(32-bit words) is 200, default config: 7 endpoints |
| 56 | +[I/USB] ================================= |
| 57 | +[I/USB] fifo0 size:0010, offset:0050 |
| 58 | +[I/USB] fifo1 size:0010, offset:0060 |
| 59 | +[I/USB] fifo2 size:0010, offset:0070 |
| 60 | +[I/USB] fifo3 size:0010, offset:0080 |
| 61 | +[I/USB] fifo4 size:0010, offset:0090 |
| 62 | +[I/USB] fifo5 size:0010, offset:00a0 |
| 63 | +[I/USB] fifo6 size:0010, offset:00b0 |
| 64 | +I (391) device_cdc_main: usb cdc acm init done |
| 65 | +I (721) device_cdc_main: intf:0, dtr:0 |
| 66 | +I (721) device_cdc_main: intf:0, rts:0 |
| 67 | +I (2981) device_cdc_main: intf:0, dtr:0 |
| 68 | +I (2981) device_cdc_main: intf:0, rts:0 |
| 69 | +I (2981) device_cdc_main: intf:0, dtr:0 |
| 70 | +I (2981) device_cdc_main: intf:0, rts:0 |
| 71 | +I (2981) device_cdc_main: intf:0, dtr:0 |
| 72 | +I (2981) device_cdc_main: intf:0, rts:0 |
| 73 | +I (2991) device_cdc_main: intf:0, dtr:0 |
| 74 | +I (2991) device_cdc_main: intf:0, rts:0 |
| 75 | +I (2991) device_cdc_main: intf:0, dtr:0 |
| 76 | +I (2991) device_cdc_main: intf:0, rts:0 |
| 77 | +I (3001) device_cdc_main: intf:0, dtr:0 |
| 78 | +I (3001) device_cdc_main: intf:0, rts:0 |
| 79 | +I (6011) device_cdc_main: actual out len:13 |
| 80 | +I (6021) device_cdc_main: actual in len:13 |
| 81 | +I (10411) device_cdc_main: actual out len:13 |
| 82 | +I (10421) device_cdc_main: actual in len:13 |
| 83 | +I (11111) device_cdc_main: intf:0, dtr:0 |
| 84 | +I (11111) device_cdc_main: intf:0, rts:0 |
| 85 | +``` |
0 commit comments