34 Flashing
Adrian Scillato edited this page 2019-12-01 11:28:49 -03:00

If you have read through the Prerequisites you should have selected a pre-compiled Tasmota firmware binary or chosen to compile your own Tasmota firmware binary.

Once you have followed Hardware preparation, your device should be in Flash Mode and ready for a Tasmota firmware binary file to be flashed. For that you need a flashing tool.

Optionally, you may want to back up the device manufacturer's firmware. To do so, you must use esptool. Refer to the instructions below.

Tasmota PyFlasher

Tasmota PyFlasher is specifically designed for use with Tasmota binaries with an easy to use GUI. It is based on NodeMcu Pyflasher and esptool.py.

Download the latest release for your platform (currently only Windows). Double click the downloaded file and it'll start, no installation required. Simple and fast...

Tasmota PyFlasher UI

  1. Connect your device to the serial-to-USB adapter or plug in NodeMCU/D1 mini.
  2. Select the correct Serial port (COM# port). Leave on auto-select if not sure.
  3. Browse to the Tasmota firmware binary you downloaded or compiled.

🔴 Set Erase flash to yes, wipe all data!!! if it is the first time flashing Tasmota on the device or you're experiencing issues with the existing flash and need to do a full erase.
If you're upgrading an already flashed Tasmota and wish to keep your settings, set it to no.

  1. Click Flash Tasmota and wait until done.

If the flash was successful the Console window will display:

Flash succeeded

Unplug your serial programming adapter or device and plug it back in or connect to another power source. Your device is now ready for Initial configuration. For proper device initialization after the firmware upload completes, power down and power up the device.

Common mistakes

Message COM# failed to connect: Failed to connect to Espressif device: Timed out waiting for packet header means your device is not connected (recheck COM port number and USB cable) or not in flash mode (retry flash mode procedure for your device).

Sometimes a "successful" flash will still result in a device that does not function as expected. If your device exhibits strange behaviors, we recommend that you use esptool.py to erase the flash as described below. And, if you are using esptool.py for erasing, you might as well upload the firmware that way as well. But definitely erase using esptool.py.

esptool.py

Esptool is the official tool for flashing ESP8266 chips and is the most reliable. Use version 2.8 or up.

It requires Python, if you do not have an installed copy of Python 2.x or 3.x download and install it from https://www.python.org.

Download the esptool Source code to a folder of your choice. Go to the folder and install Esptool with command

python setup.py install

Upload Tasmota

Make sure you followed the steps to put your device in flash mode. Place your chosen firmware binary file in the same folder as esptool.py.

Esptool uses the serial interface to communicate with your device. On Windows these interfaces are named COM1, COM2, etc. and on Linux they are named /dev/ttyUSB0, /dev/ttyUSB1, etc. Before using esptool, make sure you know which serial port your programming adapter is connected to.

The following use COM5 as an example. Change COM5 with your serial port designation.

Ensure the device is in flash mode before each step.

Optional: Backup firmware

Backup the current firmware with the following command:

esptool.py --port COM5 read_flash 0x00000 0x100000 fwbackup.bin

When the command completes the device is not in flash mode anymore. Repeat the process of putting your device in programming mode.

Erase flash memory

Erase the complete flash memory holding the firmware with the following command:

esptool.py --port COM5 erase_flash

It only takes a few seconds to erase 1M of flash.

When the command completes the device is not in flash mode anymore. Repeat the process of putting your device in programming mode.

Upload firmware

Load the chosen Tasmota firmware file with the following command (e.g., tasmota.bin in this example):

esptool.py --port COM5 write_flash -fs 1MB -fm dout 0x0 tasmota.bin

Unplug your serial programming adapter or your device and plug it back in or connect to another power source. Your device is now ready for Initial configuration. For proper device initialization after the firmware upload completes, power down and power up the device.

Esptool executable

The executable version of esptool is maintained by Ivan Grokhotkov and releases are kept at https://github.com/igrr/esptool-ck/releases. Supports Linux, Linux ARM, Windows 32-bit and Mac

Download and install

For the purpose of simplicity only the Windows version will be explained here, but the commands and parameters are the same for Windows, Linux and Mac.

Download the latest release of Esptool-CK and extract the compressed file to a folder of your choice.

Upload Tasmota

Place your chosen firmware binary file (e.g., tasmota.bin in the example below) in the same folder as Esptool-CK to simplify the process.

The following commands use COM5 as an example. Change COM5 with your port designation.

Ensure the device is in flash mode before each step.

Erase flash memory

esptool -cp COM5 -ce -v

Upload firmware

Once the erase is complete, put device back into programming mode and upload the firmware

esptool -cp COM5 -bm dout -cf tasmota.bin -v

Unplug your serial programming adapter or your device and plug it back in or connect to another power source. Your device is now ready for Initial configuration. For proper device initialization after the firmware upload completes, power down and power up the device.

Flashing and compiling from source

Tutorials for setting up development environments if you want to modify the code or default settings and compile your own binaries.

In PlatformIO, be sure that you always have the latest build of the ESP Core. Delete the following in your .platformio folder (%USERPROFILE%\.platformio in Windows):

  • Everything in .platformio/platforms
  • All folders that begin with framework... in .platformio/packages

Online Compilers

Can only create a firmware binary. Use one of the tools to flash it to your device.

  • Gitpod - compile your own binary in the cloud using Gitpod.
  • TasmoCompiler - simple web GUI to compile Tasmota with your own settings

OTA Flashing Tools

Tasmota is NOT a developer of these tools. For help and troubleshooting you will need to get support from those projects.

Need more help?

If you have encountered problems during flash see the FAQ. Ask for help in Discord or Community Forum