It's been a while since I connected my ESP8266 board to a ZPUino soft processor running in a XuLA2 board. I thought I would update the firmware on the ESP8266 to the latest version and see if it still worked.
Since everyone is compiling new applications for the Espressif chip now, merely reprogramming the serial flash on the board should be easy, right? Just download a binary file and you're done! It turned out to be a bit more confusing.
Part of the confusion is that there are a lot of different programming tools being used: binary executables, Python scripts, whatever. Some tools require specifying four different binary files, one for each particular address range of the flash chip. But the downloadable archives don't usually have four files in them, and if they do, they don't have filenames matching the ones shown in the examples. I didn't want to brick my modules, even if they only cost $2.71/each.
Finally, I settled on using the Espressif's official
esp8266_flasher.exe program. I also downloaded the
v0.9.2.2 AT Firmware.bin file.
After dumping the contents of both archives into a local directory, I had this:
esp8266_flasher.exe icon brought up the flashing tool:
Bin button opened a window where I selected the binary file to download into the serial flash of the board:
v0.9.2.2 AT Firmware.bin file and clicking
Open took me back to the main window with the firmware file displayed in the
Next I needed to put the ESP8266 into its flash programming mode. This is done by resetting the ESP8266 board while holding its GPIO0 pin low. I could do this with a few wires and a breadboard but, since I might be doing this more than once, I decided to build a little programming board. It has a 4 × 2 socket for the ESP8266 board that is wired to a header where my C232HM USB-to-serial cable is attached. A couple of 2.2 KOhm pullup resistors for the chip-select and reset pins keep the ESP8266 enabled.
RESET pushbuttons are provided to momentarily pull the GPIO0 and reset pins input to ground, respectively.
After inserting my ESP8266 board into the programming board and attaching the C232HM cable, I entered the flash programming mode by holding down the
PROG button and then pressing and releasing the
RESET button. In the flashing tool, I changed the serial port from
COM6 because that's where the CH232HM cable resides on my system. Clicking on the
Download button started the reprogramming of the flash chip. The progress was displayed in the lower pane of the window and, after about a minute, the reprogramming was done.
Note that the progress pane indicated "Failed to leave flash mode". That's probably because the flashing program doesn't have any way to bring the ESP8266 board out of programming mode. But it's not really a problem provided the contents of the flash chip were rewritten.
To verify the flash programming was successful, I needed to talk to the chip and query the firmware version. I closed the flash programming window and pressed the
RESET button (without pressing the
PROG button) to place the ESP8266 board in user mode. Then I brought up a PuTTY window and configured it as shown below.
Note that I set the speed to 9600 bps. The new firmware defaults to this communication rate rather than the 115 Kbps rate used in the factory-installed firmware.
After opening the PuTTY terminal window, I sent the ESP8266 the reset command (
AT+RST) and then had it print the firmware version (
AT+GMR). The version was shown to be 0018000902 rather than the 00160901 version that originally came loaded in the board. So the firmware update appeared to have worked.
In order to push the transfer speed of the board back up to 115 Kbps (since the ZPUino can handle that speed, there's no need to cripple the interface), I used the
AT+CIOBAUD=115200 command. Then I checked that the change took using the
AT+CIOBAUD? command. (Observe that it required two attempts to change the baud rate, so don't be put off if that happens to you.) The baud rate is stored in nonvolatile memory so it will remain in effect from then on, even if the power is interrupted or a reset occurs.
With the new firmware in place and the baud rate back at 115Kbps, I took the ESP8266 module from the programming jig and put it back into my ZPUino development board. Now it was just a matter of running my existing program that downloads the contents of a web page over the wireless link, right?
Wrong! It turned out the update of the ESP8266 firmware is sufficiently different that the following minor changes were needed:
While making those changes, I also had to fix my code for timing-out if no characters were received from the ESP8266. The updated program can be found here.
So after all that, I finally had an updated Wifi module and a working example. I hope this procedure helps if you decide to update your own ESP8266.
Share on Twitter Share on Facebook Share on Reddit