ESP32-S3 JTAG debugging using Espressif IDE

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

ESP32-S3 JTAG debugging using Espressif IDE

Postby zazas321 » Wed Oct 26, 2022 12:33 pm

Hello. I have been using vscode for a while now. I have decided to download Espressif and try debugging with JTAG using ESP32-S3.

I have setup Espressif IDE (https://dl.espressif.com/dl/esp-idf/?idf=4.4)

And imported "hello world" project. I have created a a new configuration :
https://im4.ezgif.com/tmp/ezgif-4-76d35bac1c.png

I use ESP32-S3 development board that has UART and USB connectors. If I want to use JTAG, I must connected to USB and that is what I did.

When I try to launch in debug mode, I get the following error:

Code: Select all

Open On-Chip Debugger  v0.11.0-esp32-20211220 (2021-12-20-15:43)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

Flashing C:/Espressif/frameworks/esp-idf-v4.4.2/workspace/hello_world/build/partition_table/partition-table.bin at 0x8000
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'
** OpenOCD init failed **
shutdown command invoked
** Flashing Failed **
-1
Started by GNU MCU Eclipse
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Assertion failed!

Program: C:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20211220\openocd-esp32\bin\openocd.exe
File: ../src/jtag/core.c, Line 343

Expression: jtag_trst == 0

Could someone help me understand a little how to setup the IDE for ESP32-S3 debugging

filo_gr
Posts: 110
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

Re: ESP32-S3 JTAG debugging using Espressif IDE

Postby filo_gr » Wed Oct 26, 2022 1:24 pm

Welcome to the fantastic world of JTAG, where things will never work as espected :cry:
Filippo

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Re: ESP32-S3 JTAG debugging using Espressif IDE

Postby zazas321 » Thu Oct 27, 2022 5:46 am

How come? Is it really that bad?


I cant seem to understand what could possibly be the issue. I have managed to start the debugger in vscode using the same USB cable and same ESP32-S3 device so my hardware is ok.

launch.json I use for my vscode project:

Code: Select all

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "ESP32 OpenOCD",
            "type": "cppdbg",
            "request": "launch",
            "cwd": "${workspaceFolder}/build",
            "program": "${workspaceFolder}/build/single_read.elf",
            "miDebuggerPath": "C:/Users/petrikas.lu/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin/xtensa-esp32s3-elf-gdb.exe",
            "setupCommands":[
            { "text": "target remote 127.0.0.1:3333"},
            { "text": "set remote hardware-watchpoint-limit 2"},
            { "text": "monitor reset halt"},  
            { "text": "flushregs"}, 
            ]
        }
    ]
}
settimgs.json:

Code: Select all

{
    "idf.flashType": "JTAG",
    "idf.portWin": "COM43",
    "idf.adapterTargetName": "esp32s3",
    "idf.openOcdConfigs": [
        "board/esp32s3-builtin.cfg"
    ],
}
Below is an image of me sucesfully running debugger on vscode :
https://ibb.co/7kQsq9H



The only things that I am not fully certain regarding the debugger configuration on Espressif IDE:

1. Flash voltage. On the bottom of the CPU that I have it says E2N8. I believe that means my flash voltage is 3.3V?

2. As you can see from the image that I have uploaded initially, the Board is selected: ESP32-S3 chip (via ESP-PROG). This is the only available option but I do not use ESP-PROG board (https://espressif-docs.readthedocs-host ... guide.html). I use built in debugger that is inside ESP32-S3. Is this option valid for the built int JTAG?

3. In the vscode settings.json I can see that "board/esp32s3-builtin.cfg" is used so I manually changed the Config options in the Espressif IDE to:

Code: Select all

-s ${openocd_path}/share/openocd/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32s3-builtin.cfg

When using esp32s3-builtin.cfg, I am getting different problem:

Code: Select all

Open On-Chip Debugger  v0.11.0-esp32-20211220 (2021-12-20-15:43)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

Warn : Interface already configured, ignoring
C:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20211220\openocd-esp32\share\openocd\scripts/interface/esp_usb_jtag.cfg:7: Error: invalid command name "espusbjtag"
in procedure 'script' 
at file "embedded:startup.tcl", line 26
at file "C:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20211220\openocd-esp32\share\openocd\scripts/board/esp32s3-builtin.cfg", line 9
at file "C:\Espressif\tools\openocd-esp32\v0.11.0-esp32-20211220\openocd-esp32\share\openocd\scripts/interface/esp_usb_jtag.cfg", line 7

Last edited by zazas321 on Thu Oct 27, 2022 6:46 am, edited 1 time in total.

filo_gr
Posts: 110
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

Re: ESP32-S3 JTAG debugging using Espressif IDE

Postby filo_gr » Thu Oct 27, 2022 6:48 am

zazas321 wrote:
Thu Oct 27, 2022 5:46 am
How come? Is it really that bad?
In my experience nobody helped me.
However I can link the questions I wrote, where there are some details about how I configured ESP-PROG JTAG for ESP32 (but it was unstable).
https://github.com/espressif/esp-idf/issues/8665
https://esp32.com/viewtopic.php?f=13&t=26811
https://esp32.com/viewtopic.php?f=13&t=26858

I hope somebody will help you (better than how I can) ;)
Filippo

aristarchos
Posts: 20
Joined: Sat May 14, 2022 1:36 pm

Re: ESP32-S3 JTAG debugging using Espressif IDE

Postby aristarchos » Thu Oct 27, 2022 7:39 am

As per default configuration, ESP32S3 comes with NOT being able to use the JTAG pins.
You need to set a efuse in order to enable JTAG pins 39 to 42.
See here
https://docs.espressif.com/projects/esp ... -jtag.html

zazas321
Posts: 231
Joined: Mon Feb 01, 2021 9:41 am

Re: ESP32-S3 JTAG debugging using Espressif IDE

Postby zazas321 » Fri Oct 28, 2022 8:25 am

aristarchos wrote:
Thu Oct 27, 2022 7:39 am
As per default configuration, ESP32S3 comes with NOT being able to use the JTAG pins.
You need to set a efuse in order to enable JTAG pins 39 to 42.
See here
https://docs.espressif.com/projects/esp ... -jtag.html
Hello. I believe that is only the case when you want to use external JTAG debugger. I am using ESP32-S3 built in usb jtag.


I have managed to get it to work, I had to change the debugger config options:

Code: Select all

-s ${openocd_path}/share/openocd/scripts -f interface/esp_usb_jtag.cfg -f board/esp32s3-builtin.cfg
Last edited by zazas321 on Fri Oct 28, 2022 8:27 am, edited 1 time in total.

Who is online

Users browsing this forum: No registered users and 323 guests