PlatformIO and VScode. Error: unable to open ftdi

Some days ago I started working with an Freenove ESP32-wrover module and the Arduino IDE. I was able to to do some nice things without bigger problems.

Now, code size and complexity increases and I decided to move to VS-code and PlatformIO. Here my setup:

  • latest VS code (1.108.1) and PlatformIO (core 6.1.18; Home: 3.4.4) version.
  • Freenova ESP32-WROVER-E module
  • JTAG via esp-prog; driver installed from FTDI and ZADIG 2.9
  • All the stuff on a breadboard with ~ 20cm cables.

Installation was flawless, but I’m not able to start a debugging session. The drivers are visible in the device manager, nothing suspect. After days of finding a solution, I’m frustrated. The debuger claims not to find the esp-prog (vid 0403, pid 6010), but it is installed and several times unsinstalled and reinstalled. What is wrong here?

Any help is highly appreciated…

Here the dubugger console output:

Reading symbols from D:\Dokumente\PlatformIO\Projects\MyBlinky\.pio\build\freenove_esp32_wrover\firmware.elf...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.11.0-esp32-20220706 (2022-07-06-15:48)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
         If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
adapter speed: 500 kHz

Info : tcl server disabled
Info : telnet server disabled
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'

.pioinit:11: Error in sourced command file:
Remote communication error.  Target disconnected.: Success.

Okay. Post a screenshot of Zadig with the esp-prog device selected (Dual RS232-HS (Interface 0) ) that shows you have loaded WInUSB drivers, per source.

here it is…

Try loading libusb drivers for this device instead using Zadig.

No difference… :frowning:

With the same error message in the debug console though?

Yes, identical output.

There is an tool at FTDI website called “microsoft USBview” to identify all connected USB devices.

Mayby someone could run this and post the result here? I’m not sure if it helps, but I have no further ideas :frowning:

There must be a reason that esp-prog is not detected by PlatformIO. Maybe a bug???

Here is my result

Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x0403 (Future Technology Devices International Limited)
idProduct: 0x6010
bcdDevice: 0x0700
iManufacturer: 0x01
0x0409: “FTDI”
iProduct: 0x02
0x0409: “Dual RS232-HS”
0x0409: “Dual RS232-HS”
0x0409: “Dual RS232-HS”
iSerialNumber: 0x00
bNumConfigurations: 0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: High
Device Address: 0x04
Open Pipes: 4

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x83 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x04 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Configuration Descriptor:
wTotalLength: 0x0037
bNumInterfaces: 0x02
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0x80 (Bus Powered )
MaxPower: 0xFA (500 Ma)

Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0xFF
bInterfaceSubClass: 0xFF
bInterfaceProtocol: 0xFF
iInterface: 0x02
0x0409: “Dual RS232-HS”
0x0409: “Dual RS232-HS”
0x0409: “Dual RS232-HS”

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Interface Descriptor:
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0xFF
bInterfaceSubClass: 0xFF
bInterfaceProtocol: 0xFF
iInterface: 0x02
0x0409: “Dual RS232-HS”
0x0409: “Dual RS232-HS”
0x0409: “Dual RS232-HS”

Endpoint Descriptor:
bEndpointAddress: 0x83 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x04 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Another debug output is this. Maybe helpfull…

undefined C:\Users\……\.platformio\packages\toolchain-xtensa-esp32\bin\xtensa-esp32-elf-gdb.exe: warning: Couldn’t determine a path for the index cache directory.

That should not happen. Maybe something is interfering on your Windows system.

Use a virtual machine (e.g. VirutalBox or VMWare), install a standard Ubuntu in it, install VSCode and PlatformIO in it, recreate the project, forward the esp-prog USB device into the virtual machine and try again.

Puhh, that seems to be above my capablities…

any other idea?

Sure. Ask Espressif for help at https://esp32.com/ or https://github.com/espressif/openocd-esp32/issues.

I created a new user (named ESP) and installed all packages from the scratch. After that I’m still not able to start the debugger, I’m slowly going crazy when I can’t continue working.

@maxgerhardt is there any web page which leads me through the VirtualBox stuff etc. ?

OK, here my final attempt.

I changed my Window SSD with a brand new one and installed Win11 from the scratch. A complete clean new installation. AT the moment, I have only firefox, Thunderbird and VSCode with PlatformIO installed. Nothing else!!!

What I tested until today:

  • 3 different ESP32 modules from different vendors
  • 2 ESP-PROG modules
  • and finally a new windows setup

That’s the disappointing result. I’m now at the end of my knowledge. Seems the ESP32 platform is not usable for me :frowning:

undefinedC:\Users\xxxxx\.platformio\packages\toolchain-xtensa-esp32\bin\xtensa-esp32-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.

Reading symbols from C:\Users\xxxxx\Documents\PlatformIO\Projects\Test\.pio\build\esp32dev\firmware.elf...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.11.0-esp32-20220706 (2022-07-06-15:48)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
adapter speed: 5000 kHz

Info : tcl server disabled
Info : telnet server disabled
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : clock speed 5000 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
Error: Unexpected OCD_ID = ffffffff
Warn : target esp32.cpu0 examination failed
Error: Unexpected OCD_ID = ffffffff
Warn : target esp32.cpu1 examination failed
Info : starting gdb server for esp32.cpu0 on pipe
Info : accepting 'gdb' connection from pipe
Error: Target not examined yet
Error executing event gdb-attach on target esp32.cpu0:

Warn : No symbols for FreeRTOS!
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
.pioinit:11: Error in sourced command file:
Remote communication error.  Target disconnected.: Success.

This is actually very good. It has successfully connected to the FTDI using the right driver, but the connection between the FTDI (espprog) and the ESP32 fails. Usually this error message means:

  • a cable is not correctly connected
  • a cable is too long and the debug_speed is too high. Try debug_speed = 500 in your platformio.ini for a slower speed of 500 kHz.
  • you are using one of the JTAG pins as GPIO in your sketch (e.g., to blink an LED)

The aforementioned https://medium.com/@manuel.bl/low-cost-esp32-in-circuit-debugging-dbbee39e508b article has everything, the exact wiring and an example sketch. Can you replicate this exactly?

I checked all your advices.

I reinstalled win11 again on a new SSD and insatlled VSCode, and PlatformIO.

Installed original FTDI driver from the FTDI website, and changed RS232 interface 0 to Zadig driver.

Used this platformio.ini:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

debug_tool = esp-prog
debug_init_break = tbreak setup
debug_speed = 100


The source:

#include <Arduino.h>

// put function declarations here:
int myFunction(int, int);

void setup() {
  // put your setup code here, to run once:
  int result = myFunction(2, 3);
}

void loop() {
  // put your main code here, to run repeatedly:
}

// put function definitions here:
int myFunction(int x, int y) {
  return x + y;
}

The output:

undefinedC:\Users\xxxxxxx\.platformio\packages\toolchain-xtensa-esp32\bin\xtensa-esp32-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.

Reading symbols from C:\Users\xxxxxx\Documents\PlatformIO\Projects\Test\.pio\build\esp32dev\firmware.elf...
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.11.0-esp32-20220706 (2022-07-06-15:48)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
adapter speed: 100 kHz

Info : tcl server disabled
Info : telnet server disabled
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : clock speed 100 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
Error: Unexpected OCD_ID = ffffffff
Warn : target esp32.cpu0 examination failed
Error: Unexpected OCD_ID = ffffffff
Warn : target esp32.cpu1 examination failed
Info : starting gdb server for esp32.cpu0 on pipe
Info : accepting 'gdb' connection from pipe
Error: Target not examined yet
Error executing event gdb-attach on target esp32.cpu0:

Warn : No symbols for FreeRTOS!
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
.pioinit:11: Error in sourced command file:
Remote communication error.  Target disconnected.: Success.

My setup:

Try to power the ESP32 separetly, with its own USB cable, and remove the 3V3 ↔ 3V3 connection between the ESP prog and the ESP32.

Tried this of course. No difference..

I found a bug report from 2020 in Github which decribes exactly the same problem. Unfortunetally without solution.