Update ESP8266 WIFI module to the latest AT firmware
ESP8266 is currently one of the most widely used WIFI chip because of its low cost and small number of required external components. When it comes with the factory firmware it has AT interface support that is sufficient to cover all configuration options. There are many tutorials how to program ESP8266 but many of them are missing with detailed instructions or how to make a programmer for this purpose or does not guide where to get the firmware and tools. I decided to put everything together ino one blog post. In this post I will cover only AT firmware update. Soon there will be tutorials how to change the firmware to NodeMCU and write your own custom firmware.
There are actually many ESP8266 programming options:
- You can communicate with ESP8266 using AT commands. It is by default supported by stock firmware. You still have option to upgrade the firmware to the latest version. For example last firmware adds SSL support, more AT commands and many bugfixes.
- Use NodeMCU firmware on ESP8266. You can still send string based commands to it but they look different. The most important feature is lua script support. Basically if you want to reconfigure your WIFI module you can write lua scripts, load it to the module and your code will be executed automatically after next reboot. This script you can send directly through your UART. No need to enter into programming mode.
- Use SDK that makes possible to write your own code on to ESP8266. You can use either stock firmware or RTOS based firmware as the basis and build your application on top of that. There are about 30 examples together with SDK how you could use your ESP8266. For example connect just some external sensor through the UART or I2C interface to it and module starts living its own life by checking sensor data and sending update over the network. SDK provide the most options.
It is possible to program ESP8266 either in Windows or in Linux. We will cover all three above mentioned options using Windows based tools.
Check your ESP8266 flash size
At first make sure you have a module that has at least 8Mbit of Flash on board because newer firmware versions do not support anymore modules that have less memory. First modules were assembled with 4Mbit of Flash and for them you need to use a lot older firmware version.
There are two options how to detect flash size – check the chip or let the software to ask. Next to the chip it has SPI Flash.
Modules that have chip Winbond W25Q40 installed have 4Mbit of FLASH.
Modules with W25Q80 chip has 8Mbyte of FLASH on board. It looks like some modules have even larger Flash so feel free to use those as well, if you are lucky and you have one.
Next step is to build a programmer for ESP. It is much easier to push the button than hold or connect/disconnect the wire each time you need to re-program the module.
Second option is to use Flash Download Tool software that is described below. In the DETECTED INFO frame you can see the detected Flash size.
Build the programmer
An example schematic can be found here:
Full story how to connect the hardware is descibed in here.
To power on ESP module this USB to UART module is not able to give sufficient power. I tried even with separate LDO getting the input current from USB. Sometime it works but frequent and unexpected reboots did not look good. So I decided to get the power from an external power supply.
Just remember that each time before you start programming:
- Hold down RESET button
- Press FLASH button
- Release RESET button
- Release FLASH button
After that ESP reboots itself into programming mode and you are ready to flash the module.
Update the firmware
This is usually one of the first and easiest options after playing with AT commands. Let’s assume that you have developed some communication interface and would like to ensure that all your WIFI modules will be using the same firmware in the future or there is an important bug fixed in the next release. The easiest way is to re-flash the module with the latest version of official Espressif firmware.
Get the latest firmware
To get all required binary files you need to download latest AT command software.
- Fetch the latest firmware from the Espressif forum. Look for the firmware „[AT Release] ESP8266_AT_V1.x based on ESP8266_NONOS_SDK_V1.y.z“. At the time of writing of this post the latest AT version is V1.0 which is based on the SDK v1.5.3. You can get if from here.
Get the programming software
Flash Download Tool is officially supported by the Espressif and works fine. Get it from here.
Flash the ESP8266
Power up your ESP and boot it up into programming mode as described above.
Start the Flash Download Tool.
Press “START” and it tries to detect your ESP.
If detection is successful then you will see message “SYNC” and MAC addresses as on the figure.
Select binary files. The four files needed are:
- esp_init_data_default.bin – default configuration
- user1.bin – user application
The address at which each file is to be installed is shown next to the file name.
After you have selected all necessary binaries, select correct COM port and speed.
Rest of the configuration should remain unchanged.
Press START button and it will take up to 30sec to program your ESP.
Afer you see FINISH message, reset your board and connect to your board with terminal application.
I am using RealTerm for that.
Default UART speed is 115200bps.
Check you firmware version by typing “AT+GMR\r\n”
You should see the answer:
AT version:188.8.131.52(Apr 16 2016 13:02:45)
compile time:Apr 18 2016 14:20:15
5 aastat ago / No Comments
WRITE A COMMENT