Verification error when uploading

My code builds correctly, however I am getting a strange “Verification failure” error when I try to upload to my ESP32.

I am getting this error in two scenarios:

  • When I create a new project now

    • I have created multiple projects which worked before this which worked. When I copy the code or the platform.ini files from those projects and copy them exactly into a new project, I get the error below.
  • When I try to extend one of my previously working projects to use code from a new internal library.

Again, the code builds successfully, but upload results in the shortened/ attenuated following output:

AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esp-prog
Uploading .pio\build\esp32dev\firmware.bin
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
debug_level: 1

adapter speed: 20000 kHz

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

** Programming Started **
** Programming Finished in 6936 ms **
** Verify Started **
Error: **** Verification failure! ****
Error: target_hash f92684...5d7561
Error: file_hash: e56eed...55a650
embedded:startup.tcl:1184: Error: ** Verify Failed **
in procedure 'program_esp'
in procedure 'program_error' called at file "C:/Users/timf3/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 149    
at file "embedded:startup.tcl", line 1184
*** [upload] Error 1

Here is my platform.ini file for context (but note, it still fails with “Verification failure” if I create a new project with no libraries that’s just supposed to print Hello World):

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
debug_tool = esp-prog
upload_protocol = esp-prog
upload_port = COM11
monitor_speed = 9600
lib_deps = 
	waspinator/AccelStepper@^1.64
	adafruit/Adafruit MCP23017 Arduino Library@^2.3.2
	knolleary/PubSubClient@^2.8
	wnatth3/WiFiManager@^2.0.16-rc.2
	bblanchon/ArduinoJson@^6.21.5

How did you connect your ESP32?
Is it connected via an esp-prog adapter or do you use the built-in USB port of the esp32dev-board?

Hi,

Sorry I missed this.

Yes it is connected via an esp-prog adapter. And I am still getting this issue intermittently.

Thanks
Tim