Pages

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.

24 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. 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
  13. Really I love you man... You test gonna save my semester!
    Thanks!

    ReplyDelete
  14. 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
  15. Hi
    I'm lost, my esp8266 was with a newer version but as it was not working with your librairies, I have flashed it...
    now when I do "AT+GMR"

    I have exactly the same as your first picture
    AT version : 0.51...
    SDK version : 1.5

    but now when i do the basic test
    [WiFiEsp] Initializing ESP module
    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] Cannot initialize ESP module
    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] No tag found
    ********************************************** Firmware version > FAILED (actual="", expected="1.5.2")

    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] No tag found
    ********************************************** Status is (WL_DISCONNECTED) > FAILED (actual=255, expected=3)

    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] Failed connecting to boxLnJl
    ********************************************** Connect > FAILED (actual=2, expected=1)

    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] No tag found
    ********************************************** Check status (WL_CONNECTED) > FAILED (actual=255, expected=1)

    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] No tag found
    ********************************************** Check SSID > FAILED (actual="", expected="boxLnJl")

    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] No tag found
    ********************************************** Check IP Address > FAILED (actual=0, expected=0)

    IP Address: 0.0.0.0
    [WiFiEsp] >>> TIMEOUT >>>
    [WiFiEsp] No tag found
    MAC: 0:0:0:0:0:0

    nothing is working, even the things that was working before...
    cna you help me ?

    ReplyDelete
    Replies
    1. as I read i check for the expected version 1.5.2 ( and not 1.5.0)
      I found this one
      https://github.com/adriano65/esp-open-sdk/tree/master/esp_iot_sdk_v1.5.2
      and do the same for flashing...
      everything is ok now!!!
      yeah
      great thx !!!great job !!!

      Delete
  16. This Tutorial worked for me! Thank you!

    ReplyDelete
  17. [espDownloader.pyo][line:457][ERROR]: ESP8266 Chip flash download error esp_write_flash.
    THIS IS MY PROBLEM IN MIDDLE OF FLSDHING IT STOPPED AND SHOWING ERROR PLZ HELP!

    ReplyDelete
  18. AFTER 4 LONG DAYS!!!
    THANKS A LOT!
    Your explanations about which .bin to choose, it's the only place on the web I found it.
    IT'S NOW WORKING with Blynk!!!
    esp8266 Noname from china. Arduino Uno, Arduino Ide and a bread board.FLASH IT. Nothing else!

    ReplyDelete
  19. I have followed each step of the above documentation and successfully flashed the firmware. But after flashing when I open the serial port only few AT commands are working which is AT, AT+GMR & AT+RST. When I give other AT commands like AT+CWMODE it is showing error message. Can anyone help me to resolve this issue.

    ReplyDelete

Note: Only a member of this blog may post a comment.