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 (attention, some cards need to be in bootload mode before you can flash the firmware).

Install Python and esptool.py

Before you begin, verify that the version 2.7.x of python is installed correctly. Open the Terminal and run Python. If Python is installed, the shell must be started. Type exit() to exit the shell.

Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

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.

pip install esptool

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.

PS C:\Users\Christophe\Documents> pip install esptool
Collecting esptool
  Downloading esptool-1.3.tar.gz
Collecting pyserial>=2.5 (from esptool)
  Using cached pyserial-3.2.1-py2.py3-none-any.whl
Installing collected packages: pyserial, esptool
  Running setup.py install for esptool ... done
Successfully installed esptool-1.3 pyserial-3.2.1
PS C:\Users\Christophe\Documents>

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

Flash ESP Easy firmware on a Wemos D1 Mini

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

git https://github.com/espressif/esptool.git

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

esptool.py --port [serial-port-of-ESP8266] write_flash -fm [mode] -fs [size] 0x00000 [nodemcu-firmware] .bin

We must therefore pass the following parameters:

  • 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)

esptool.py --port COM3 --baud 115200 write_flash -fm dio -fs 32m 0x00000 ESPEasy_R120_4096.bin

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 baud 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. It will be necessary to adapt the command by passing the parameters that correspond to your card. It also works for the new generation ESP32. To do this, it will be necessary to go in the documentation of esptool.py which is here. Esptool.py send another

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

To retrieve the characteristics of the card, run the command esptool.py –port COMx flash_id

C:\Users>esptool.py --port COM3 flash_id
esptool.py v1.3
Connecting....
Manufacturer: ef
Device: 4016

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.

PS C:\Users\Christophe\Documents\esptool-master> mode

Statut du périphérique COM3:
----------------------------
    Baud :            1200
    Parité :          None
    Bits de données : 7
    Bits d’arrêt :    1
    Temporisation :   OFF
    XON/XOFF :        OFF
    Protocole CTS :   OFF
    Protocole DSR :   OFF
    Sensibilité DSR : OFF
    Circuit DTR :     ON
    Circuit RTS :     ON


Statut du périphérique CON:
---------------------------
    Lignes :          3000
    Colonnes :        120
    Vitesse clavier : 31
    Délai clavier :   1
    Page de codes :   850

Nothing works ! Clear memory

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

esptool.py --port COM3 erase_flash

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

Tags:

3 Comments
  1. hi, managed to flash with mac, but the ESP_0 ssid is asking for a password?

  2. After my Win 7 laptop HD failed I been running Linux Mint via a live USB session but cannot get past launching python.

    pip install esptool generates an Invalid syntax error.

    entering: python -m pip install esptool generates a no module named pip

    entering: python -m pip2 install esptool generates a no module named pip2

    As this is my first foray into Linux I am probably making a stupid mistake but some underlying steps may be missing for Windows nuts like me.

    I had successfully flashed 12 sonoffs with Tasmota and the 13th one failed just as my HD failed. I have this one sonoff and a Sonoff TH10 remaining to flash so any assistance would be greatly appreciated.

Leave a Reply

DIY Projects
%d bloggers like this: