I’ve just attempted to cloud-update my ESP8266-12 module from AI Thinker and something went wrong. The blue LED on my module started blinking and the module would not respond to any commands. When I connected to it via a serial adapter, all I could see was gibberish.
I suspected there was a partial firmware update that left it corrupted and the module was stuck in the
bootloader, resetting itself over and over. Using cu
with the bootloader’s magic baud rate (76800) confirmed
that hypothesis:
$ sudo cu -l /dev/tty.usbserial-A6028AYX -s 76800
wdt reset
load 0x40100000, len 25052, room 16
tail 12
chksum 0x0b
ho 0 tail 12 room 4
load 0x3ffe8000, len 3312, room 12
tail 4
chksum 0x53
load 0x3ffe8cf0, len 6576, room 4
tail 12
chksum 0x0d
csum 0x0d
Fatal exception (0):
epc1=0x402411b4, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
Fortunately, the bootloader appeared to be intact, which means we could attempt a restore. First, you need to get ahold of esptool, which is a python script that interacts with the module and can reflash the firmware.
Next, you’ll need to download the firmware you’d like to flash – in my case I’ve downloaded it from the Electrodragon Wiki.
After you have both pieces, you’ll need to wire the module for reflashing:
GPIO15 <-> GND
GPIO2 <-> VCC
GPIO0 <-> GND
It is advisable to connect these through a 10k Ohm resistor. Once that is done, you’ll need to reset the module and issue the following command.
./esptool.py --baud 76800 --port /dev/tty.usbserial-A6028AYX write_flash \
0x00000 AI-v0.9.5.0\ AT\ Firmware.bin
Connecting...
Erasing flash...
Writing at 0x0007ec00... (100 %)
Leaving...
After approximately 30 seconds you’ll have a module that is as good as new.