-
1Step 1
Cloning firmware from one ESP32 to another is a powerful technique for replicating the functionality of a programmed device onto a new one. Whether you're preparing for mass production, troubleshooting, or simply saving time, this guide will walk you through two simple and effective methods for firmware cloning.
We’ll explore:
- The Software Method – The easiest and most user-friendly approach.
- The Command Line Method – A versatile option for advanced users.
We’ll start with the Software Method to quickly clone the firmware with minimal effort. By the end of this guide, you’ll have a clear understanding of both methods and the confidence to replicate ESP32 firmware seamlessly.
By the way, subscribe to my YouTube channel for more projects like this. I also update my upcoming projects on Instagram.
buy me a coffee! ☕: Donate
Supplies
- 2 x ESP32 Dev Module (amazon.com / amazon.in)
- 2 x Micro USB Cable (amazon.com / amazon.in)
Upload Initial Firmware
For a simple explanation, we will upload basic Arduino code to both ESP32 devices, which will print a message on the serial monitor to identify each ESP.
Connect the Source ESP32:
- Use a USB cable to connect the ESP32 to your computer.
- Identify its COM port (e.g., COM5).
Upload Code:
Upload a firmware to the source ESP32. For this tutorial, we assume it displays the message "I AM ESP32 A".
void setup() { Serial.begin(115200); } void loop() { Serial.println("I AM ESP32 A"); }
Connect the Target ESP32:
- Similarly, connect the target ESP32 to the computer via USB.
- Identify its COM port (e.g., COM8).
Upload Placeholder Code:
Upload a placeholder firmware to the target ESP32, such as "I AM ESP32 B".
void setup() { Serial.begin(115200); } void loop() { Serial.println("I AM ESP32 B"); }
Extract Firmware From Source ESP32
Download the folder from my GitHub.First, we will extract the code using the software method.
Software Method:
- Open the software provided in the folder.
- Click on "Rescan" to detect the COM port.
- Select the COM port of the source ESP32.
- Set the flash size of the ESP32.
- Select "Mode" as Read.
- Choose the path where you want to save the file.
- Click on the "Start" button.
After pressing "Start, " a terminal will open and begin the process. A progress percentage will be displayed, which will increase gradually (this may take some time). Once the percentage reaches 100 % the read process is successful.
Command Line Method:
- Open the folder named "Python_file".
- Open the file "Manual_Commands.txt".
- Update the COM port in the first command line in the text file to match the source ESP32's COM port.
- Copy the first command line from the file.
- Open a command terminal by typing CMD in the path bar of the folder.
- Paste the command into the terminal and press Enter.
The terminal will initiate the process. A progress percentage will be displayed, which will gradually increase (this may take some time). Once the percentage reaches 100>#/b###, the read process is successfully completed.
# READ FILE FROM ESP32
esptool.exe --port COM5 read_flash 0x00000 0x400000 flash_contents.bin
Flash Firmware to Target ESP32
Download the folder from my GitHub. Next, we will upload the code to the target ESP32 using the software method.
Software Method:
- Open the software provided in the folder.
- Click on "Rescan" to detect the COM port.
- Select the COM port of the target ESP32.
- Set the flash size of the ESP32.
- Select "Mode" as Write.
- Choose the file that was extracted from the source ESP32.
- Click on the "Start" button.
After pressing "Start, " a terminal will open and begin the process. The progress percentage will gradually increase (this may take some time). Once the percentage reaches 100>#/b###, the write process will be successfully completed.
Command Line Method:
- Open the folder named "Python_file".
- Open the file "Manual_Commands.txt".
- Change the COM port in the second command line of the text file to the target ESP32's COM port.
- Copy the second command line from the file.
- Open a command terminal by typing CMD in the path bar of the folder.
- Paste the command into the terminal and press Enter.
The terminal will begin the process. A progress percentage will be displayed, gradually increasing (this may take some time). Once the percentage reaches 100>#/b###, the write process will be successfully completed.
# WRITE FILE FROM ESP32
esptool.exe --port COM8 write_flash 0x00000 flash_contents.bin
Verify the Cloning Process
1.Reconnect the Target ESP32:
- Disconnect and reconnect the target ESP32.
- Open a serial monitor (e.g., Arduino IDE or any terminal software).
2.Check the Output:
- Observe the output of the target ESP32.
- If it displays "I AM ESP32 A", the cloning process was successful.
Cloning firmware from one ESP32 to another is straightforward using ESPTool. This technique ensures consistency across devices, saving time and effort when programming multiple units. Expand your knowledge by experimenting with different firmware versions and ESP32 setups.
If you found this guide helpful, don’t forget to like, share, and subscribe to our YouTube channel for more tutorials!
☕ Buy me a coffee! Donate
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.