This example is similar to the [advanced console example](../advanced/README.md), but instead of the UART it uses the USB CDC port provided by USB_OTG peripheral for console output.
The example uses the [Console Component](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/console.html#console) to create an interactive shell.
The interactive shell implemented in this example contains a wide variety of commands, and can act as a basis for applications that require a command-line interface (CLI).
First time flashing can be done over USB or over UART.
#### Flashing the project for the first time using UART
This is the same procedure described in the Getting Started Guide. Flashing is done using a USB-Serial adapter included on the development board. Determine the device name of the serial port (`PORT`) and run:
```
idf.py -p PORT flash
```
#### Flashing the project for the first time using USB
Enter the `help` command get a full list of all available commands. The following is a sample session of the Console Example where a variety of commands provided by the Console Example are used. Note that GPIO15 is connected to GND to remove the boot log output.
(remaining output of the help command skipped here)
esp32s2> free
237824
I (39864) cmd_system: Restarting
I (185) spi_flash: detected chip: generic
I (186) spi_flash: flash io: dio
I (186) cpu_start: Starting scheduler on PRO CPU.
This is an example of ESP-IDF console component.
Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
esp32s2>
```
## Troubleshooting
### Line Endings
The line endings in the Console Example are configured to match particular serial monitors. Therefore, if the following log output appears, consider using a different serial monitor (e.g. Putty for Windows).
```
This is an example of ESP-IDF console component.
Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
Your terminal application does not support escape sequences.
Line editing and history features are disabled.
On Windows, try using Putty instead.
esp32s2>
```
### No USB port appears
On Windows 10, macOS, Linux, USB CDC devices do not require additional drivers to be installed.
If the USB serial port doesn't appear in the system after flashing the example, check the following:
* Check that the USB device is detected by the OS.
VID/PID pair for ESP32-S2 is 303a:0002.
- On Windows, check the Device Manager
- On macOS, check USB section in the System Information utility
- On Linux, check `lsusb` output
* If the device is not detected, check the USB cable connection (D+, D-, and ground should be connected)