ESP8266 – Flash The AT commands firmware

This is part 2 of the series: How to flash firmware on ESP8266. There are many firmwares available out there.In this post, we will discuss how to flash the ESP8266 with the AT commands based firmware.

Flashing the ESP8266 is pretty simple. You need to connect the ESP as shown below.

connections to program esp8266

Flashing The ESP8266 with AT commands based firmware.

Download the AT commands firmware by clicking this linkThe file contains two firmware:

  1. v0.9.2.2
  2. v1.3.0.2 – This is the latest one

You will also need the flasher. Download it here

Open the flasher you just downloaded. You should see this window
flasher-open

Load the firmware bin file

Clicking on the “Bin” tab (red box 1) opens the windows explorer from where you can search the firmware file you just downloaded. The file will have a .bin extension. Or if you know the path of the file, you can enter it directly (in red box 2).

Change the COM port

By default it takes COM1. To find out the COM port go to start>device manager

device-manager

The COM number can be seen under the Ports tab. If you have multiple devices connected, you will have to check the name of the devices. In our case it is “Silicon Labs CP210x …..” Our COM port is COM3. It can have any value. Not necessarily 3.

Change COM1 to COM3 and leave the address to 0x00000.

Download

All’s set now. Hit the “Download” button without fear. This is what you should see.

erasing

You should see the ‘Erasing flash’ message now. If you do not see it, skip to the troubleshoot section to get it moving.

Done

Once the flashing is complete, you should see this

at-commands-flashing complete

It shows 99% and then

“Leaving…

Failed to leave Flash mode”

Don’t worry about this. There is probably some error in the flasher. We are good to go. We have updated the ESP with the chosen firmware.

We will now confirm if everything works fine.

Open Real term. If you don’t have it, you can download it here. Its free.. 🙂

Click on the ‘Port’ tab. The one in the red box

realterm-open

Change the baud rate to ‘9600’. This is the default baud rate of the firmware.

Change the port to 3. This is the same one we found out from the device manager for the flasher.

Now open the port.

open-port-realterm

Remove the GPIO from ground and press the reset button. You should get some data. Even if the initial part is junk, it should end with an “OK” or some line such as in the image below.

realterm-reset

Complete junk means that the baud rate is incorrect. Change the baud rate to check which one works.

Now go to the “Send” tab

Enter “AT” in the user input field without the quotes. Select “+CR” and “+LF” from the EOL column. Now Hit “Send ASCII”.

You should get “OK” in reply.

realterm-send

The OK response means that everything is working great and we have successfully flashed the ESP8266. Now bring out the genius in you and start making awesome devices.

Troubleshoot

  • ESP8266 not getting programmed.

If you are not getting the “Erasing flash” message, you should probably be getting the “Failed to connect” message.

failed-to-connect

There could be various reasons for this.

  • Check that the device is connected to the USB port
  • Check that the Com port is correct
  • Check that the COM port is not open in any other software such as RealTerm. Only one application can make use of a COM port at any given time.
  • Check that the Rx and Tx pins are connected properly.
  • The GPIO0 pin should be connected to ground
  • Reset the ESP after connecting the GPIO0 to ground (programming mode). I found this reason to be most annoying. If you don’t reset the ESP after putting it in programming mode, it won’t be detected by the flasher.

Do let me know your thoughts about this post in the comments section below.

3 comments on “ESP8266 – Flash The AT commands firmware”

  1. ram says:

    It’s not my first time to pay a visit this website, i am visiting this site daily and obtain nice data from here all the time.

  2. maor gorelik says:

    hi,
    as you said i get “failed to connect” but i checked all those you listed and they are correct in my project. i dont think its a wiring problem. do you have any ideas? while i try to download the firmware and flash my ESP the blue light on the ESP is blinking. what does that mean?
    Thank you in advanced!!

    1. admin says:

      Hi Maor

      The blue light is the traffic light. When the ESP receives data, the blue light is ON. Perhaps you need to double check your circuit and make sure that the Rx pin of the ESP8266 is not being held high.

      It could also be taking junk value if the Rx pin is not properly connected. If the connection is loose, the Rx pin will be in float. So make sure that it is properly connected and that the value is zero.

Leave a Reply to maor gorelik Cancel reply

Your email address will not be published. Required fields are marked *