Skip to content

06 Flashing the ESP8266

Edwin Wong edited this page May 19, 2015 · 25 revisions

Before continuing you should be able to wire the serial connection and verify that it is working correctly (Section 5 - Communicating with the device).

##Wiring the chip to enter flash mode

###Objective:

  • Enter flash mode on the ESP8266-1 and ESP8266-12
  • Verify that it is in flash mode

To enter flash mode you must set the ESP8266's GPIO0 to low before powering up. This is done by connecting the pins on GPIO0 and GND together.

ESP8266-1 flash mode

esp8266-1 flash wiring

ESP8266-12 flash mode

jumper esp826612photoflashpins

##Flashing using the NodeMCU Windows GUI

###Objective:

  • Flash NodeMCU firmware to the ESP8266
  • Test successful flash

In this section, a method for flashing the ESP8266 with NodeMCU firmware is given. NodeMCU is a LUA programming language based interpreter that runs directly on ESP8266.

The NodeMCU flasher is a firmware programmer for NodeMCU DEVKIT v0.9 and is available for both 32-bit and 64-bit windows. The flasher was developed by the NodeMCU team, but can be used to flash any firmware.

The following will be needed(both are included in the installer):

IMPORTANT: Before trying to flash, make sure the ESPlorer "open" port is closed to prevent flashing issue

  1. Ensure ESP8266's GPIO0 is connected to GND.
  2. Connect the ESP8266 with the serial interface to the PC.
  3. Provide power to the ESP8266. A red light can be seen to indicate the GND is set on GPIO0 on the ESP8266-12. To verify if the GND is set on GPIO0 for the ESP8266-1 is through proper cabling, as the red light is always on.
    esp8266_inflashmode

4.Start the NodeMCU Flasher software (ESP8266Flasher.exe). The COM Port should automatically detect which port is corresponding to the USB/serial adapter if it is connected to the computer.
nodemcuFlashSofwareIdentifyCom

5.Click on the ‘Config’ tab menu to set the firmware path to be flash onto the ESP8266. Default is INTERNAL://NODEMCU with binary 0x00000.
nodemcuFlashSoftwareConfigTab

It is recommended to use the latest firmware, since NodeMCU is still young. In config tab click on the gear image to choose the firmware file to flash. Make sure the firmware you want to flash has the check mark and have the binary set with 0x00000.

6.Go back to the operation tab. Click on the ‘Flash(F)’ button to start the flashing process. The progress bar will start to increase and the MAC address for the ESP8266 Access Point(AP) and Station(STA) will be showed. The lights of the ESP8266 will flash multiple times during this process.
nodemcuFlasherInProgress

7.When successfully flashed, a green check-mark will appear at the bottom left corner. The GPIO0 pin should now be disconnected from GND. (jumper on the GPIO0 and GND should now be removed).
nodemcuFlasherComplete

8.To test if the firmware is working, open the ESPlorer with the ESP8266 connected to the computer and click on the ‘open’ button. (Make sure the GPIO0 is not still connected to to the GND). esploreropenhighlighted Note: A glitch might occur that look like this. It can be ignored but can be fixed by clicking on the ‘close’ button and on the ‘open’ button again.
esplorerGlitchmay

9.An output like in the screenshot below should be shown.‘=node.heap()’ is a LAU API command which returns a heap size. Successfully issuing the command indicates that the LUA firmware is successfully installed. esplorerheap

10.Now to send a command to the ESP8266 and get a response. Type ‘print(“Hello World”)’ on the left panel and click on the button ‘Send to ESP’ at the bottom of the left panel. If in the correct mode, it will response with Hello World.
esplorerhelloworld

###Outcomes:

You should now be able to:

  • Enter flash mode for the ESP8266 device
  • Flash a different firmware to the ESP8266
  • Test that the firmware flashed is working

##Flash with IoT Demo Firmware on Windows In this section, we are going to flash a alternate firmware called 'IoT Demo Firmware'. These method will however work for any other firmware you may wish to flash.

This is demo firmware that can allow easy access and testing on Internet of Things. After flashing this firmware you can control all the GPIO pins on the ESP8266 using a phone application from AI-Thinker. The following are the additional tools that will be needed:

  • IoT.bin firmware file
  • IoT.apk
  • An android phone

Reminder: To flash a firmware, the GND and GPIO0 need to be set low when power up.

  1. Start by connecting the ESP8266 to the computer and open the NodeMCU Flasher.

  2. Go to the config tab and click on the gear image to choose the firmware file to flash. The file that will be using is the IOT.bin that is provided, open the file.
    nodemcuflasher_choosefirmware

  3. Go back to operation tab and start to flash the new firmware to the ESP8266. (refer to flashing esp8266 with NodeMCU firmware for assistance).

  4. Once the flash is successful a green mark is shown in the bottom left corner. Remove the jumper on the ESPP8266 GND and GPIO0 to finish the flashing process.

Note If you followed this flashing guide using the IoT Demo firmware and want to test it, continue from here in section (08A Project 1A: Hello World! using the RGB LED on the ESP 12) of the wiki using "IoT Demo firmware with ESP8266_12 Full evaluation board".