My code will not be uploaded to ESP32

Hello, I recently bought an ESP32 and I tried to upload a very simple LED blinking code on it, but it will keep saying "A fatal error occurred: MD5 of file does not match data in flash!", Here is the output :

Sketch uses 236793 bytes (18%) of program storage space. Maximum is 1310720 bytes.
Global variables use 21048 bytes (6%) of dynamic memory, leaving 306632 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM9
Connecting......................
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 08:3a:f2:8e:f4:18
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
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 0x00049fff...
Compressed 18992 bytes to 13112...
Writing at 0x00001000... (100 %)
Wrote 18992 bytes (13112 compressed) at 0x00001000 in 0.2 seconds (effective 685.1 kbit/s)...
File md5: 03b32c0cabcc0c857bc2ae029a696d68
Flash md5: 9bf41660b46cff96b6a7a5ae5181bb58
MD5 of 0xFF is fb0d8f08f299b9d5a5a87d75bdfef241

A fatal error occurred: MD5 of file does not match data in flash!
Failed uploading: uploading error: exit status 2.

I think that means your ESP32 board is faulty. Return it for a replacement.

I don't think.

You don't think what?

If you think the board is not faulty, what do you think the problem is?

I moved your topic to an appropriate forum category @randombacon.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

software

What software?

Don't you think such a severe fault would have been discovered and fixed by now?

Many forum members here use ESP32 boards frequently. Such a severe problem would have been discussed many times, but I'm not aware that it has been.

I use "ESP32 dev bd.", the generic at the top of the list.

i tried the cmd esptool.py method but it wont work

maybe you are right

i burned the bootloader through arduino ide and it wont work

i found a picture with a title with the same error and it includes a magnified esp32 chip with shorted pins

Here is something to try:

i tried it several times and it wont also work (btw i'm on windows)

What command did you try on windows? Did you get an error message?

when i did the hard reset, no error showed

Maybe you could try at a lower baud rate.

I once faced the same error and here is a command ( executed on CMD) that got the board back to life

<ESP32_core_path>/esptool.exe --chip esp32 --port <port_number> write_flash_status --non-volatile 0

eg: C:\Users\KASSIMSAMJI\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\3.3.0/esptool.exe --chip esp32 --port COM256 write_flash_status --non-volatile 0

2 Likes

WOW! that was really helpful and solved my problem!
Perfect! Thanks

It works for me. Thanks a lot!