1. Introduction
In short: The ESP32-C3 has built-in two development toolsusb-serial
and usb-jtag
, which allows programming, online debugging, and log output with just one data cable, greatly facilitating developers;
The following is from the official data manual introduction
2. Prerequisites
-
ESP-IDF version is 4.4.+ -
Download firmware pin level requirements (Pay attention to the pins of Joint Download Boot mode)
3. Using USB-Serial
usb-serial
can be used for firmware programming and log output, saving us a UART port;
-
SDK configuration, set log output to built-in USB -
Configure download method -
Hardware pin connection
USB Port | ESP32C3 |
---|---|
VCC | VCC |
GND | GND |
USB_D- | GPIO18 |
USB_D+ | GPIO19 |
-
Confirm that the driver has been installed correctly
-
Select the COM port assigned to the built-in usb-serial of esp32c3 on the computer, and you can download the firmware
View logs
4. Using USB-Jtag
usb-jtag
is used for firmware downloading and online debugging
-
Configure SDK, same as step 3.1
-
Configure download method
-
Select chip in VSCODE (remember to re-execute
menuconfig
for configuration after selecting the chip each time) -
Before online debugging, download the program once
-
Create a
launch.json
file with the following content
{
"version": "0.2.0",
"configurations": [
{
"type": "espidf",
"name": "esp32c3-debug",
"request": "launch",
"mode": "auto",
"skipVerifyAppBinBeforeDebug": false
}
]
}
File explanation
-
version
: This field indicates the version of the VSCode debugger being used. Currently, version 0.2.0 is being used. -
configurations
: This field lists the configuration options for debugging operations. In this example, we only have one configuration. -
type
: Specifies the type of debugger to be used. Here, we use the ESP-IDF debugger. -
name
: This field is the name of the debugging configuration to be launched. Here, we name itesp32c3-debug
, and you can define any suitable name. -
request
: Specifies the action that VSCode will take through the debugger. Here, we use thelaunch
command to start a new debugging session locally. -
mode
: Specifies the debugging mode to be used in the debugging session. In this example, we usemode=auto
, indicating that VSCode will choose local or remote debugging based on the situation. -
skipVerifyAppBinBeforeDebug
: Indicates whether to skip the application binary verification step to speed up debugging startup. This is an optional parameter, defaulting tofalse
.
Start debugging
Run the debugging program
Thus, we can perform firmware downloading, log printing, and online debugging through the built-in USB-Serial-JTAG
of ESP32-C3
with just one USB data cable, oh yeah;