December 27, 2015

Flashing ESP8266 firmware v1.5 using Arduino Uno

I have to admit that I had some bad experience when trying to flash new firmwares to my ESP-01 modules but today I have found an easy and reliable way to flash ESP8266 firmware v1.5 (AT v0.51) using my Arduino Uno board as an FTDI controller.

Prerequisites
You need the following items:
  • A Windows PC with Arduino IDE installed
  • An Arduino Uno board
  • A reliable connection between ESP-01 module and Arduino board. This procedure is based on my cheap Arduino WiFi shield with ESP-01


Wiring

First of all you have to build my cheap Arduino WiFi shield with ESP8266. This will provide a solid foundation for powering the ESP module and setup the communication to the Arduino board.
Ensure you are able to issue simple AT commands to the ESP-01 board before proceeding.

Now modify the wiring as follows.
  • Remove ATmega328P chip from the Arduino board. By removing the microcontroller you can use the Arduino Uno onboard FTDI interface to directly communicate with the ESP module.
  • Connect ESP' RDX pin to the RX pin of Arduino (pin 0).
  • Connect ESP's TXD pin to the TX pin of Arduino (pin 1).





Test connectivity

Open the Arduino IDE, select the correct port and open the serial monitor.
You should be able to issue AT commands and get a nice output. Try 'AT' and 'AT+GMR' commands.


If you do not get any output you can try the following.
  • The serial monitor baud rate must correspond to the ESP UART baud rate. Old modules have 9600, newer ones have 115200.
  • Try different settings for the 'Line ending' option of the serial monitor. For my ESP module I have to set it to 'Both NL & CR' as you can see in the screenshot.
Try different combinations until you are able to correctly interact with the ESP module using the serial monitor.

Download firmware and tools

Download the following files and extract them

Flash it!

To put the ESP module in flashing mode you must connect ESP's GPIO0 pin to ground.
  1. Unplug the Arduino board from the PC
  2. Put a jumper between GND and GPIO0 pin (see photo)
  3. Plug the Arduino board to the PC.


Follow these steps to flash the new firmware to the ESP-01 board.
  1. Close the Arduino IDE if still opened
  2. Launch the ESP flash download tool (ESP_DOWNLOAD_TOOL_V2.4.exe) you have previously extracted
  3. Apply the following settings
  4. Bin files (from the esp_iot_sdk extracted zip file) :
    1. bin\at\noboot\eagle.flash.bin - 0x00000
    2. bin\at\noboot\eagle.irom0text.bin - 0x40000
    3. bin\blank.bin - 0xfe000
    4. bin\blank.bin - 0x7e000
  5. Flash size: 8MBit
  6. COM port: choose your Arduino COM port
  7. Baud rate: 115200 or 345600 (this is not related to the ESP baud rate



 Now press the START button and wait for the flashing process to complete.


Now press the STOP button and close the flashing tool.

Test connectivity and set default UART speed

Before proceeding it is better to verify that the new firmware is working fine.
  1. Unplug the Arduino board from the PC
  2. Remove the jumper between GND and GPIO0 pin
  3. Plug the Arduino board to the PC
Open the Arduino IDE, select the correct COM port and open the serial monitor.
Test connectivity with 'AT' and 'AT+GMR' commands. The correct settings for the ESP firmware v1.5 are:
  • Speed: 115200
  • Line ending: Both NL & CR
If you are going to use the ESP-01 module with Arduino Uno you have to lower the default baud rate because the SoftwareSerial interface maximum speed is around 38400 bps. I suggest to set the ESP module to use 9600 or 19200 bps. To set the correct baud rate use this command:
AT+UART_DEF=9600,8,1,0,0

Now set the serial monitor speed to 9600 and test again the communication.

Rebuild your ESP WiFi shield

Remove the modifications made to the ESP shield.
  • Insert the ATmega328P chip back into the Arduino board
  • Connect ESP' RDX pin to Arduino pin 7
  • Connect ESP's TXD pin to Arduino pin 6

Compile and upload the updated sketch and you should be able to correctly interact with the ESP module.

Your ESP8266 board is now flashed with the updated firmware and ready to be used for your connected projects!

Don't forget to take a look at my WiFiEsp library for Arduino.

19 comments:

  1. Perfect !! I have now ESP8266 firmware v1.5 (AT v0.51) in my ESP-01 :) and now ... to the arduin o part, I am sure my Iot venture started ... Thanks to you ;)

    ReplyDelete
  2. ,Hope to be lucky and you answer me ... I tried in my ESP-01 (1 year old?) but is not working.
    Memory says 25Q40xxx so 512 KB. You say Flash size: 8MBit (1 MB?) how is marked the memory in your ESP-01? Is that the problem? besides my clumsiness ... :( AT+GMR puts AT 0.51 SDK 1.5.0 but I have not tried all AT commands. I like the idea of Arduino for "the things" and ESP-01 for the Internet but ....
    Thanks a lot in advance

    ReplyDelete
  3. Thank you very much, this solved my problem with the ESP8266! Henning

    ReplyDelete
  4. Not working for me. Are there any other settings or tips, such as order of flashing, etc?

    My situation is really puzzling: it flashes fine, success, but will NOT respond to AT commands. And I know how to terminal to the thing, and flashing other firmware works fine. But something about espressif firmware with espressif flash tool is not working. I've tried 4Mbit as well, not that it matters, it "succeeds" to write with either 4 or 8Mbit settings.

    ReplyDelete
    Replies
    1. I had the same problem, but after several tries, realized the speed on the testing console should be 115200 as this is the default of the firmware. Set the speed of the port to 115200, then apply the UART speed to 9600 as explained above, then set the speed again of the testing console to 9600 and all should work.

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Awsm...after so many try this blog help me at last.thanks alot.

    ReplyDelete
  7. Great tutorial. Yesterday I got my ESP8266 died by wrong wiring. It was working on 74880 baud and was giving this message all the time:
    ets Jan 8 2013,rst cause:2, boot mode:(3,7)

    load 0x40100000, len 1396, room 16
    tail 4
    chksum 0x89
    load 0x3ffe8000, len 776, room 4
    tail 4
    chksum 0xe8
    load 0x3ffe8308, len 540, room 4
    tail 8
    chksum 0xc0
    csum 0xc0

    2nd boot version : 1.4(b1)
    SPI Speed : 40MHz
    SPI Mode : QIO
    SPI Flash Size & Map: 8Mbit(512KB+512KB)
    jump to run user1 @ 1000

    Today I was looking for a sloution. After doing all your steps (I connected RESET to the GROUND instead of pulling out the ATMEGA chip) everything went perfectly smooth. Also I learned something new today, so double win.

    THANKS A LOT AGAIN!

    ReplyDelete
  8. I want to update using another bin file. In step-4 of flashing firmware, where i should put my bin file?
    here: 1. bin\at\noboot\eagle.flash.bin or where?

    ReplyDelete
  9. Thanks you very much for this post! It's works fine!

    ReplyDelete
  10. I know that my several ESP8266 01 had this versions:
    AT version:1.1.0.0(May 11 2016 18:09:56)
    SDK version:1.5.4(baaeaebb)

    I only want to reflash it like it was before.

    I need to know:
    The version of the flash tool I should use. V3.4.4 is ok?
    The files, for example: blank.bin; eagle.flash.bin; irom0text.bin (I need more?) with the address, or where I can see it for this version?!

    Any sugestion is welcome!
    Thank you a lot!

    ReplyDelete
    Replies
    1. I find it!
      Thanks for the good information you have in your blog.
      http://bbs.espressif.com/viewtopic.php?f=46&t=2199

      Delete
  11. Thank you so much. It worked out finally after 3 hrs of struggle. I'm able use AT commands again now. Thank you :)

    ReplyDelete
  12. telasmosquiteira-sp.com.br

    telas mosquiteiras sp
    telas mosquiteira sp

    As telas mosquiteiras sp , telas mosquiteiro sp garantem ar puro por toda casa livrando-a completamente dos mosquitos e insetos indesejáveis. As telas mosquiteira garantem um sono tranquilo a toda família, livrando e protegendo-nas dos mais diversos insetos. Muitos destes insetos são transmissores de doenças e a tela mosquiteira é indispensável no combate a mosquitos transmissores de doenças.
    s
    A dengue, por exemplo, já matou centenas de pessoas só na capital de São Paulo e um pequeno investimento em nossas telas mosquiteiras podem salvar vidas. As telas mosquiteiras também impedem a entrada de insetos peçonhentos como as aranhas e os escorpiões, estes insetos também oferecem risco, pois seu veneno em poucos minutos podem levar uma criança a morte.
    telas mosquiteira jundiai
    telas mosquiteiro jundiai
    telas mosquiteira São Paulo
    telas mosquiteiro São Paulo
    telas mosquiteiras sp
    telas mosquiteiras Jundiai
    telas mosquiteira sp
    telas mosquiteiro Jundiai
    telas mosquiteira sao paulo
    telas mosquiteiro sao paulo

    A chegada da temporada Primavera/Verão traz consigo a elevação da temperatura e a maior ocorrência de chuvas. Mas não é só isso. As estações mais quentes do ano causam muita dor de cabeça e muitos zumbidos indesejáveis em função das pragas urbanas – pernilongos, baratas, cupins e outros insetos -, que afetam todas as regiões brasileiras.

    Nossa missão é oferecer telas mosquiteiras de qualidade a um preço acessível, fazendo com que as telas mosquiteiras sejam uma opção viável para muitas pessoas.

    telas mosquiteiras Jundiaí
    telas mosquiteiro Jundiai
    telas mosquiteiras jundiai
    telas mosquiteiro industria
    telas mosquiteira restaurante
    telas mosquiteiro restaurante
    telas mosquiteira empresa
    telas mosquiteiro empresa

    ReplyDelete
  13. can you help me i have this error when i upload my code:
    warning: espcomm_sync failed
    error: espcomm_open failed
    error: espcomm_upload_mem failed
    error: espcomm_upload_mem failed
    Thanks

    ReplyDelete
  14. Really I love you man... You test gonna save my semester!
    Thanks!

    ReplyDelete
  15. I once turned a blind eye to a tutorial on Flashing ESP8266 firmware v1.5 using Arduino Uno, only to realize that it was very important. I didn't realize it until i was in need to do so, but then the information was nowhere to be found. Finding this post is a great achievement. Quality Literature Review Chapter Writing Help have been of great help to many people, and to be among them you only need to check the link provided.

    ReplyDelete