ESP32 debugging using breakpoints in library files is not reliable

I’m attempting to debug an ESP32 arduino application and breakpoints that I set in a library file pause execution about 1 time in 10 restarts. Why is this and how can I make it more reliable? Restarting debugging takes forever and often breaks. ESP-prog tool.

Bad cables to too high debug frequency? See How do I upload arduino code to esp32 using ESP-Prog - #16 by maxgerhardt

I think the cable is fine.

Default is 20000. I don’t see an option to lower that for esp-prog.

Does anyone know how to lower the debug frequency for the esp-prog?

Can you temporarily edit the adapter_khz value in the filepath given in the link above and see if that helps?

I missed that filepath somehow.

I tried lowering it to 10000 and got the same results. PIO refuses to stop at the breakpoint I set within my syncTime() function. Am I doing it right?

I tried clearing all breakpoints, starting debugging after cleaning the build and restarting vscode then setting the breakpoint after it hit the temp breakpoint and get the following error message:

@ivankravets? Can anyone assist with this?

Hi @Daemach! There are three possible sources of your problem:

  • Hardware issues (bad wiring, defective probe, etc)
  • Issues with tools provided by Espressif team (GDB, OpenOCD)
  • Issues with PlatformIO debug instruments

To exclude the first two:

  • Do you have any other debug probe at hand? What board do you use?
  • Can you try to debug your board using only Espressif tools in command line mode?

I don’t have another debug probe. I’m using the esp-prog on an ESP32 WROOM

I don’t know how to debug outside PIO but I’ll try if you can point me in the right direction.

Official setup from ESP-IDF written for Eclipse and their openocd + gdb solution is here: JTAG Debugging - ESP32 - — ESP-IDF Programming Guide latest documentation. It’s quite lengthy though.

1 Like