Skip to content

Flashing

Gunnar Skjold edited this page Jan 18, 2024 · 12 revisions

In the Release section of this repository, you will find precompiled binaries for ESP8266 and ESP32 boards.

Use esptool for flashing. You can download the latest version here: esptool releases. If you are not familiar with this tool from earlier, the easiest is to download a binary suitable for your operating system. F.ex. download esptool-vX.Y.Z-win64.zip for Windows.

The procedure differs for ESP8266 and ESP32. Substitute the command with appropriate COM port.

ESP8266

esptool --chip esp8266 --port <port> --baud 115200 --before default_reset --after hard_reset write_flash 0x0 firmware.bin Substitute <port> with correct COM port your device is connected to. Ex /dev/ttyUSB0 for Linux or COM1 for Windows

ESP32

For ESP32 you will need four files to flash the device, you find them in the ZIP file you get from the Release section of this repository.

esptool --chip esp32 --port <port> --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 firmware.bin

When firmware is already installed and you use esptool to upgrade to a new version, a shorter command can be used to avoid config being overwritten

Substitute <port> with correct COM port your device is connected to. Ex /dev/ttyUSB0 for Linux or COM1 for Windows

esptool --port <port> --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 firmware.bin

ESP32-S2

The S2 version of ESP32 has the same procedure as the original ESP32, but different files. Get them from the Release section of this repository.

esptool --chip esp32s2 --port <port> --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0x8000 partitions.bin 0xe000 boot_app0.bin 0x10000 firmware.bin

When firmware is already installed and you use esptool to upgrade to a new version, a shorter command can be used to avoid config being overwritten

Substitute <port> with correct COM port your device is connected to. Ex /dev/ttyUSB0 for Linux or COM1 for Windows

esptool --port <port> --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 firmware.bin

Erase flash

If the device stops responding or unpredictable behaviour, a flash erase might be needed before flashing. Read more here

esptool --port <port> erase_flash

No USB-TTL adapter? How to use Raspberry PI GPIO for flashing

The below wiring is valid for Pow-K, but can be adapted for any board that does not have a USB-TTL adapter

External power header:

  • PI GPIO 2 (5V) to "+"
  • PI GPIO 6 (Ground) to "GND"

FTDI 3v3 header:

  • PI GPIO 9 (GND) to "GND" (J2)
  • PI GPIO 8 (UART TX) to "tx" (J2)
  • PI GPIO 10 (UART RX) to "rx" (J2)

Put the board in flash mode (hold PROG and click RESET), then use esptool as explained above with port /dev/ttyAAMA0