PlatformIO Community

Can't debug with esp32

Hi, I’m using esp32-ethernet-kit v1.0 board for developing. When I try to debug it, after compilation is finished a window shows up saying “failed to launch GDB: Error: write EPIPE” and the debug console shows “Could not start debugger process > Error: spawn platformio ENOENT”. Does anyone know how to solve my problem?

Duplicate of Cannot debug STM32: "Failed to launch GDB: Error: write EPIPE" (the second one now)

I’ve reversed my platformio version to 2.1.0 and now there is another problem.

After compilation it will wait for a long time and an error window shows up saying “failed to launch GDB: .pioinit:11: Error in sourced command file: Remote replied unexpectedly to ‘vMustReplyEmpty’ timeout”

Here is the message from debug console

undefinedOpen On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: libusb_open() failed with LIBUSB_ERROR_NOT_FOUND
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description ‘’, serial '’ at bus location ‘*’
Warn : Flash driver of drom does not support free_driver_priv()
Reading symbols from c:\Users\rui\Documents\Data\Code\PlatformIO\MicroPythonEmbedded.pio\build\esp-wrover-kit\firmware.elf…
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target…
Ignoring packet error, continuing…
warning: unrecognized item “timeout” in “qSupported” response
Ignoring packet error, continuing…
.pioinit:11: Error in sourced command file:
Remote replied unexpectedly to ‘vMustReplyEmpty’: timeout

I’m using windows 10.

Have you used Zadig to replace the USB drivers for your debug probe as shown in https://medium.com/@manuel.bl/low-cost-esp32-in-circuit-debugging-dbbee39e508b? Can you show the exact platformio.ini and your JTAG debug probe that you have you connected to your board? – Okay the debug probe is a built-in FTDI FT2232H, so no external hardware needed. Double check Zadig.

I replaced the USB drivers and another error shows up which is failed to launch GDB: .pioinit: 13 Remote communication error.

Here is my platformio.ini

[env:esp-wrover-kit]
platform = espressif32
board = esp-wrover-kit
framework = espidf
upload_speed = 115200
monitor_speed = 115200
upload_port = com6
debug_tool = esp-prog

The board is esp32-ethernet-kit v1.2 instead of v1.0

The board has a set of jumpers labeled “J7”. The connections must be jumpered so that the FTDI’s JTAG pins are physically connected to the ESP32’s GPIO pins.
grafik

Are these all these jumpers in place / set in ON?

If yes, please open a command shell (Windows + R, cmd.exe) and execute these two commands

cd C:\Users\rui\.platformio\packages\tool-openocd-esp32
bin\openocd.exe -s C:\Users\rui\.platformio\packages\tool-openocd-esp32\share\openocd\scripts -f interface\ftdi\esp32_devkitj_v1.cfg -f board\esp32-wrover.cfg

that should attempt to start openocd and give detailed error messages.

EDIT: correct paths.

Fixed in Cannot debug STM32: "Failed to launch GDB: Error: write EPIPE"

Hi, I’ve updated pio version to 2.1.3 and when I try to launch debug the error becomes “.pioinit: 13” “Target disconnected.: Not a directory”.

I’ve executed the two commands and here are the error messages

Open On-Chip Debugger  v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Listening on port 3333 for gdb connections
Info : esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).

I’ve turned the four switches of J7 to On position.

**EDIT:**I executed the two commands again and the messages are different:

Open On-Chip Debugger  v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
shutdown command invoked
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()