Page 1 of 1

Flash ESP32 via SPI?

Posted: Thu Apr 22, 2021 3:46 am
by FrozenArm
I'm trying to understand if the following is feasible and how I could go about it.

If the only way I had to communicate with an ESP32 chip was via another microcontroller using SPI. Could I the SPI to flash the ESP32? If so, how could I go about it?

Re: Flash ESP32 via SPI?

Posted: Thu Apr 22, 2021 5:31 pm
by Franco
Hi there,
you could write the new image in the flash memory via SPI and then perform ESP32 programming using OTA method.

Re: Flash ESP32 via SPI?

Posted: Thu Apr 22, 2021 7:52 pm
by FrozenArm
What if I wanted to flash all of it? Partition table, OTA initial data, app image, bootloader reflash digest, NVS encryption key? Same process or would I need to do something special?

Also, what can I look into to find out how to do this?

Re: Flash ESP32 via SPI?

Posted: Fri Apr 23, 2021 7:54 pm
by WiFive
There are some topics about reflashing the bootloader and partition table with ota, which is not supported and has the risk of bricking the device but is possible. Ota over spi can be treated similarly to ota over network. The only way to have full recovery ability would be to be able to set the boot mode and flash over uart.

Re: Flash ESP32 via SPI?

Posted: Thu Apr 29, 2021 5:45 pm
by FrozenArm
WiFive wrote: There are some topics about reflashing the bootloader and partition table with ota, which is not supported and has the risk of bricking the device but is possible. Ota over spi can be treated similarly to ota over network. The only way to have full recovery ability would be to be able to set the boot mode and flash over uart.
I've seen some of the topics regarding reflashing bootloader/partition table with OTA. But I'm wondering, is there a way to use SPI to flash the board like it is done via UART? As in, have the board treat the SPI the same way that it treats the UART?

Re: Flash ESP32 via SPI?

Posted: Thu Apr 29, 2021 11:57 pm
by WiFive
No because it isn't implemented in the rom bootloader. If you have the ability to use the same pins for spi and uart on your host side you may be able to figure something out. Why do you expect to need to reflash everything?

Re: Flash ESP32 via SPI?

Posted: Fri Apr 30, 2021 1:24 am
by FrozenArm
The ESP will be integrated into a unit where the only access to it will be via another micro controller that will connect to it via SPI. If there's a need to make flash it in the future (not just an image update via OTA) then I'm trying to figure out how that could be done.