ESP8266


Team for developers working on the ESP8266 WiFi SOC.

Firmware Update

Introduction

The ESP8266 is a $5 Wi-Fi module (in low quantities) that can communicate over UART by AT Commands to the host microcontroller. This page talks about the firmware update process for the ESP8266 module.

Overview

  1. Load serial passthrough onto your Mbed board.
  2. Connect the EPS8266 device to the serial port on the Mbed board, and put the device into firmware update mode.
  3. Flash all firmware files according to package instructions.
  4. Go build awesome.

The process

To update the firmware on your ESP8266 device:

  1. For most modules with at least 2MB flash size, download ESP8266 AT Bin V1.7.0. If you have a different flash size, download the binaries here and use the README in bin/at/ to find the appropriate memory locations to flash.
  2. Install the esptool.
  3. Compile and load the serial passthrough example to the Mbed board.
  4. Put ESP8266 device into UART Download mode (GPIO0 ->GND) (either push button or jumper).
  5. Load firmware with esptool.
  6. On successful download, put the ESP8266 device into Flash Startup mode.

Mbed board as serial passthrough

Import, compile, and load the serial passthrough code onto your Mbed board. The serial passthrough code allows the computer to talk directly to the ESP8266 device and receive information from the chip. This is necessary to load the firmware update into the ESP8266 device's memory.

Import programSerialPassthrough

Serial Passthrough program

ESP8266 connection

ESP8266 firmware update wiring

To connect the ESP8266 to the Mbed board, make the following connections:

ESPFRDM-K64F
VCC3.3V
GNDGND
TXRX
RXTX

ESP8266 into firmware update mode

Seeed Grove UART Wi-Fi

Push the reset button until the light turns red (at least 2 seconds).

Standalone module

Wire the ESP8266 device to be in UART Download mode:

ESPFRDM-K64F
GPIO0GND
GPIO23.3V
CH_EN3.3V
RST3.3V

Reset the chip. Pull down the RST pin to GND for 1 second, then reconnect it to 3.3V.

For a more detailed diagram, see the Getting started guide in the resources section.

Determine the size of flash memory available.

Check flash size with esptool

You can get the esptool by running

pip install esptool

On Windows the binary is named esptool.exe, and on Linux, esptool.py

Use mbedls to check which serial port is used for communication with your board.

user@host:~/mbed-os> mbedls
| platform_name | platform_name_unique | mount_point             | serial_port  | target_id | daplink_version |
|---------------|----------------------|-------------------------|--------------|-----------|-----------------|
| K64F          | K64F[0]              | /run/media/user/DAPLINK | /dev/ttyACM0 | 024000... | 0250            |

$ esptool.py --port /dev/ttyACM0 --baud 115200 flash_id
esptool.py v2.5.1
Serial port /dev/ttyACM0
Connecting......
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 68:c6:3a:93:4f:7d
Uploading stub...
Running stub...
Stub running...
Manufacturer: 1c
Device: 3014
Detected flash size: 4MB  <-- This is the flash size. 4MByte  = 32 Mbits
Hard resetting via RTS pin...

Information

With any ESP8266 module, you need to reset the chip between each flash size query.

Load firmware with esptool

From the espressif firmware you just downloaded, you need to load 4 separate files onto the ESP8266 chip:

BinaryAddress
boot_v1.6.bin0x000000
user1.2048.new.5.bin0x01000
esp_init_data_default_v08.bin0x1FC000
blank.bin0x7E000
blank.bin0x1FB000
blank.bin0x1FE000

Specify the Flash size as 2 MB. This also works with bigger flash sizes. If you have a bigger flash size, use the README in bin/at/ to find the appropriate memory locations to flash.

The command below uses the files you can find after extracting the archive downloaded from the Espressif site and navigating into its bin subdirectory.

Example command to flash 1.7.0 AT firmware

esptool.py --port /dev/ttyACM0 --baud 115200 write_flash --flash_size 2MB-c1 --flash_mode dio \
0x00000 boot_v1.6.bin 0x1000 at/1024+1024/user1.2048.new.5.bin 0x1FC000 esp_init_data_default_v08.bin \
0x7E000 blank.bin 0x1FE000 blank.bin 0x1FB000 blank.bin

Troubleshooting: If you have an issue with serial connection, try leaving the programming mode and entering it again and then resetting the serial throughput board.

Success

Now that you have completed updating the firmware, you need to put the chip in Flash Startup mode.

Booting ESP8266

Seeed Grove UART Wi-Fi

Press the reset button.

Standalone module

Wire the ESP8266 device for boot mode.

ESPFRDM-K64F
GPIO03.3V
GPIO23.3V
CH_EN3.3V
RST3.3V

Reset the chip. Pull down the RST pin to GND for 1 second, then reconnect it to 3.3 V.

Verifying firmware version

To verify which version is present on the chip, send the following two commands over the Serial port:

AT
AT+GMR

Help

Send Carriage Return("\r" - Ctrl+M) and Line Feed("\n" - Ctrl+J) after each command

The output should look like:

AT

OK

AT+GMR
AT version:1.7.0.0(Aug 16 2018 00:57:04)
SDK version:3.0.0(d49923c)
compile time:Aug 23 2018 16:58:12
Bin version(Wroom 02):v1.7.0

Example

For example, if you have an FRDM-K64F board and ESP8266 device, and want to update the firmware for the ESP8266, compile and load the serial passthrough example program onto the K64F. Then, connect the following pins:

ESPFRDM-K64F
VCC3.3V
GNDGND
TXD0
RXD1
GPIO0GND
RST3.3V

Reset the chip. Pull down the RST pin to GND for 1 second, then reconnect it to 3.3V.

Use the esptool to download the binaries. Once you have downloaded them, connect GPIO0 to 3.3.V, and reset the ESP8266. The board runs in operational mode, which is usually 115200 baud. To test this, load the program below onto the board. It has the AT+RST command already programmed, so when you compile and run it, you receive valid output from the ESP device. If you do not receive valid output, change the baud speed of the device.

Import programSerialDeviceTerminal

This program is designed to act as a serial terminal for interfacing with serial peripherals, such as the ESP8266, that support AT Commands.

That's it! Go build awesome!

Resources

Here are some other useful resources for ESP8266 shenanigans.


All wikipages