ESP32 JTAG debugging via Jlink EDU

I’m trying to get JTAG debugging working on the ESP32 with a JLink EDU debugger. I’ve successfully programmed the ESP32 via OPENOCD with JLINK with the following command

openocd -f interface/jlink.cfg -f board/esp-wroom-32.cfg -c "program_esp build/hello-world.bin 0x10000 verify exit"

This user seemed to got it going, but there is no clear finalisation about what they did to get it working. I also tried their configuration as listed in the post but with no success.

This guide uses the olimex debugger which is also not compatible.
https://docs.platformio.org/en/latest/tutorials/espressif32/arduino_debugging_unit_testing.html

Any help will be appreciated.

If you have successfully uploaded a program via JLink, you should be really close as hardware and drivers seem to be working.

You should be able to directly upload from PlatformIO if you add the below line to platformio.ini:

upload_protocol = jlink

Try this as the next step.

After that, you should tell us where you are stuck:

  • Do you get an error message? If so, what is it?
  • Don’t you understand how to start the debugger?

And please post the contents of your platformio.ini file.

Thank you @manuelbl

I used the info on this page J-LINK — PlatformIO latest documentation to set my upload protocol as

; JTAG interface
upload_protocol = jlink-jtag

on my platformio.ini which I believe is incorrect.

For anyone still trying to get JTAG debugging working with the ESP32 this is my config.

platformio.ini

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
debug_tool = jlink
upload_protocol = jlink

You also have to reduce the adapter speed from 2000kHz (20Mhz) to something more reasonable, I used 1000kHz in

esp-wroom-32.cfg

That can be found in ~/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/board/esp-wroom-32.cfg

adapter_khz 1000

1 Like