ESP8266 Firmware update and recovery

So after I’ve received my ESP8266 I’ve built a support protoboard with pin headers for serial connection, Voltage Shifter (used one for I2C voltage shifting), a LM317 voltage regulator (The board uses an external power source) and a reset button so that I can simply reset the esp8266 easily. I’ve also put the GPIO0 and GPIO2 pins available on pin headers, mainly so that I can short the GPIO0 to Ground if I needed to update the firmware, and of course, I glad I did this…

After some tinkering around I came across these page for firmware update using the interner/cloud:
http://blog.electrodragon.com/cloud-updating-your-wi07c-esp8266-now/

With the following AT command: AT+GMR I’ve determined that my version was 0018000902-AI03, and supposedly it supports the Cloud update.

Also as far the documentation is saying, there is no need for the GPIO0 pin to be grounded to do the firmware upgrade, so I wrote the dreaded command: AT+CIUPDATE after I did the basics, namely connected to an access point and with available internet connection (no mid path proxys).

The upgraded started, but not at it is shown in the above link. For example it shows the command execution something like: +CIUPDATE:1 found server but all I’ve got was +CIUPDATE:1 and +CIUPDATE:2 and so on and no OK at the end. Just garbage…

At this point I though that the ESP8266 was bricked… because I always got garbage despite of configuring my terminal with several different baud rates, including the baud rate 76800 that according to some sources (well google…) it is the default boot loader baud rate. But I had no success and so I thought it was bricked.

Well that is not exactly the case because we can flash a new firmware using the old procedure of tying the GPIO to ground while the ESP8266 is directly connected to the computer via FTDI.

Please note that these instructions are for Linux:

So what is need is the esptool.py available here: https://github.com/themadinventor/esptool/blob/master/esptool.py
and the latest firmware available here: https://drive.google.com/folderview?id=0B3dUKfqzZnlwR2pVWjg3NXRVdW8&usp=drive_web&tid=0B3dUKfqzZnlwRjFaNTUzZFptbzg#list

Download and unzip the firmware file at the same directory where the esptool.py is located.
I’ve tried both firmwares: ESP8266_AT_V00180902_02_baudrate watchdog added.zip and ESP8266_AT_V00180902_04 (0018000902-AI03)_unconfirm version.bin, and kept this last one, the original that my board came with. With both firmwares the cloud update, at least with me fails.

So with GPIO pin grounded, power up the ESP8266, and execute the following command for uploading the 0018000902-AI03 firmware:

./esptool.py -p /dev/ttyUSB0 write_flash 0x000000 ESP8266_AT_V00180902_040018000902-AI03_unconfirm_version.bin

Where /dev/ttyUSB0 is my FTDI usb port. Some times when trying to flash I had the following error (While I was in the Cloud update testing cycle):

Connecting...
Traceback (most recent call last):
File "./esptool.py", line 353, in
esp.connect()
File "./esptool.py", line 138, in connect
raise Exception('Failed to connect')
Exception: Failed to connect

where the esptool.py failed to connect. But pressing my (handy) reset button, and trying again solved the issue.
As the firmware is uploading we can see the progress of flash erasing and then the firmware upload progress. At the end something like this shows up:

Connecting...
Erasing flash...
Writing at 0x0007ec00... (100 %)

Leaving...

Now power off, by disconnecting the USB cable and the external power source to the ESP8266, disconnect the GPI0 pin, so now it floats (not connected to anything) and power up again.

The ESP8266 should be functional again at baud rate 9600.

At the end I’m still unable to do a firmware cloud update…

Hope this helps

Advertisements

9 thoughts on “ESP8266 Firmware update and recovery

  1. Hi, i’ve tried to upgrade with esptool, using esp8266 mod 01, linux(lubit), all the connection like you described but i received :
    File “./esptool.py”, line 53
    ESP_CHECKSUM_MAGIC = 0xefserial
    SyntaxError: invalid syntax
    This is the second time i ‘ve tried to upload, the first, with another pc with ubuntu, i’ve received a error after the erasing of the old firmware and after that i never be able to comunicate with the module. i have tried now to reflash the module to save it but it not respond . could you help me?

    • Hi: Not sure if I can help you on this, but make sure first that with the esp8266 disconnected from power that the GPIO0 pin is grounded. Not sure what kind of esp board that you have but make also sure that other pins are floating (not connected no nothing, except the CH_EN is connected to VCC. Then power up and try again, keeping always GPIO0 pin grounded. If it fails, take the Reset pin to LOW and then to HIGH to reset the module and try again.

    • “SyntaxError: invalid syntax” could be a simple Python version mismatch. If you use Python 2.7x, try running the script with Python 3.x and vice versa.

  2. Hi, thanks for article. I have problem with downloading firmware from your Google Disk. I don’t have permission to open this folder.

  3. Pingback: ESP8622 Then there was trouble | game weasel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s