Home | ESP8266 | ESP EASY | ESP Easy: flash the firmware with esptool.py on ESP8266 (GitHub)

ESP Easy: flash the firmware with esptool.py on ESP8266 (GitHub)

ESP Easy is very easy to flash on Windows using the installation utility contained in the project repository. If you are a Linux user (PC, Raspberry Pi, Orange PI …) or macOS, it will be necessary to use esptool.py already presented in this tutorial. In this tutorial, we will install on firmware on a Wemos D1 Mini, but the method also applies to all ESP8266 NodeMCU (beware, some cards need to be in bootload mode before you can flash the firmware).

Install Python and esptool.py

Before you begin, make sure that python version 2.7.x is installed. Open the Terminal and run Python. If Python is installed, the shell must start. Type exit() to exit the shell.

If Python is not installed on your machine, install it by going here.

To install esptool.py, it is best to let Python load it so that all dependencies are installed at the same time.

In case of difficulty, you can also run python -m pip install esptool or pip2 install esptool.

On Windows

Launch PowerShell (which allows you to run Unix commands). Go to the esptool installation directory, for example Documents and launch the installation of esptool (and dependencies) as on macOS or Linux.

You can now call esptool.py from anywhere. Indeed, it was installed in the default executables directory of Python (C:\Python27\Scripts\).

Flash the ESP Easy firmware on a Wemos D1 Mini

Now that everything is ready, we will be able to launch the installation. In a Terminal, go to the ESP Easy directory. You can retrieve it directly from GitHub here or clone it using the command

The esptool.py command to flash the flash memory of an ESP8266 is of the following form

The following parameters must therefore be set:

  • The serial port on which the ESP8266 is connected. On moaOS or linux, run the ls /dev/tty.*  command. On Windows, run mode in the command prompt
  • mode (-fm or –flash_mode): dio by default
  • size (-fs or –flash_size): 32m for 4MB
  • nodemcu-firmware: the path to the binary to flash. Here ESPEasy_Rxxx_xxxx.bin
    What gives for example for a Wemos D1 Mini (4MB)
It is possible to specify other parameters

  • baud (- baud): the transfer speed. In case of problem, it should not hesitate to decrease it to 115200 bauds for example.
  • after (–after): allows to reset (no_reset, hard_reset or soft_reset) after the flash operation.

How to flash ESP Easy on another ESP8266 NodeMCU card

Esptool.py is a utility for all ESP8266 cards on the market. You will have to adapt the command by passing the parameters that correspond to your card. It also works for the new generation ESP32. To do this, you will need to go to the esptool.py documentation that is located here. Esptool.py send another

The NodeMCU, WeMOS, HUZZAH Feather, Core Board, ESP32-WROVER-KIT cards are able to switch to bootload mode, for the others it will be necessary to apply the classical method already explained in this tutorial.

To recover the characteristics of the card, run the command esptool.py --port COMx flash_id

Bonus: How to Determine the Memory Size of an ESP8266

This is a recurring problem because the size of the memory is never noted on the cards. If you have more than one model, you may soon have problems. Here’s how to determine the size of memory from identifier and manufacturer.

First, go to this page that lists the chip makers ESP8266 https://code.coreboot.org/p/flashrom/source/tree/HEAD/trunk/flashchips.h

Do not worry about the manufacturer, here “ef”. Search the device id, here 0x4016. You will find the following lines:

  • #define AMIC_A25LQ032                          0x4016 /* Same as A25LQ32A, but the latter supports SFDP */
  • #define ESMT_F25L32QA                         0x4016
  • #define GIGADEVICE_GD25Q32            0x4016 /* Same as GD25Q32B */
  • #define SPANSION_S25FL132K              0x4016
  • #define WINBOND_NEX_W25Q32_V  0x4016 /* W25Q32BV; W25Q32FV in SPI mode (default) */

By convention, it is necessary to take the last 2 digits of the code without taking care of any letters that are behind (no idea of ​​the meaning at the moment). Here, we will take 32. Still by convention, this figure indicates the amount of memory in megabits, which is therefore 32Mb, or 4Mo (a converter in line).

For the moment, this is the only method I have found. If you have easier, feel free to share in the comments.

Special case of the Wemos d1 mini Pro 16MB

In theory, the ESP8266 is capable of supporting up to 128Mb (16MB) of QSPI flash memory. This is the case of the new Wemos d1 mini Pro. If we look for 0x4018, the device number, we will find for example GIGADEVICE_GD25Q128. In this case, one will take 128. After conversion, one obtains 16Mo (128Mb). It will be said rather that take the last 2 or 3 digits of the code in the last letters

And on Windows?

On Windows, everything works the same. Esptool being a Python script, the program is cross-platform. It will simply change the port of destination. On Windows it will be of the form COM1, COM2 … To know the COM port to which the ESP8266 is connected, execute the command mode. The command allows to retrieve many more parameters than the command under Linux.

Nothing works ! Clear memory

If you encounter installation problems, you may try to erase the memory with the erase_flash command.