Page 1 of 2

OTA update spiffs

Posted: Tue Nov 28, 2017 11:40 pm
by chegewara
Is there some way to OTA update spiffs partition?

Re: OTA update spiffs

Posted: Wed Nov 29, 2017 8:33 am
by loboris
chegewara wrote:Is there some way to OTA update spiffs partition?
Of course, it should be quite simple.
Use the OTA example as the base and esp_partition API to erase/write the partition.
- Put your spiffs image file on some http server.
- First find your spiffs partition using esp_partition_find(), get the start address and size.
- Erase the whole partition using esp_partition_erase_range().
- Download the chunks of spiffs image file and write to the partition using esp_partition_write().
- You can optionally use md5 checksum file to validate the written data (use md5 API and esp_partition_read().

Re: OTA update spiffs

Posted: Sat Dec 02, 2017 10:35 am
by Gfast2
loboris wrote:
chegewara wrote:Is there some way to OTA update spiffs partition?
Of course, it should be quite simple.
Use the OTA example as the base and esp_partition API to erase/write the partition.
- Put your spiffs image file on some http server.
- First find your spiffs partition using esp_partition_find(), get the start address and size.
- Erase the whole partition using esp_partition_erase_range().
- Download the chunks of spiffs image file and write to the partition using esp_partition_write().
- You can optionally use md5 checksum file to validate the written data (use md5 API and esp_partition_read().
Did you try your solution in code? AFAIK, OTA uses partition type APP, Spiffs ueses type Data. Would it works too?

Cheers

Su

Re: OTA update spiffs

Posted: Sat Dec 02, 2017 11:13 am
by WiFive
That is why he said use esp_partition_write instead of esp_ota_write, etc...

Re: OTA update spiffs

Posted: Sat Dec 02, 2017 1:22 pm
by Gfast2
WiFive wrote:That is why he said use esp_partition_write instead of esp_ota_write, etc...
Nice, If I get chance to try this out in code. I'll be back. 8-)

Cheers

Gfast2

Re: OTA update spiffs

Posted: Sat Dec 07, 2019 7:05 am
by zhivko
Have you done it? Could you share code if possible?

Re: OTA update spiffs

Posted: Tue Jan 07, 2020 7:26 pm
by dmaxben
Anyone else had luck updating SPIFFS via OTA? I cant seem to find much information on it...

How hard is it to have the ESP32 download a compressed SPIFFS image via OTA, and then unpack it and write it into SPIFFS? Im using a 16MB flash unit, and downloading/writing a full uncompressed 11MB bin will take quite a while...

Re: OTA update spiffs

Posted: Sun Apr 26, 2020 7:36 am
by AndyFreund
I used this tool https://github.com/chrisjoyce911/esp32FOTA with success in my application.
It works well with an esp32 for OTA-update of firmware as well as for a SPIFFS partition update.

espFOTA.cpp includes update.h
To start an update they use

Code: Select all

bool canBegin = Update.begin(contentLength);
.

If you use

Code: Select all

bool canBegin = Update.begin(contentLength, U_FLASH);
you update OTA partitions.
If you use

Code: Select all

bool canBegin = Update.begin(contentLength, U_SPIFFS);
you update an data spiffs partition.

Contact me, if you need more information.

Re: OTA update spiffs

Posted: Fri Oct 30, 2020 9:36 pm
by miracle0419
I will contact you after seeing your post on "Re: OTA update spiffs."
Currently working on several project with ESP32. So, please let us know if we have any problem about the OTA Processor via SPIFFS.
- Flash Size : 4Mb(32MB)
- Partition Scheme : No OTA (2MB APP/2MB SPIFFS)
- Size of APP Binary : 1.5 MB

1. App binary file copy to SPIFFS via UART
2. Update.begin(contentLength, U_SPIFFS);
3. Update.write("Apps.bin", size);
4. Update.end();
5. Rebooting...

Thanks CK

Re: OTA update spiffs

Posted: Tue Aug 03, 2021 9:33 am
by pedros89
Hello, you may find a repository to do OTA update spiffs with code for Arduino IDE here:

https://github.com/pedros89/ESP32-OTA-u ... th-Arduino