I have been working on this platformio project with little debugging issues and now I cannot start the debugger.
Error: timed out while waiting for target halted
timed out while waiting for target halted
Info : [esp32.cpu0] Target halted, PC=0x400905A0, debug_reason=00000000
Error: xtensa_wait_algorithm: not halted 0, pc 0x400905a0, ps 0x60025
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!
[esp32.cpu0] Target halted, PC=0x400905A0, debug_reason=00000000
xtensa_wait_algorithm: not halted 0, pc 0x400905a0, ps 0x60025
Failed to wait algorithm (-302)!
Algorithm run failed (-302)!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Info : PROF: Erased 20480 bytes in 97.742 ms
Target is already running an algorithm
Failed to start algorithm (-4)!
PROF: Erased 20480 bytes in 97.742 ms
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Info : PROF: Wrote 20480 bytes in 97.738 ms (data transfer time included)
Target is already running an algorithm
Failed to start algorithm (-4)!
PROF: Wrote 20480 bytes in 97.738 ms (data transfer time included)
** Programming Finished in 40743 ms **
** Verify Started **
** Programming Finished in 40743 ms **
** Verify Started **
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Info : PROF: Flash verified in 98.858 ms
Error: **** Verification failure! ****
Error: target_hash cf09e...000
Error: file_hash: 089ef...d8a9c7
Target is already running an algorithm
Failed to start algorithm (-4)!
PROF: Flash verified in 98.858 ms
**** Verification failure! ****
target_hash cf09e...000
file_hash: 089ef...d8a9c7
** Verify Failed **
.pioinit:12: Error in sourced command file:
Protocol error with Rcmd
I have tried erasing flash, rebuilding, deleting .cache amd .pio directories, restarting PIO. None of the usual things that get debugging running again are working now.
Please show the content of your Platformio.ini so that we can at least get some information. Also name the exact board you are using and which GPIO’s components are connected to. With this information someone from the forum might be able to help you.
I am using a modiffied ESP32-POE-ISO board. I swapped Ethernet Power from GPIO12 to GPIO33 so I could use the TDI signal. It has worked without issue on a few boards. Here is my .ini file:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter, extra scripting
; Upload options: custom port, speed and extra flags
; Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/en/stable/projectconf.html
;
; *********************************************************************
; *** Selection of Tasmota build variant is done with VSC
; *** alternatively can be done in: platformio_override.ini
; *** See example: platformio_override_sample.ini
; *********************************************************************
[platformio]
description = Provide ESP8266 / ESP32 based devices with Web, MQTT and OTA firmware
src_dir = tasmota
lib_dir = lib/default
boards_dir = boards
build_cache_dir = .cache
extra_configs = platformio_tasmota32.ini
platformio_tasmota_env.ini
platformio_tasmota_env32.ini
platformio_override.ini
platformio_tasmota_cenv.ini
[common]
platform = ${core.platform}
platform_packages = ${core.platform_packages}
framework = arduino
board = esp8266_1M
board_build.filesystem = littlefs
board_build.variants_dir = variants/tasmota
custom_unpack_dir = unpacked_littlefs
build_unflags = ${core.build_unflags}
build_flags = ${core.build_flags}
monitor_speed = 115200
monitor_echo = yes
; *** Upload Serial reset method for Wemos and NodeMCU
upload_resetmethod = nodemcu
check_skip_packages = yes
extra_scripts = ${esp_defaults.extra_scripts}
lib_archive = no
lib_ldf_mode = chain
lib_compat_mode = strict
shared_libdeps_dir = lib
lib_extra_dirs =
lib/lib_basic
lib/lib_i2c
lib/lib_display
lib/lib_ssl
lib/lib_audio
lib/lib_rf
lib/lib_div
[tasmota]
; Uncomment if you do NOT want gzipped map file(s)
;disable_map_gz = 1
; Uncomment and specify a folder where to place the map file(s) (default set to folder build_output)
;map_dir = /tmp/map_files/
; Uncomment if you do NOT want additionally gzipped firmware file(s) at all
;disable_bin_gz = 1
; Uncomment if you want additionally gzipped esp32x firmware file(s)
;enable_esp32_gz = 1
; Uncomment and specify a folder where to place the firmware file(s) (default set to folder build_output)
;bin_dir = /tmp/bin_files/
; Global build flags (used for all env) can be overridden in "platformio_override.ini"
build_unflags =
build_flags =
[scripts_defaults]
extra_scripts = pre:pio-tools/pre_source_dir.py
pre:pio-tools/set_partition_table.py
pre:pio-tools/override_copy.py
pre:pio-tools/compress-html.py
post:pio-tools/strip-flags.py
[esp_defaults]
extra_scripts = post:pio-tools/name-firmware.py
post:pio-tools/gzip-firmware.py
post:pio-tools/metrics-firmware.py
post:pio-tools/custom_target.py
; post:pio-tools/obj-dump.py
${scripts_defaults.extra_scripts}
; *** remove undesired all warnings
build_unflags = ${tasmota.build_unflags}
-Wall
; -mtarget-align
-Wdeprecated-declarations
build_flags = ${tasmota.build_flags}
-DCORE_DEBUG_LEVEL=0
-Wl,-Map,firmware.map
-Wno-deprecated-declarations
; -mno-target-align
-mtarget-align
-free
-fipa-pta
-Wreturn-type
-DTASMOTA ; flag indicating that we are compiling Tasmota
; *********************************************************************
; *** Use custom settings from file user_config_override.h
-DUSE_CONFIG_OVERRIDE
; *********************************************************************
[esp82xx_defaults]
extra_scripts = ${esp_defaults.extra_scripts}
build_flags = ${esp_defaults.build_flags}
-DNDEBUG
-DFP_IN_IROM
-DBEARSSL_SSL_BASIC
; NONOSDK22x_190703 = 2.2.2-dev(38a443e)
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
-DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH -DUSE_IPV6 ; enables IPv6
; VTABLES in Flash
-DVTABLES_IN_FLASH
; remove the 4-bytes alignment for PSTR()
-DPSTR_ALIGN=1
; restrict to minimal mime-types
-DMIMETYPE_MINIMAL
; uncomment the following to enable TLS with 4096 RSA certificates
;-DUSE_4K_RSA
lib_ignore = ESP8266Audio
ESP8266SAM
ESP8266LLMNR
ESP8266NetBIOS
ESP8266SSDP
ESP8266WiFiMesh
GDBStub
ESP8266HTTPUpdateServer
SPISlave
Hash
; Disable next if you want to use ArduinoOTA in Tasmota (default disabled)
ArduinoOTA
[core]
; *** Esp8266 Tasmota modified Arduino core based on core 2.7.4. Added Backport for PWM selection
platform = https://github.com/tasmota/platform-espressif8266/releases/download/2024.09.00/platform-espressif8266.zip
platform_packages =
build_unflags = ${esp_defaults.build_unflags}
build_flags = ${esp82xx_defaults.build_flags}
; *** Use ONE of the two PWM variants. Tasmota default is Locked PWM
;-DWAVEFORM_LOCKED_PHASE
-DWAVEFORM_LOCKED_PWM
The only changes were adding the 2 GPIO and their ISRs. If I revert back to a previous commit I’m fairly confident that it will work. Debugging had generally been working without issue for a few months on this project.
I recently installed updates for Visual Code and PIO and I wonder if that has anything to do with it.
I have not seen the algorithm error before when starting debugging. I might also try removing just the ISRs and see if it will start the debugger.
I found the problem. I removed the ISRs and I was able to start the debugger again. I put the ISRs back and the error returned. I did some reading and found that the ESP32 GPIO ISR can only support one edge interrupt. I then changed the ISRs from:
I wish I could get some insight into what these errors are:
** Programming Started **
** Programming Started **
Error: timed out while waiting for target halted
timed out while waiting for target halted
Info : [esp32.cpu0] Target halted, PC=0x4000C341, debug_reason=00000000
Error: xtensa_wait_algorithm: not halted 0, pc 0x4000c341, ps 0x60025
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!
[esp32.cpu0] Target halted, PC=0x4000C341, debug_reason=00000000
xtensa_wait_algorithm: not halted 0, pc 0x4000c341, ps 0x60025
Failed to wait algorithm (-302)!
Algorithm run failed (-302)!
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Info : PROF: Erased 20480 bytes in 101.728 ms
Target is already running an algorithm
Failed to start algorithm (-4)!
PROF: Erased 20480 bytes in 101.728 ms
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Info : PROF: Wrote 20480 bytes in 104.366 ms (data transfer time included)
Target is already running an algorithm
Failed to start algorithm (-4)!
PROF: Wrote 20480 bytes in 104.366 ms (data transfer time included)
** Programming Finished in 40740 ms **
** Verify Started **
** Programming Finished in 40740 ms **
** Verify Started **
Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!
Info : PROF: Flash verified in 96.749 ms
Error: **** Verification failure! ****
Error: target_hash bce89e...000
Error: file_hash: 089ef...d8a9c7
Target is already running an algorithm
Failed to start algorithm (-4)!
PROF: Flash verified in 96.749 ms
**** Verification failure! ****
target_hash bce89e...000
file_hash: 089ef...d8a9c7
** Verify Failed **
.pioinit:12: Error in sourced command file:
Protocol error with Rcmd