A
Arduino•2w ago
witherved

ESP32 Upload Code Error

Hi there, i'm a beginner with microcontrollers and recently got my hands on two ESP32 boards by Elegoo. I wanted to make a wireless controller by having one ESP32 read some values from joystick modules and buttons, and send them over to the slave ESP32 to help control some computer movements. As I was working with the Master ESP32 to try and send over ESPNOW protocol, suddenly no code would upload to the ESP32. I would get two errors, either: A fatal error occurred: Write failed, the written flash region is empty. or A fatal error occurred: MD5 of file does not match data in flash! I tried searching a lot of websites and videos, but still to no avail. I tried erasing the esp flash and resetting it to factory settings, and even checked the flash id, which all showed up fine. I ran multiple esptool cleanups and even tried flashing the bootloader and partitions manually to the board, but still nothing. I ran these esptool commands: python -m esptool --chip esp32 --port COM3 --baud 115200 --after hard_reset erase_flash python -m esptool --port COM15 write_flash_status --non-volatile 0 When i open the serial port, this is all it says: rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) invalid header: 0xffffffff invalid header: 0xffffffff invalid header: 0xffffffff invalid header: 0xffffffff invalid header: 0xffffffff invalid header: 0xffffffff invalid header: 0xffffffff It may have been that i did some really bad wiring and damaged the ESP32, but im still really lost in the dark with what to do next. Is the flash corrupted / broken? Is my ESP32 totally cooked? Can i still salvage the ESP32 or was there some hardware damage leaving it totally bricked? I really appreciate any help i can get as i'm still learning! šŸ™
53 Replies
…Aarav…
…Aarav…•2w ago
I can tell you that yo ur esp is most likely NOT cooked, that just means the code did not upload correctly. Erase the flash and try a simpler code. And, what ide are you using ? The ā€œinvalid headerā€ from my experiences means that the code has not been properly uploaded. ESP now is an hard and advanced process, so they are many things that could have gone wrong, and I’m not advanced enough to help you with esp now, so I recommend on both esp try an simpler code šŸ§‘ā€šŸ’»
witherved
withervedOP•2w ago
i’m using Arduino IDE with the ESP32 board manager thing after the error occurred i just uploaded a simple blink sketch with using the onboard led from gpio pin 2 but it still wouldn’t work i tried with my other esp32 and it worked perfectly fine with the same wire and exact same setup
…Aarav…
…Aarav…•2w ago
Have you tried clearing the cache again using pytool? Try using an external led if you have any
witherved
withervedOP•2w ago
sorry for the late response, it was getting a bit late for me ill try that today and see how it goes by erasing the cache do you mean running the esptool erase flash again? i did python -m esptool --chip esp32 --port COM4 erase-flash
…Aarav…
…Aarav…•2w ago
Yes
witherved
withervedOP•2w ago
ok i just ran that again and tried to upload a blink skech with external led but it just wont upload i still get the A fatal error occurred: MD5 of file does not match data in flash!
…Aarav…
…Aarav…•2w ago
Try an different language like thonny for micropyrhon
witherved
withervedOP•2w ago
ok ill download and set up micropython and then see how it goes uhhh i cant download micropython firmware onto the esp32 it just gives me the same error? it says Writing at 0x001a5dcc... (100 %) Wrote 1734416 bytes (1137583 compressed) at 0x00001000 in 100.4 seconds (effective 138.1 kbit/s)... File md5: bc509ac9a635ce283c96bba2843d011d Flash md5: 18c18a9347b2dcd01ac09ea394c1fee4 MD5 of 0xFF is fc048a55a6aa49b11e2b0315f89d144e A fatal error occurred: MD5 of file does not match data in flash! Command returned with error code 2
…Aarav…
…Aarav…•2w ago
What editor did you use? Thonny works best Did you just upload the code or install Micropython firmware too? Can you send me the Micropython code you used ?
witherved
withervedOP•2w ago
i downloaded thonny to try and make a blink code but while i was trying to download the firmware i got the error above i didnt write any code whatsoever
…Aarav…
…Aarav…•2w ago
Did you go to interpreter , select the com port and then click esp then select install Micropython firmware?
witherved
withervedOP•2w ago
yeah so i selected the port here
No description
witherved
withervedOP•2w ago
and then i pressed the install micropython
witherved
withervedOP•2w ago
No description
witherved
withervedOP•2w ago
with all of these
…Aarav…
…Aarav…•2w ago
Did the firmware install or did it fail?
witherved
withervedOP•2w ago
it wrote to 100% and then failed :( its still this error unfortunately 😭😭 File md5: bc509ac9a635ce283c96bba2843d011d Flash md5: 18c18a9347b2dcd01ac09ea394c1fee4 MD5 of 0xFF is fc048a55a6aa49b11e2b0315f89d144e A fatal error occurred: MD5 of file does not match data in flash!
…Aarav…
…Aarav…•2w ago
Signs it’s flash hardware damage • Flashing always fails with MD5 mismatch even after erase_flash and lowering baud rate. • Flashing ā€œsucceedsā€ sometimes but the ESP32 won’t boot into MicroPython. • Random verification errors with different firmware files, not just one .bin. • The MD5 check shows completely different numbers each time you retry. Try different usb ports, installing and reinstalling drivers, a different DATA TYPE usb cable.
witherved
withervedOP•2w ago
nooooooo damn i mightve messed up the wiring bad on my project then ill try those but if it is hardware damage i think its just cooked thank you so much for all the help you've given though!!!
…Aarav…
…Aarav…•2w ago
Your welcome!
witherved
withervedOP•2w ago
i genuinely appreciate it and its given me a lot of clarity i cant thank you enough and now i know to make sure to keep an eye on power sources and that lol but tysm!
…Aarav…
…Aarav…•2w ago
I recommend an multimeter, even a cheap 9$ one, it can prevent cooking things easily But first, make sure even if your cable supports data transfer in the first place, it might be loose or broken
witherved
withervedOP•2w ago
okok ill work on replacing it and getting a better data transfer cable ill try to scavenge my house to see if i have a multimeter
…Aarav…
…Aarav…•2w ago
K
witherved
withervedOP•2w ago
but ill def be considering buying it
…Aarav…
…Aarav…•2w ago
https://a.co/d/4lLlr0x this is the one I have
AstroAI Multimeter Tester
The AstroAI multimeter is designed to be safely and accurately used by professionals in a commercial setting or weekend DIYer's that need a little more power utility from their standard digital multimeter. It's easy and safe to operate with advanced features built for measuring seemingly everything.
…Aarav…
…Aarav…•2w ago
It’s on sale rn
…Aarav…
…Aarav…•2w ago
https://a.co/d/1aqqqdr and this is the cheapest one you can get that is still and decent quality
AstroAI Digital Multimeter - Versatile and Accurate Electrical Tester
AstroAI AM33B Digital Multimeter is the perfect instrument to test & troubleshoot a variety of commercial and household electrical problems.
…Aarav…
…Aarav…•2w ago
I don’t know what area your in, these might not be available there
witherved
withervedOP•2w ago
ah yeah im based in canada and ion think the cheaper one is available maybe if i get a lil bit deeper into microcontrollers ill invest in the one above otherwise ill check out my nearby electronic stores and etc for cheaper ones
…Aarav…
…Aarav…•2w ago
Well there cheap where I live 🤣
witherved
withervedOP•2w ago
šŸ˜‚ imma see then but rip that one esp
…Aarav…
…Aarav…•2w ago
K And btw, in my opinion elegoo boards are not better than normal Esp32s, just more expensive. Just an fyi
witherved
withervedOP•2w ago
oh okay ill keep that in mind if i ever wanna buy another one on amazon there was the freenove one but i was like quite a lot more expensive which is why i got the elegoo one
…Aarav…
…Aarav…•2w ago
Just get cheap made ones from china They work good enough and they like 4 usd each Prob around 6-7 cad
witherved
withervedOP•2w ago
alibaba and temu here i come
…Aarav…
…Aarav…•2w ago
From Amazon
witherved
withervedOP•2w ago
o
…Aarav…
…Aarav…•2w ago
But I guess there is no tariffs I ca
witherved
withervedOP•2w ago
almost two week delivery šŸ’€
…Aarav…
…Aarav…•2w ago
Make sure the board you get has soldered pins lol
witherved
withervedOP•2w ago
yeah i havent learned sodering yet so if it isnt im cooked
…Aarav…
…Aarav…•2w ago
Same I’m beginner too šŸ’€
witherved
withervedOP•2w ago
oh what?!! you seem hella knowledgable on all this stuff
…Aarav…
…Aarav…•2w ago
I had an similar problem so I have an solution and I do search Thank you though šŸ¤“
witherved
withervedOP•2w ago
lol but its nice to know i wasnt alone in this type of scenario
…Aarav…
…Aarav…•2w ago
🤣
witherved
withervedOP•2w ago
is it ok to just leave this post open? or is it gonna get closed / resolved
…Aarav…
…Aarav…•2w ago
You can leave it open An mod can come an close or If you need more help just say, with the solutions I sent Well bye bye random person I found in the internet

Did you find this page helpful?