Page 1 of 1

NVS erased after OTA

Posted: Fri Oct 27, 2023 1:40 pm
by m.couvet
Hi, I'm working on a project with esp32 esp-idf framework which use encrypted NVS features and firmwares encryption features. It's been one year i worked on this project and this week a realy weird problemes happend, while doing an OTA from on firmware to another, all the NVS partition of the ESP had been wiped, thus the device is unable to load it's parametter.. Fortunately i'm still in encryption dev mode, i can keep flashing firmware / NVS partition, but the goal is to send the device on site and being sure this will not happen again. So far i've checked the code, the partition table, and no clue about what can produce the compelte deletion of NVSs partitions on this OTA. If you have been in this kind of situation, have some clue about what happened, please help me understand ... Any flags that reset the NVS at boot ? ...

Re: NVS erased after OTA

Posted: Mon Oct 30, 2023 8:29 am
by mzincali
Is it possible that the size of your firmware changed, and it is overwriting your old NVS?

Re: NVS erased after OTA

Posted: Mon Oct 30, 2023 9:18 am
by m.couvet
Nope, both firmwares are the same size (1 970 176Mo), i was wondering if the build process is looking at both nvs.csv file which helps generating the partition. From one firmware to another, one of the partition have a line updated frome "foo:"http"" -> "foo:"https[...]"". Even if this file isn't part of the firmware, if it's taken in account during the build process may be this can leads to an variation of the NVS size ? But the NVS is modified inside the esp32 while it's living (updating some configuraiton parameter etc) so that's realy weird if it is what happend. So i'll test that n the day, but i'm not convinced about that.

Re: NVS erased after OTA

Posted: Mon Oct 30, 2023 12:48 pm
by mbratch
Are you able to reproduce this scenario?

Re: NVS erased after OTA

Posted: Mon Oct 30, 2023 1:08 pm
by martins
Reminds me of situation that happened to me - debug firmware build with virtual efuses (therefore no physical encryption) was OTA uploaded to fully secured device with HW efuses, secure boot and encryprions. NVS was rendered unreadable and if using example NVS init procedures it would be wiped by default.