Unable to flash ESP32

So I got myself an ESP32 and flashed it as a bluetooth proxy via the webtools (ESPHome Bluetooth Proxy)

This all worked nicely but then I decided I wanted to redo the device so installed ESP Home docker and have tried to flash it again with an updated definition.

However now the device just won’t flash and things just sit there stuck on preparing installation (I have left it for an hour) and no matter what I try it just won’t flash or respond to just about anything now.

Possibly not the wisest of moves but I attempted to follow a factory resett based on this (ESP32 Factory Reset, Erase EEPROM and Repair Bootloader using Online ESPtool- Most Easiest Way - YouTube) but even when using the Espressif tools it connects but then times out almost instantly

esptool.js v0.1-dev
Serial port WebSerial VendorID 0x10c4 ProductID 0xea60
Connecting.......
Detecting chip type... ESP32
Chip is ESP32-D0WD-V3 (revision 3)
Features: Wi-Fi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: xx:xx:xx:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Changing baudrate to 115200
Changed
Erasing flash (this may take a while)...
Error: Timeout
Erasing flash (this may take a while)...
Error: Timeout
Erasing flash (this may take a while)...
Error: Timeout
Erasing flash (this may take a while)...
Chip erase completed successfully in 0.002s
``
where first timeout was instant, second took about 10 seconds, third was instant and then it instantly told me the erase was complete.

If I look in logs in ESP Home I just get

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
invalid header: 0xffffffff
ets Jul 29 2019 12:21:46

repeated thousands of times with the same timestamp.   I have let it run for about 20 minutes and it is still repeating but it is starting to cause Chrome to lock up due to the size of the log.

Any suggestions on how I can get the controller back into the same state as when it was shipped so I can actually flash it?

How did you try to reflash? OTA? Serial? You should do serial ESPHome 2022.12.0 - 14th December 2022 — ESPHome

Serial (USB). Not sure what I did but I ended up being able to flash it at like the 100th time last night and is working.

I am going to have another play later on to see if I can replicate it (Although may use a spare ESP32 board this time…)

1 Like

If you power it through the serial connection during flashing, then the power might be too unstable and especially the erasing requires a lot of stable power, so that is usually the time of failure.

Did you ever find out how you fixed the issue? I seem to having the same symptoms.

Edit: I plugged a fresh ESP32 in to the computer and it worked as expected. Now I am struggling to “fix” the first one that is giving me these issues.

I think I deleted the build folder from ESP home and it then worked

I have unbricked a few devices with these:

// most basic, always useful
esptool.py erase_flash
// this unbricked a lot of third-party ESP-s which sometimes got a wrong header address at OTA
esptool.py write_flash_status --non-volatile 0
// might be useful
espefuse.py set_flash_voltage 3.3V
// clearly define what to write and where
esptool.py --chip esp32 --baud 921600 --before default_reset --after hard_reset write_flash -z 0x0 xx.bin --flash_mode dio --flash_freq 80m --flash_size detect

Also useful to make sure you have adequate USB power behind it, remove all peripherals from GPIO, and power from high quality source. My Mac dock usb-C to USB sometimes isn’t enough…

2 Likes

Had the same issue when flashing esp32 using esphome flasher. It turned out that the issue was with GPIO12 being connected to to the 3.3V->5V converter. This blocked the boot sequence and as a result flashing was not possible

After breaking the connection on GPIO12 pin - all works like a charm.

Be careful when connecting your GPIO12 to anything…

12 OK OK boot fails if pulled high, strapping pin

Good resource ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials

Hi I recently started learning to use the esp32 and I don’t know why I thought I need to factory reset the devise and from then every time I try to load a code in to it it starts to spam this same prompt and I can’t figure it out why it’s happening
can someone please help me fix it with beginner language because I red in so many places but for the life of me I can’t figure it out
thank you

Maybe it would help to tell what prompt, and how you try to flash the esp32