Espressif Flash Download Tool
Flashing & Upgrade EPS8266 v1 with ESPRESSIF flash tool In this illustration we will going to flash the ESP8266 version 1 same or the NodeMCU or ESP8266 12, and 13, most ESP8266 board will do support on this tool just kindly follow the address bellow. Regarding the Windows GUI flash download tool, we'll check with the developers if this tool has been updated for ESP32-D2WD yet. Espressif Systems is a fabless. A newer release of ESP32 ESP Flash Tool ( 2016-06-15 ) is online on new Resource Web Side at espressif web. ESP32 Flash Download Tool V1.2.0 1. Fix result check function for ESP32.
We show you how to install or upgrade microcontroller firmware to eliminate WiFI errors in some Uno and Mega WiFi combo boards.
PICTURED ABOVE: ISP (In-System Programmer) to be published in Part 2
If you are not aware of what firmware does, firmware is defined as “permanent software programmed into a read-only memory”. Simply put, it remembers instructions, even when switched off. For the Jaycar Arduino Mega (and Uno) with WiFi, an on-board Espressif ESP8266 IC provides WiFi functionality. The standard ESP firmware includes code that converts the venerable ‘AT’ command set into internal ESP machine code, enabling the ESP8266 to send and receive WiFi data packets over the Internet. The “AT” command set has been around since the 1981 and is still used in virtually every modem.
Many Arduino compatible Mega with WiFi and Uno with WiFi combo boards contain obsolete WiFi firmware that prevents their WiFi working with standard Arduino WiFi libraries.
We discovered this problem when we attempted to run some WiFi code on our Arduino Mega with WiFi board and discovered it contained obsolete ESP8266 WiFi firmware that crashed with current Arduino WiFi libraries. Of course, even if it contained the more common (and slightly newer) V1 firmware, as all our ESP-01 boards had, V1 firmware contains some annoying and time wasting bugs. The worst example we’ve encountered was that WiFi Signal Strength ( WiFi.RSSI() ) didn’t work correctly. If you look carefully through the H2O Timer code from last month’s issue, you’ll find a kludge/workaround for this particular bug.
We have also come across Arduino clones that didn’t even have a Bootloader, and more recently, we encountered an Arduino bootloader problem with a friend’s Creality Ender 3 3D printer. This brought us to making our own In-System Programmer to solve the issues. We'll present the ISP project in next month's issue.
In part one of our two part project, we’ll show you how to easily update your ESP8266 firmware and enable your Arduino with WiFi combo board to work with Arduino WiFi libraries. Next month, we’ll show you how to build your own ISP (In-System Programmer) to fix the firmware in your other Arduino-based microprocessors.
How to:
The majority of hobbyist WiFi boards, including the Jaycar Arduino XC4411 Uno with Wifi and XC4421 Mega with WiFi combo, use an onboard Espressif ESP IC to make the WiFi side work. In a nutshell, standard ESP firmware contains code that converts the ubiquitous ‘AT’ modem command set to internal ESP machine code that sends and receives WiFi data over the Internet.
We first noticed the Jaycar Arduino Mega with WiFi (Cat no. XC4421) when we started designing the DIYODE H20 Timer (see Issue 031 Feb 2020). On paper, it looked like this Arduino/WiFi combo board would fit the bill exactly, reducing the project’s component count and simplifying the wiring, compared to the standard Arduino Mega and separate ESP-01 WiFi card we were using for the prototyping at the time.
When our Mega with WiFi arrived in the mail, we already had an early version of the DIYODE-H2O-Timer software running and, after reading the instructions, it seemed all we had to do was change switch settings. Unfortunately, it wasn’t that easy and the WiFi didn’t work at all. Instead, the Serial debugger displayed the (quite unhelpful) error message that the on-board ESP chip contained unsupported WiFi firmware (only version 0.9.5. We've found it pays to be wary of versions under 1.0 for most software).
After spending a few hours trying to fix it, we temporarily gave up and decided to try again after the H2O Timer project was finished (Which was in Feb 2020). Since then, we’ve discovered that upgrading ESP firmware is possible and, in fact, it's quite easy. But only after spending tens of hours researching online, eliminating a large amount of incorrect “web-wrong” URL’s and extracting the rather sparse correct information.
After successfully testing several versions, we settled on updating the firmware to version v2.2.1, as it’s the last version to support both the 32MB “Mega/Uno with WiFi” and the smaller ESP-01. So far, we haven’t found any bugs in V2.2.1, so it’s running on all of our WiFi combo Arduino’s and most of our ESP-01’s (we have quite a few).
All that’s needed to update the firmware on your Mega/Uno with WiFi is to set DIP switches 1,2,3,4 OFF and 5,6,7 ON (8 is not used).
If you’re updating a Mega, you also need to set the slide switch to TXD3. This allows you to use COM1 for Serial Debugging messages and COM3 for the ESP WiFi side and is 100% compatible with a standard Mega with separate ESP-10, like the DIYODE H2O Timer.
The DIP switches are minuscule (only 1mm spacing) and found it difficult to tell if they were on or off, so we used a texta colour to put a tiny dot on each DIP switch. Even then, we occasionally had to verify the settings using our phone’s camera as a magnifying glass. As we also needed a very small tool to actually set the DIP switches, we used a tiny DIY 3D printed 1mm screwdriver (https://www.thingiverse.com/thing:4168665), but any tiny tool would work.
We upgraded the firmware using a PC and the Espressif flash download tool, which is available at: https://www.espressif.com/sites/default/files/tools/flash_download_tools_v3.6.8.zip
We initially wasted an extraordinary amount of time getting this Flash Download tool to work. It turned out to be really easy, once you know how. The secret is in selecting the files, and equally importantly, the hex offset addresses. Once these are correct, it’s a doddle.
The V2.2.1 data files needed are at the very bottom of URL: https://github.com/espressif/ESP8266_NONOS_SDK/releases/tag/v2.2.1
Or directly from: https://github.com/espressif/ESP8266_NONOS_SDK/archive/v2.2.1.zip
There are also copies of both zip files that you can download from our website.
After downloading, unzip both files to your preferred folders. Run flash_download_tools_v3.6.8.exe, click on the ESP8266 DownloadTools button and select the ESP8266 Download Tool V3.6.8 window.
These are the files and offset addresses you need to enter (you can cut and paste from diyodemag.com to prevent hex address errors). These files are in subfolders of where you unzipped ESP8266_NONOS_SDK-2.2.1.zip
Each hex Address consists of 7 or 8 digit hexadecimal numbers, all beginning with 0x [zero “X”], followed by 5 or 6 hex numbers. (FYI - Hex numbers range from 0 to 9 plus abcdef, equating to (or matching) decimal numbers 0 to 15).
The ESP8266 Download Tool V3.6.8 window is used to set up the four bin files, their hex addresses, speed, size, and mode.
First, tick the left box, then click the ... Button which allows you to add each individual file, and then type in the corresponding offset address for each file. Also, set:
Also select the correct COM port (it’s much less confusing if there are no other COM ports in use).
Check your settings very very carefully. When every option is correct, press the reset button on your Arduino and then press the ESP8266 Download Tool’s START button.
The Download Tool’s status button will change from IDLE to SYNC and then to DOWNLOAD, also the DETECTED INFO box will show what’s actually inside your Arduino’s ESP WiFi chip.
The firmware download takes around 40 seconds to complete, after which the status button changes from DOWNLOAD to FINISH. When the firmware has finished uploading, set DIP switch 7 to OFF, to prevent any accidental reprogramming of your new firmware.
To verify everything worked OK, start your Arduino IDE (or preferred Serial comms program), open the Serial Monitor and set it to 115,200 baud and Both NL & CR (New Line & Carriage Return). Press the Arduino Mega/WiFi's Reset button then type in AT+GMR. You will see a line of garbage followed by:
If you don’t get a line saying “SDK version:2.2.1”, recheck everything, fix any typos or incorrect checkboxes and try again (don’t forget to set DIP 7 back ON first). When you do get this line, everything is good. By the way, you can ignore the first line of garbage, it’s just the ESP8266 responding with bootup information at 74,880 baud, before it switches to AT interpreter mode at 115,200 baud and displays the “ready” message. No doubt, it’s been left in for compatibility with old code.
That’s it really, to use your Arduino WiFi combo board as if it’s a standard Mega (or Uno) with an on-board ESP WiFi chip that responds to AT commands, and works with current Arduino WiFi libraries. Just set DIP switches 1,2,3,4 ON and 5, 6, 7 OFF and the slide switch to TXD3 (Mega only).
You can test if your WiFi actually works by using the H2O Timer software from Issue 031 Feb 2020, with just a Mega/WiFi combo board. Just set displayWiFi to true and displayRTC to false, and also enter your WiFi Name and password (in DIYODE-H2O-Timer.ino), and change the Arduino Serial Monitor baud rate to 250,000. When the program has been uploaded, the Serial port shows a WiFi connected message, similar to this.
You can also upgrade ESP-01 firmware with the ESP8266 Download Tool, but it’s much more complex and requires making a programmer.
The programming procedures for flashing an ESP82xx and ESP32 via the serial port differ slightly.
In general the steps are the same to enter flashing mode on both types ESP boards:
Boot the node with GPIO-0 connected to GND
Start the flashing procedure
Most boards which already have an USB to serial on board, also have some circuit present to help booting into flash mode via the USB port.Such a circuit consists of 2 transistors and a few resistors to trigger the reset and GPIO-0 pin in the correct sequence.All flashing software is able to use this way of bootstrapping.
Espressif Flash Download Tool Free
Some flashing tools also support different methods and thus require a parameter indicating the specific method to boot into flash mode.For ESP boards with an USB to serial adapter on board, the needed boot method is referred to as “NodeMCU” or some abbreviation of this name.
Flashing Software¶
A number of flashing tools is included in the nightly build ZIP files.The included tools are all for Windows.
ESP.Easy.Flasher.exe
A flasher with graphic UI written by Grovkillen. This tool can also be used to send a number of commands to prepare the unit while still connected to the PC. For example to configure WiFi.esptool.exe
A command line ESP8266/ESP32 build and upload helper tool, maintained by Ivan GrokhotkovFlashESP8266.exe
A very simple flash tool “ESPEasy Flasher” for ESP82xx. Should be called from the same directory as the compiled bin files:C:DownloadESPEasybin>..FlashESP8266.exe
EspressifFlashDownloadTool
located in the directoryEspressif_flash_download_tool_v3.8.5
. New versions can be found Espressif Download
For Linux or Mac users, the recommended tool for ESP82xx/ESP32 is esptool.py
Flashing Parameters¶
Some flash tools allow to set specific parameters, like flash chip related settings.Those parameters are also defined in the compiled .bin files, but when set in the flash tool they are overridden for the boot sequence.As soon as the ESPEasy code is executed, the configured parameters at compile time will be used.
N.B. Not all parameters can be set in all flashing tools.
See the documentation of the flash tool for more information.
Baud Rate¶
Most flashing tools allow to set the communication speed.It is advised to use a baud rate of 115200 bps as this seems to be the best trade off between flashing speed and success rate.However it is possible to select a higher baud rate, which may reduce flashing time significantly.
Boards using a FTDI USB to serial chip seem to work fine when flashing at rates of upto 921600 bps.When they fail, it is often presented as a timeout. Try again with flashing at a lower baud rate.
Boards using a CH340 USB to serial chip are less likely to handle high baud rates without errors.
Crystal¶
On ESP8266, the tool will overwrite the 48th byte of RF parameter(default_init_data.bin) if chosen.This option will do nothing for ESP32 chips.
SPI Speed¶
This is the SPI clock speed to read/write SPI flash. (40Mhz default)
Usually 40Mhz is enough and safe, if you want to enable 80Mhz for SPI flash, makesure:
The flash you are using support 80Mhz.
Your PCB layout is good enough for 80Mhz.
The configure byte is in the 4th byte from flash address 0x0. So the tool will overwritethe 4th byte of bin file which is to be written to 0x0 address.
SPI Mode¶
This sets the SPI data mode for flash R/W operations.
From fastest to slowest mode:
QIO/QOUT: use /HOLD and /WP pin as SPI data2/data3, make sure your flashsupport Quad instructions before select.QIO and QOUT are almost the same. “QIO” will send address in quad mode, where “QOUT” will not.
DIO/DOUT: Use Dual mode instructions to read/write flash.DIO and DOUT are almost the same. “DIO” will send address in Dual mode, where “DOUT” will not.
Almost all flash chips used on ESP32 support DIO/DOUT mode.
Almost all ESPEasy builds are set to use “DOUT” mode.
ESP82xx¶
ESPEasy builds based on esp8266/Arduino library version 2.7.x and later can handle compressed .bin.gz
files.When in doubt, just use the .bin
files.
ESP32¶
Flashing ESP32 nodes is slightly more complex compared to ESP82xx.
The main differences:
How To Use Esp32 Flash Download Tool
The binary layout on the flash is split in several parts each with their own specific offset from the start of the flash block.
ESP32 allows to have several fuses set (flags which can be set only once)
Flash Download Chrome
Most tutorials show the Espressif Download Tool with a number of separate binaries each with their own offset.This is rather error prone, and therefore the ESPEasy build process creates 2 different .bin files.
A binary with
factory
in the file name, used for flashing via serial.A binary without
factory
in the file name, used for flashing via the web interface.
Espressif Flash Download Tool V2 4
The factory
bin file has all separate binaries with their offsets included in a single file.Therefore the needed offset for this factory
bin file should be set to 0. (starting at the begin of the flash area)
When the ESP board later needs to update the firmware to a different version, there is no need for a serial connection.This can be done “OTA” (over the air) via the web interface.For OTA updates, use the bin file withoutfactory
in the file name.