Page 1 of 1

Esp32S3 : How to update a partition which is not a "program" partition ?

Posted: Fri Oct 27, 2023 9:53 am
by ThomasESP32
Good morning,

I am working on an Esp32S3 which is on a "personnal" electronic board and I have a question for you.

My program contains the following partitions : (Extracted from the partitions.csv file)

nvs, data, nvs, 0x9000, 0x4000,
otadata, data, ota, 0xd000, 0x2000,
phy_init, data, phy, 0xf000, 0x1000,
storage, data, fat, , 1M,
StdAudio, data, fat, , 512K,
ota_0, app, ota_0, , 2M,
ota_1, app, ota_1, , 2M,

The ota_0 and ota_1 paritions contain the program and are updated using OTA.
The StdAudio is a partition on which audio files are "downloaded" when the firmware is flashed using USB (Via Esp-IDF).

In order to automatically put audiofiles in the "StdAudio" partition, I have created a "StdAudioFiles" folder in my project
and I have put many MP3 files in it.
Moreover, in the "CMakeLists.txt" file, I have added the following lines :

#################################################################################
# Ajout des fichiers audio standards dans la partition associƩe : #

set(StdAudioImg ../StdAudioFiles)
fatfs_create_spiflash_image(StdAudio ${StdAudioImg} FLASH_IN_PROJECT)

#################################################################################

Doing this, a StdAudio.bin files is automatically generated when the project is built (Containing the audio files) and is automatically flashed in the chip when flashing the firmware over USB via Esp-IDF. (In production)

My question is the following :

If I flash a chip with the project containing for example 5 MP3 files.
And if I add more MP3 files in my project after that.
Is there a way to update the StdAudio partitions with the new StdAudio.bin (Containing more MP3 files)
without flashing all the program over USB ?
For example, if the electronic board containing the chip has been sent to a client and he wants to update the StdAudio partition
without sending back the board.

How can I do ? How to update just one partitions (Which is not a program partition) ???

1) I think it is not possible to flash the StdAudio.bin partition OTA (Because it is a fat partition), am I right ?
2) Is there a tool/software that the client can use to only download the new StdAudio.bin file (That I can send to him) at the good address ?
3) Is there another way to proceed ? Is it possible to send the bin file over BLE to my firmware for example ? Can the firmware
erase and write some partitions on the fly (Chunk by chunk, without waiting to receive the whole partition ???).

Thank you for your help,
Waiting for your answer,
Best regards,

Thomas TRUILHE

Re: Esp32S3 : How to update a partition which is not a "program" partition ?

Posted: Fri Oct 27, 2023 10:28 am
by djixon
I am still new to an ESP32 platform but most of ESP32S3 have an additional SPI flash which can be used for that purpose. So basically you do not need any external "flasher" but your own code at runtime can use that SPI FLASH for reading/writing files on it. Did you check a HTTP server example which allows "uploading/downloading" files live over direct wifi to your ESP32S3? That example uses SD card but I think it would be possible to change that to use SPI FLASH instead. Or you can add an SD card to your hardware design.

It means, your customers would be able to use, let's say their phone, connect it directly to your esp32 via direct wifi connection and upload/download files and do that from any web browser.

Re: Esp32S3 : How to update a partition which is not a "program" partition ?

Posted: Tue Oct 31, 2023 9:47 am
by hmalpani
Hello @ThomasESP32

You can refer to the discussion on similar issue reported on GitHub: https://github.com/espressif/esp-idf/issues/12393

Hope it helps.
Thanks!