Is there a way to update the firmware on one ESP32 from another ESP32 over USB, similar to how firmware can be updated using esptool.py?
This would essentially be like a port of whatever magic esptool.py uses over USB to update an ESP32, but instead of running through Python it would be an Arduino C++ sketch and would read the firmware to write to the other ESP32 from SPIFFS.
-
3since ESP32 doesn't have an USB peripheral on chip, a better idea would be to that over the UART. did you research before asking? did you find something? did you try something?Juraj– Juraj ♦10/19/2021 04:53:31Commented Oct 19, 2021 at 4:53
-
Thanks for sharing your opinion, @Juraj. However, all of the ESP32s that I am working with include a CP2102 USB to UART bridge.Dan– Dan10/20/2021 01:43:04Commented Oct 20, 2021 at 1:43
-
2can CP2102 act as USB host? no.Juraj– Juraj ♦10/20/2021 05:48:48Commented Oct 20, 2021 at 5:48
-
That's a great point, @JurajDan– Dan10/20/2021 13:58:45Commented Oct 20, 2021 at 13:58
-
1you know that you can use OTA upload?Juraj– Juraj ♦10/22/2021 05:26:36Commented Oct 22, 2021 at 5:26
3 Answers 3
To flash an ESP32 using another ESP32:
Enter Bootloader Mode: Pull the BOOT_PIN of the target ESP32 LOW and toggle the EN_PIN to reset it, placing it in bootloader mode. Sync with Bootloader: Send a SYNC command from the master ESP32 to establish communication. Configure Flash: Use the SPI_ATTACH command to prepare the target’s flash memory. Initialize Flashing: Send a FLASH_BEGIN command to specify data size, memory location, and block sizes. Transfer Firmware: Send firmware in small chunks (e.g., 1 KB) using FLASH_DATA, with checksums for accuracy. Complete Flashing: Use the FLASH_END command to finalize. The target ESP32 can reboot to run the new firmware. I’ve created a library to streamline this process. You can find it here: Flashing Firmware to an ESP32 Using Another ESP32.
-
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.01/01/2025 09:02:09Commented Jan 1 at 9:02
-
1Link only answers are not acceptable. You can link to your post, but this post needs to be self contained.Rohit Gupta– Rohit Gupta01/01/2025 09:03:08Commented Jan 1 at 9:03
-
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Reviewsa_leinad– sa_leinad01/06/2025 11:13:04Commented Jan 6 at 11:13
-
Please edit your answer to include the steps outlined in your linked page. Or even copy the whole guide here for everyone to reference. Link only answers are against the guidelines and will be deleted by the community. Nick Gammon has written a great post on how to write good answers.sa_leinad– sa_leinad01/06/2025 11:21:31Commented Jan 6 at 11:21
Espressif has an official library. Here's the link:
https://github.com/espressif/esp-serial-flasher
Personally, I recommend this GitHub repository named "FlashBox - Esp32 serial flasher" by Machiel80. Here's the link:
https://github.com/Machiel80/esp32-serial-flasher
it has good documentation and even a video on YouTube explaining how it's done.
Finally, the flipperZero project also has a serial flasher project on Github, the "flipperzero-esp-flasher". Here's the link:
You can use the SD card to update the firmware. Here is the example code