ESP32 & PIO Unified Debugger

What is your OS? Debugging tool? Could you provide a screenshot of errors from Debug Console?

MacOS Mojave. WROVER FTDI. There is no error in debug console it just never halts at the breakpoint. Below is a screenshot of what happens if I reset breakpoint while running in loop.

Could you remove all breakpoints and start debugging again? Would be good to reconnect boards from USB. Does it stop at app_main?

It does stop at app_main. That’s the IDF part that works as I’d mentioned previously. Also breakpoints within IDF’s main.cpp work fine.

Also this is how a backtrace is handled:

Temporary breakpoint
1, app_main () at …/.platformio/packages/framework-arduinoespressif32@src-537c58760dafe7fcc8a1d9bbcf00b6f6/cores/esp32/main.cpp:22
22 {
Info : Target halted. PRO_CPU: PC=0x40103AAE APP_CPU: PC=0x400014FD (active)
Target halted. PRO_CPU: PC=0x40103AAE APP_CPU: PC=0x400014FD (active)
[New Thread 1073447000]
[New Thread 1073411240]
[New Thread 1073457028]
[New Thread 1073529700]
[New Thread 1073429100]
[New Thread 1073434048]
[New Thread 1073438628]
Program received signal
SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 1073447000]
0x400014fd in ?? ()

  1. Please check that you use the latest PlatformIO Core and all packages are updated (you can update them using Left Sidebar > PlatformIO > Updates Packages)
  2. It seems that you use staging version of Arduino framework. Please switch back to stable dev/platform. Just for test.
  3. Remove all breakpoint.
  4. Start debugging session and set breakpoint when a session is established and you are at app_main.
  5. Press "Continue.

P.S: What is your board and debugging adapter?

See my log. I’ve just tried it and it works for me.

This seemed to work perfectly until step 7 where I’m supposed to use Zadig to replace the Dual RS232-HS (Interface 0) with WinUSB

I can’t seem to get the WinUSB driver installed and working. I got to “USB Serial Converter A” and “…B” in the USB controllers list, then ran Zadig on “Dual RS232-HS (Interface 0)” but it hung. Waited 10 minutes “(Not responding)”.

I restarted the PC, tried it again, and it said it worked. Unplugged, plugged in, and now I only have “USB Serial Converter A” (as expected) but no com port. Re-installing the driver via Zadig appears to work, but nothing shows up again under com ports. “Dual RS232-HS (Interface 0)” is now listed under “USB devices” and no ports.

Any ideas? or where else can I ask?

After installing the WinUSB driver on USB Serial Converter A channel, You should have “Dual RS232-HS” , “USB Serial Converter B” and “Com Port x” on device manager:

Um… yes… I’m fully aware of what I should have. What I instead have is what I described above. Which is why I’m asking for help. If a screen shot helps, this is what I’m seeing.

And here is what zadig looks like. And it DOES report that it succeeded.

image .

I don’t see the com port detected on your device manager.
Right click on “USB Serial Converter B”, go to “Advanced” tab and select “Load VCP”:


Then, the Com Port will be detected on device manager.

Check “Set the drivers” section from this tutorial: GitHub - botofancalin/Esp32_debug_template: A template project for debugginf esp-idf projects on VsCode

I explained there step by step how to set up the drivers.

I tried following the Get started with Arduino and ESP32-DevKitC: debugging and unit testing guide here:

I ran into a problem starting the debugger getting the following error code. I reconfigured drivers as stated in this post. I’ve searched around and tried others’ fixes without success. Any ideas? I am using the esp32 devkitc v4 and ARM-USB-OCD-H as shown in the tutorial. Using Arduino framework

Reading symbols from >c:\Users\zesteron\platformio_projects_selfmade\trial_esp32.pio\build\esp32dev\firmware.elf…
PlatformIO Unified Debugger → Redirecting...
PlatformIO: debug_tool = olimex-arm-usb-ocd-h
PlatformIO: Initializing remote target…
Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
//OpenOCD: Bug Reporting
adapter speed: 2000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 2000 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway…
Error: esp32.cpu0: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : accepting ‘gdb’ connection from pipe
Error: No symbols for FreeRTOS
Error: Target not examined yet
Error: Target not halted
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use ‘gdb_memory_map disable’.
Error: attempted ‘gdb’ connection rejected
Error: error during select: Unknown error
Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of irom does not support free_driver_priv()
Warn : Flash driver of drom does not support free_driver_priv()
.pioinit:11: Error in sourced command file:
Remote communication error. Target disconnected.: No error.

The message

Error: JTAG scan chain interrogation failed: all zeroes

indicates that the wiring between the ESP32-DevKitC V4 and ARM-USB-OCD-H is likely incorrect or not properly working. The drivers are okay as the log shows that OpenOCD (on your computer) can talk to the ARM-USB-OCD-H.

Can you double check the wiring and make sure it like so:

GPIO12 — TDI 5 — TDI
GPIO15 — TDO 13 — TDO
GPIO13 — TCK 9 — TCK
GPIO14 — TMS 7 — TMS

And make sure the ARM-USB-OCD-H pinout is not mirrored. As a reference: the red wire in the ribbon cable is pin 1.

The above wiring assumes the ESP32 board is powered via USB.


Thank you! It seems I was looking at it mirrored (looking into the pin holes).

And to power the ESP32-DevKitC V4 from the ARM-USB-OCD-H and not via USB, I would connect to 5V in of the esp32 to go through its regulator, not to the 3.3V pin as the tutorial states that I linked, right? Since the ARM-USB-OCD-H supplies 5V.

1 Like

I’m unsure about VCC as I have never used ARM-USB-OCD-H. According to the documentation, it seems to be clever and first measures the voltage at the pin and if it iss zero it will provide power (5V). So yes, connect it to the 5V pin and see if it works.

1 Like

Hi Community.

I’m new to VSCode+PlatformIO but I’ve read about the problem but still did not find the way to solve my issue. This is what I get when I try to debug. Your help will be appreciated. Thanks

That’s quite a long and old thread. What problem do you have exactly?

Did you try to debug but the debugger didn’t start? If so:

  • What kind of debug probe do you have?
  • Have you used Zadig to replace the FTDI driver with WinUSB (on interface 0)?

Or did you try to upload a program? If so:

  • What button or label did you click to start it?
1 Like

Hi! Thanks for your help.

I try to execute the HelloWorld example on the ESP-ROVER-KIT board. I want to do it in debug mode through the board builtin JTAG. I’ve set the 4 jumpers (MTCK, MTDI, MTDO, MTMS and even with and without EN) as mentionned in the board’s documentation

I start the debug (Pre-Debug) and this is what I get:

If I open the json file I get this but I’m new with this so I don’t know what I’m looking for:
“version”: “0.2.0”,
“configurations”: [
“type”: “platformio-debug”,
“request”: “launch”,
“name”: “PIO Debug”,
“executable”: “c:/Users/bbeliveau/Documents/PlatformIO/Projects/191105-101542-hello-world/.pio/build/esp wrover kit/firmware.elf”,
“toolchainBinDir”: “C:/Users/bbeliveau/.platformio/packages/toolchain-xtensa32/bin”,
“preLaunchTask”: {
“type”: “PlatformIO”,
“task”: “Pre-Debug”
“internalConsoleOptions”: “openOnSessionStart”
“type”: “platformio-debug”,
“request”: “launch”,
“name”: “PIO Debug (skip Pre-Debug)”,
“executable”: “c:/Users/bbeliveau/Documents/PlatformIO/Projects/191105-101542-hello-world/.pio/build/esp wrover kit/firmware.elf”,
“toolchainBinDir”: “C:/Users/bbeliveau/.platformio/packages/toolchain-xtensa32/bin”,
“internalConsoleOptions”: “openOnSessionStart”

And if I look at the debug console, I get what I have shown in my first post, which says that my device is not found. If you look at my previous post, the VID/PID on the board seem to be OK.

I’m up to date with VSCode and PlatformIO. I set my PIO account. What am I doing wrong?

Thanks in advance.

As @manuelbl said, since the error is “no device found”, it seems you haven’t used Zadig to change the FTDI drivers to WinUSB, as it’s said in multiple threads across this forum. See overview at Error: libusb_open() failed when trying to debug - #2 by maxgerhardt

Arggggg. That was it maxgerhardt, I did not run Zadig.
But now it’s working.
Sorry for this and thanks for your help!

1 Like