Problems with ESP32 and built-in JTAG debugging

Hello, I have an issue when debugging code with PIO, ESP32-S3, and the built-in JTAG interface.

Downloading of code works fine, however, when starting debugging with a breakpoint set, or with “tbreak setup” in the PIO INI file, the target does not stop. If the “pause/break” button is pressed the target stops and when continuing, it stops at breakpoints that were already set before starting the session.

This makes debugging startup code hard, is there a solution please?

This is my INI file:

[env:um_feathers3]
platform = espressif32
board = um_feathers3
debug_tool = esp-builtin
upload_port = COM4
debug_speed = 10000
debug_init_break = tbreak setup
build_flags =
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1
framework = arduino
lib_deps =
adafruit/Adafruit SHT31 Library@^2.2.2
adafruit/Adafruit BusIO@^1.15.0
wire
spi

Does this also happen in the simplest most sketch with no lib_deps and blinky?

Yes, although I added those lib_defs the project is a simple “new project” generated by PIO.

Did you ever resolve this? I have the same problem

HI @markgraham, It was a while ago and I don’t remember how I got it working. Unfortunately, JTAG debugging was so slow as to be pretty much not useful. I abandoned it and had to revert to serial printing debugging.
Sid

I had the same issue recently.
The internal USB-JTAG is limited compared to ESP-Prog hardware.
The bus speed is limited, plus the number of breakpoints is also limited to I think two break points.

Comment out debug_init_break and the debugger will stop at user set break points.

I had a further confusion in that the dev board I’m using is a common Chinese clone YD-ESP32-S3
The two USB ports are not marked which is serial and which is USB/OTG, for a while I was on the wrong USB-C

Seems the onboard USB/JTAG is only good for trivial debugging work, otherwise use ESP-Prog or similar

@matt1 I also found that deleting “debug_init_break” made user breakpoints work. However, the slow operation was a killer for me.

Unfortunately, the hardware I am working with does not break out the JTAG pins. I have used ESP-Prog on other projects, and it is just about acceptable.

1 Like