Error ESP32 PROG

Hi,
had this bunch of problems too.

One possibility to resove this issue:

eading symbols from C:\Users\js\Documents\PlatformIO\Projects\ESP32_BreadboardDisplay.pio\build\wemos_d1_mini32_debug\firmware.elf…
PlatformIO Unified Debugger → Redirecting...
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
OpenOCD: Bug Reporting
adapter speed: 20000 kHz

In my case “wemos_d1_mini32”-board:

  1. Check, if your controller was not preloaded with code, which is using ESP32-GPIOs 12, 13,14,15. i.e. SPI-Settings etc.

→ Debugger will not run (see err-message above) !
→ specially launching this annoying “pioinit failure”-messagebox pointing to lauch.json!

  1. To avoid this issue, load i.e. the basic Blink-sample as dummy to overwrite the previous pin settings.

  2. Launch the debugger => runs!

  3. The message "Error: libusb_open() failed with “LIBUSB_ERROR_NOT_SUPPORTED” has to be regarded only as Info and is not the reason the debugger fails!

  4. Make shure, that there is no hardware connectetd to GPIOs 12, 13,14,15 !
    This may cause major instabillity launching the debugger…

  5. Touching by code (mostly in testphase!) in any way the debugger pins will result in crash or denial to restart the debug process :sleepy:.

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

To resolve that: Start 2nd VS/PIO-instance and upload the blinky sketch, you gain again control to run the debugger. For some reason the OpennOCD-Debug is not capable to overwrite destructive setups by resetting the device.

Unfortunately there is no meaningful information out there about this “strange” behavior, regarding this “feature” specially for newcomers.

The supplied error-messages, from debugger or PIO are really not helpful, too.

This is my working platform.ini:

[platformio]
default_envs = wemos_d1_mini32_debug*
#default_envs = wemos_d1_mini32*

[env]*
build_flags =
#-v
-D VERSION=1.2.3
-D DEBUG=1
-D LED_BUILT_IN=2

lib_deps = 		

###########################################
[env:wemos_d1_mini32]
platform = espressif32
board = wemos_d1_mini32
framework = arduino
lib_deps = ${env.lib_deps}

monitor_speed = 115200
upload_port = COM6
upload_protocol = esptool

###########################################*
[env:wemos_d1_mini32_debug]
platform = espressif32
board = wemos_d1_mini32 #esp32dev #
framework = arduino
build_type = debug
build_flags = -D DEBUG
lib_deps = ${env.lib_deps}
monitor_speed = 115200

;-- GeräteManager \USB-Geräte\DualRS232HS 1+2
debug_tool		= 	esp-prog 
debug_init_break 	= 	tbreak setup

upload_port 		=  	COM12  #second ftdi channel
upload_protocol 	=  	esp-prog
upload_speed 	=  	460800  ; 115200;921600

Hope this helps … :wink: