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.
Flashing The ESP8266 with AT commands based firmware.
Download the AT commands firmware by clicking this link. The file contains two firmware:
- v0.9.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
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
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.
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
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
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.
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.
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.
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.
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.
Vivek is a Senior Embedded Engineer at Robert Bosch. He has been working on Embedded Systems for the past 10 years. He loves to share his knowledge and train those who are interested. Nerdyelectronics.com was started out of this interest.
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.
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!!
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.