Firmware update


How does the host MCU flash ESP32 via serial interfaces?

How to automatically flash Espressif’s modules using the USB-Serial tool?

The methods are as follows:








Serial tool








For ESP8266 modules, IO15 should be specially connected to ground.

How to flash firmware in macOS and Linux systems?

  • For Apple system (macOS), you can use esptool downloaded via brew or git to flash firmware.

  • For Linux system (e.g., ubuntu), you can use esptool downloaded via apt-get or git to flash firmware.

Does ESP32 support programming using JTAG pins directly?

Yes, please refer to JTAG Debugging.

Does ESP_Flash_Downloader_Tool support customized programming control?

  • The GUI tool is not open sourced and does not support embedded executive script.

  • The low-level component ESPtool is open sourced and can be used to perform functions such as flashing and encryption. It is recommended to conduct secondary development based on this component.

Can I enable the Security Boot function for ESP32 via OTA?

  • This is not recommended since it may cause risks and needs to upgrade OTA firmware for multiple times.

  • Since the Security Boot function is in Bootloader, please update Bootloader first to enable this function.

    1. First, check the partition table of your current device to see if it can store the Bootloader with Security Boot function enabled.

    2. Then, update an intermediate firmware which can be written in Bootloader partition. By default, the Bootloader partition cannot be erased or written, you need to enable them via make menuconfig.

    3. Sign the intermediate firmware and upgrade it to the target device through OTA. Then upgrade the Bootloader of this firmware and the signed new firmware through OTA.

    4. If there are situations as powered-down or network break-down and restart during the Bootloader OTA process, the device cannot be started and needs to be re-flashed.

When flashing firmware to ESP32-S2, an error occurred as “A fatal error occurred: Invalid head of packet (0x50)”. How to resolve such issue?


When flashing firmware to an ESP32-S2 device based on ESP-IDF v4.1, the following error code occurred: v2.9-dev
Serial port /dev/ttyUSB0
Chip is ESP32S2 Beta
Features: Engineering Sample
Crystal is 40MHz
MAC: 7c:df:a1:01:b7:64
Uploading stub...
Running stub...

A fatal error occurred: Invalid head of packet (0x50) failed with exit code 2


If the chip you are using is ESP32-S2, not ESP32-S2 Beta, please update ESP-IDF to v4.2 or later versions.


  • ESP-IDF v4.1 only supports ESP32-S2 Beta, which is not compatible with ESP32-S2.

  • The version of esptool came with ESP-IDF v4.1 is v2.9-dev, which also only supports ESP32-S2 Beta.

  • ESP-IDF v4.2 supports ESP32-S2 chips, and its esptool is v3.0-dev, which supports ESP32-S2 too.

How to download firmware based on esp-idf using flash_download_tool?

  • Taken hello-world example for instance, please refer to get-started-guide when building an esp-idf project for the first time.

  • Run build (Only for esp-idf v4.0 or later versions. Please use make for previous versions). After the build finished, the following flash command for the bin file will be generated:

#Project build complete. To flash, run this command:
../../../components/esptool_py/esptool/ -p (PORT) -b 921600 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x10000 build/hello-world.bin  build 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin
or run ' -p PORT flash'

What is the communicationg protocol for flashing ESP chips?