1

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.

asked Oct 19, 2021 at 0:17
5
  • 3
    since 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? Commented 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. Commented Oct 20, 2021 at 1:43
  • 2
    can CP2102 act as USB host? no. Commented Oct 20, 2021 at 5:48
  • That's a great point, @Juraj Commented Oct 20, 2021 at 13:58
  • 1
    you know that you can use OTA upload? Commented Oct 22, 2021 at 5:26

3 Answers 3

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.

answered Jan 1 at 6:23
4
  • 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. Commented Jan 1 at 9:02
  • 1
    Link only answers are not acceptable. You can link to your post, but this post needs to be self contained. Commented 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 Review Commented 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. Commented Jan 6 at 11:21
2

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:

https://github.com/0xchocolate/flipperzero-esp-flasher

answered Jun 11, 2024 at 17:48
0

You can use the SD card to update the firmware. Here is the example code

answered Jul 20, 2022 at 9:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.