Solved : ESP32C3 debugging with external JTAG/Jlink (works for IDE and IDF)

Dakshk
Posts: 5
Joined: Tue May 21, 2024 11:02 am

Solved : ESP32C3 debugging with external JTAG/Jlink (works for IDE and IDF)

Postby Dakshk » Fri Jun 07, 2024 10:40 am

Hello,

I wanted to debug ESP32c3 using external JTAG using pins GPIO 4-7, which is possible as mentioned here: https://docs.espressif.com/projects/esp ... -jtag.html.

But while doing this I faced many errors and so I am putting this solution if you are searching for the same problem.

NOTE: This solution is not the ideal way and is tested on the same setup as mentioned below.

First you need to follow steps as mentioned in above link and reach upto burning eFuse. After doing that make appropriate connections with your JTAG adapter I am using Jlink EDU( Segger ) V-11, make sure you also provide Vref=3.3 and GND to adapter through ESP.

Next step will be to install UsbDriverTool https://sysprogs.com/files/tools/UsbDri ... l-2.1.exe and install WinUSB on your Jlink you can easily find steps online for this.

(This step is optional) Now once try running the OpenOCD command in IDF just to check whether server is starting or not. command -
openocd -f interface/jlink.cfg -f target/esp32c3.cfg
.

If this command works you will have following as output:
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : J-Link V11 compiled Mar 14 2024 13:16:08
Info : Hardware version: 11.00
Info : VTarget = 0.000 V
Info : clock speed 4000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32c3.cpu: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: [esp32c3] Unsupported DTM version: 15
Warn : target esp32c3 examination failed
Info : starting gdb server for esp32c3 on 3333
Info : Listening on port 3333 for gdb connections
If not then make following changes in your configuration files.
Error will likely be due to adapter not finding target or adapter speed so we need to add commands in configuration files, find the openOCD directory and go to following location: C:\Espressif\tools\openocd-esp32\v0.12.0-esp32-20230921\openocd-esp32\share\openocd\scripts\interface

find configuration file for jlink and add these two lines

Code: Select all

adapter speed 4000
transport select jtag
Save the file and run the same command, it should likely run and you will able to debug code then.

Now to do same thing in IDE just copy the following command and paste in debug configuration in the section of Config options - s ${openocd_path}/share/openocd/scripts -f interface/jlink.cfg -f target/esp32c3.cfg

This method may or may not work with all adapters if you face any issues or want more information in the same setup let me know. If anybody have other approach to the same problem I would like to know.

Thank you and cheers!

Who is online

Users browsing this forum: Bing [Bot], FrancoisB-HEX and 79 guests