How to debug ESP32-C3 using JTAG

This article introduces how to create a basic project for the RISC-V-based ESP32-C3 device and how to debug it using JTAG. We will demonstrate all the necessary wiring on the ESP32-C3-DevKitM development board, as well as the steps required to configure the software.

The ESP32-C3 chip includes its own on-chip USB-to-JTAG engine, so debugging can be performed by connecting an auxiliary USB cable to a special debug USB pin (Option A). Alternatively, debugging can be performed using an external JTAG probe (Option B), but this requires the additional setup described here .

How to debug ESP32-C3 using JTAG

To debug the ESP32-C3 using the built-in JTAG engine, you need to use an auxiliary USB cable and connect it to the following pins on the development board:

USB signalTypical wire colorsESP32-C3 signal nameESP32-C3-DevKitM Pin Names
D-WhiteGPIO18J3.13
D+greenGPIO19J3.14
V_BUSred5VJ1.13 or J1.14
GNDblackGNDJ1.15
How to debug ESP32-C3 using JTAG

The settings after connection is complete are as follows:

How to debug ESP32-C3 using JTAG

Please note that since the auxiliary USB connection also powers the board, you do not need to connect another cable to the main USB connector.

If you wish to use an external USB-to-JTAG probe, you will need to connect the following signals according to the Espressif documentation:

JTAG signalJTAG20 pinESP32-C3 signalESP32-C3-DevKitM pin
TMS7IO4J3.11
TDI5IO5J3.10
TCK9IO6J3.9
TDO13IO7J3.8
GND4GNDJ3.1

After completing all wiring settings, please follow these steps to create a basic project and debug it:

1. Launch Visual Studio, and then open the VisualGDB ESP32 Project Wizard:

How to debug ESP32-C3 using JTAG

2. Choose a name and location for your project:

How to debug ESP32-C3 using JTAG

3. Use the default CMake build system:

How to debug ESP32-C3 using JTAG

4. Ensure you are using VisualGDB 5.6+, the esp32-gcc 8.4.0-r3 toolchain or later, and ESP-IDF 4.3 or later. Then, select the ESP32C3 chip in the wizard:

How to debug ESP32-C3 using JTAG

5. Continue cloning the basic “blink” example:

How to debug ESP32-C3 using JTAG

6. Connect the auxiliary USB cable as shown at the beginning of this article. VisualGDB will automatically detect the ESP32-C3’s built-in JTAG interface; select it on the Debug method page. Click “Test” to verify the connection:

How to debug ESP32-C3 using JTAG

7. Use the “Test” button to verify the connection. Note that VisualGDB may report most device registers as set to 0. This is the expected result for an ESP32-C3 device and does not indicate an error.

How to debug ESP32-C3 using JTAG

8. Finally, click ” Finish ” to create the project. Now you will be able to build and debug it as usual:

How to debug ESP32-C3 using JTAG

9. Note that the default blinking example does not blink the onboard LED. Instead, it configures IO5 (typically used as the TDI signal for external JTAG debugging) as an output and toggles it slowly. To debug code using an external JTAG debugger, in addition to following the steps described here, you will need to disable this feature (e.g., by changing BLINK_GPIO).

Original Post: https://www.yiboard.com/thread-1824-1-1.html

error: Content is protected !!
Scroll to Top