Page 1 of 1

A fatal error occurred: MD5 of file does not match data in flash!

Posted: Sun Apr 07, 2024 7:16 pm
by JosephWheel
I'm working with a ESP32-CAM. I upload the sketches with a development board (see image below).
a.jpeg
a.jpeg (94.71 KiB) Viewed 2118 times
When I try to upload the following program in PlatformIO:

Code: Select all

#include<Arduino.h>

void setup() {
    Serial.begin(115200);
}

void loop() {
    Serial.println("hola.");
    delay(500);
}
I get the following error:

Code: Select all

Checking size .pio\build\sicabs_outdoor_esp32cam\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  10.5% (used 34528 bytes from 327680 bytes)
Flash: [==        ]  20.4% (used 641117 bytes from 3145728 bytes)
Building .pio\build\sicabs_outdoor_esp32cam\firmware.bin
esptool.py v4.5.1
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
Configuring upload protocol...
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 = esptool
Looking for upload port...
Using manually specified: COM6
Uploading .pio\build\sicabs_outdoor_esp32cam\firmware.bin
esptool.py v4.5.1
Serial port COM6
Connecting....
Chip is ESP32-D0WDQ6 (revision v1.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 08:f9:e0:e3:de:2c
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x000acfff...
Compressed 17536 bytes to 12203...
Writing at 0x00001000... (100 %)
Wrote 17536 bytes (12203 compressed) at 0x00001000 in 1.2 seconds (effective 119.0 kbit/s)...
File  md5: 097cef81c07c9d9963889f5dbbce8a09
Flash md5: 3aaf0450605365cfaa774104a1b9352d
MD5 of 0xFF is f2ff47604992a1a20c08e60337691b70

A fatal error occurred: MD5 of file does not match data in flash!
*** [upload] Error 2
I've already tried with esptool by running the following commands:

Code: Select all

python -m esptool --chip esp32 erase_flash
python -m esptool --port COM6 write_flash_status --non-volatile 0
The first command outputs the following:

Code: Select all

esptool.py v4.7.0
Found 1 serial ports
Serial port COM6
Connecting.....
Chip is ESP32-D0WDQ6 (revision v1.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 08:f9:e0:e3:de:2c
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 0.1s
Hard resetting via RTS pin...
And the second command outputs the following:

Code: Select all

esptool.py v4.7.0
Serial port COM6
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting.....
Detecting chip type... ESP32
Chip is ESP32-D0WDQ6 (revision v1.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 08:f9:e0:e3:de:2c
Uploading stub...
Running stub...
Stub running...
Initial flash status: 0x0000
Setting flash status: 0x0000
After flash status:   0x0000
Hard resetting via RTS pin...
As you can see in the last command, the initial flash status was already in 0x0000, which means I had already tried to reset the flash but I'm still unable to upload a simple sketch.

I've already tried by using the Arduino IDE but I still get the same error (of course removing the #include<Arduino.h> header)
The upload speed is the same (115200 baud).

Is there something I'm missing? Is there something I can check on so that I can find a possible solution to that?

I'd be so thankful for an existing solution. My grad project depends on this and it got to be ready in 4 days, I've already bought 3 ESP32-CAMs and this third one now yields this problem.