15 Dec

Firmware Update on an ESP8266

The ESP8266 is an incredibly cheap (as in $3) wifi module for use in embedded projects. A few weeks back I ordered several of these little jems, and have been having lots of fun connecting all sorts of stuff to my LAN. A  couple of weeks ago the manufacturer released an updated firmware build that really increases the stability of the ESP8266, so I spent some time over the weekend upgrading them. It’s not difficult, but there are a few tricks to it.

First, make sure you’re using a 3.3v serial interface. 5v will kill the module. I’m using a 3.3v generic Silicon Labs from Pololu. You can order them here.

Connect the module’s GPIO0 to ground. This puts it into firmware update mode.

Download esptool.py from here. If you don’t already have it installed, you’ll need to install pyserial as well.

<note to=”self”>your copy is in ~/src/pyserial-master</note>

Download the firmware – I’m currently using the version that can be found here.

Unzip the firmware into the same directory as the esptool.py script.

If you’re using a Mac, you might have some issues with the —port option. I wound up hard-coding the /dev/ttyXXX entry for my USB programmer into the script.

<note to=”self”>your programmer is on /dev/tty.SLAB_USBtoUART</note>

Upload the firmware as follows:

./esptool.py write_flash 0x00000 boot_v1.1.bin
./esptool.py write_flash 0x01000 user1.bin
./esptool.py write_flash 0x01000 user1.bin
./esptool.py write_flash 0x7c000 esp_init_data_default.bin
./esptool.py write_flash 0x7e000 blank.bin

If you run into issues, check to see that GPIO0 is pulled low (connected to ground).

You might need to reset the module between each step in the update process. Just unplug and plug-in the ground or power pin.

The new firmware default to 115,200 bps so you might need to adjust you terminal program if the previous version was set to some other baud rate.

Once the update process is complete, unplug the GPIO0 line and reset the module. Test with “AT+GMR” to see what version you have. Should return with:

0020000903

Next, drop the baud rate down to 38,400 bps – a rate that the Arduino can handle. To do that, use the AT+IPR command as follows:

AT+IPR=38400

Now adjust the terminal program and test with “AT” to make sure its working at the new baud rate.