How to back up and restore the programming of an ESP WROOM 32 to Another ESP WROOM 32
Step 1: Preparation
- Install Python and pip (if they are not already installed):
sudo apt update sudo apt install python3 python3-pip
- Install the latest version of esptool: First, remove any old versions of esptool:
sudo pip3 uninstall esptool sudo apt remove python3-esptool
Then, install the newest version via pip:pip3 install esptool
Step 2: Reading the Firmware from the Original ESP WROOM 32
- Connect the original ESP WROOM 32 to your computer via USB.
- Identify the serial port:
Run the following command to find the serial ports:ls /dev/ttyUSB*
Note the serial port that appears, for example,/dev/ttyUSB0
. - Read the firmware:
Use esptool to read the firmware. Replace/dev/ttyUSB0
with the correct serial port if needed:bash esptool.py --chip esp32 --port /dev/ttyUSB0 read_flash 0x00000 0x400000 firmware_backup.bin
This command reads 4MB (0x400000 bytes) of flash memory and saves it to the filefirmware_backup.bin
.
Step 3: Flashing the Firmware to the New ESP WROOM 32
Flash the firmware to the new ESP WROOM 32:
Use esptool to flash the firmware to the new ESP. Replace /dev/ttyUSB0
with the correct serial port if needed:bash esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x00000 firmware_backup.bin
Connect the new ESP WROOM 32 to your computer via USB.
Identify the serial port:
Repeat the command: ls /dev/ttyUSB*
Note the serial port that appears for the new ESP WROOM 32.