Skip to Content

Ready-to-use firmware binaries available in downloads

Esptool



How to setup and configure Esptool for RBgrid firmware upload on ESP32

The information below is for the Python version of esptool - If you want to use the Windows/Linux/OSX(MAC) executable version of esptool (as would be included in Arduino ESP32 cores) then please go to the esptool executable (Windows, MacOs and Linux) section at the bottom.



Download Esptool

If you do not have an installed copy of Python download and install it from https://www.python.org/.

Download Esptool Source code from https://github.com/espressif/esptool/releases to a known folder.



Install Esptool

Go to the known folder and install Esptool with command python setup.py install.

Packages for Esptool are maintained for Debian and Ubuntu and can be installed with sudo apt install esptool.



Download RBgrid Firmware

Download the latest rbgrid firmware file rbgrid.bin to a known folder.



Upload RBgrid Firmware


Put device in firmware upload mode

When performing a firmware upload do not connect the device to AC but use the power supply provided by your (FTDI/USB-to-Serial) interface.

Put the device in firmware upload mode by:
- Holding down the BOOT button (GPIO0) while pressing the RESET button
- Release the RESET button while still holding BOOT
- Release the BOOT button after 1-2 seconds

For development boards without BOOT button, ground pin GPIO0 while applying power or pressing reset.

Connect the serial interface of your PC to the device.

Esptool uses the serial interface to communicate with your device. On Windows these interfaces are named COM1, COM2 etc. On Linux these interfaces are called /dev/ttyUSB0, /dev/ttyUSB1 etc. On MacOS they appear as /dev/tty.usbserial-* or /dev/tty.SLAB_USBtoUART.

Before using Esptool make sure you know to which serial interface name your device is connected to.

In the following commands I use COM5 as an example.


Optional: Backup firmware

Ensure the device is in firmware upload mode.

Backup the current firmware with the following command:

shell
esptool.py --port COM5 --chip esp32 read_flash 0x00000 0x400000 rbgrid_image4M.bin

NOTE: When the command completes the device is out of firmware upload mode!


Erase firmware

Ensure the device is in firmware upload mode.

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

shell
esptool.py --port COM5 --chip esp32 erase_flash

NOTE1: When the command completes the device is out of firmware upload mode!
NOTE2: It only takes a few seconds to erase the flash.


Upload firmware

Ensure the device is in firmware upload mode.

Load the downloaded rbgrid firmware file rbgrid.bin with the following command:

shell
esptool.py --port COM5 --chip esp32 write_flash --baud 460800 --before default_reset --after hard_reset --flash_mode dio --flash_freq 40m --flash_size 4MB 0x1000 bootloader/bootloader.bin 0x20000 rbgrid.bin 0x10000 partition_table/partition-table.bin 0x17000 ota_data_initial.bin

For devices with different flash configurations, you may need to adjust parameters:
- For 8MB flash: use --flash_size 8MB
- For 16MB flash: use --flash_size 16MB

NOTE1: When the command completes the device is out of firmware upload mode!
NOTE2: For a proper device initialization after first firmware upload power down and power up the device.



ESPTOOL Executable (Windows, MacOs and Linux)

The executable version of esptool can be downloaded from https://github.com/espressif/esptool/releases


Download and Install

For the purpose of simplicity only the Windows version will be explained here, but the command and parameters are the same for Windows, Linux and MAC/OSX.

Download the latest release from https://github.com/espressif/esptool/releases and extract the compressed file to a known location.


Download RBgrid Firmware

Download the latest rbgrid firmware file rbgrid.bin to a known folder (The same folder as where you have the esptool executable will work well for this process to be simpler).

The information posted further up in this Wiki for placing the device into bootload / firmware upgrade mode may be followed as this process does not change irrespective whether you use the Python or executable version of esptool.

Once the device is in firmware upload mode the following commands are recommended for completion of the firmware flashing.

Erase the flash completely with the following command (substituting the COM port for the one which was used on your computer):

shell
esptool.exe --port COM5 --chip esp32 erase_flash

Once the erase is complete, reset your device back into programming mode and then upload the firmware using the following command:

shell
esptool.exe --port COM5 --chip esp32 write_flash --baud 460800 --before default_reset --after hard_reset --flash_mode dio --flash_freq 40m --flash_size 4MB 0x1000 bootloader/bootloader.bin 0x20000 rbgrid.bin 0x10000 partition_table/partition-table.bin 0x17000 ota_data_initial.bin


Important Notes for ESP32

  1. Boot Mode: Most ESP32 development boards have a BOOT button that needs to be held during reset to enter download mode
  2. Flash Address: ESP32 applications typically start at 0x20000
  3. Baud Rate: ESP32 supports higher baud rates (460800 is recommended for faster uploads)
  4. Flash Size: Most ESP32 modules have 4MB flash, but verify your specific module
  5. USB Drivers: Some ESP32 boards use CP2102/CP2104 or CH340 USB-to-Serial chips that may require driver installation