NVS Speed via Preferences
Posted: Sun Nov 06, 2022 5:36 am
Hello!
I am working on a project that uses NVS and deep sleep, and I've noticed that the size of the nvs partition makes a huge difference in the wakeup time - I think the default "nvs" partition is opened whenever the chip wakes up from deep sleep.
Unfortunately, I need a lot of storage (currently set aside 2M) and I need to access it right on wakeup - the data is too large to store in the RTC memory 8KB. When the partition is set to 2M, the wakeup time (before setup is even called) takes ~1.6s. If I change the "nvs" partition to be small (default 12K) and then make a new partition of 2M for my data, the actual wakeup time is fast, but when I try to open the Preferences library on my partition, it takes that same ~1.6s. All subsequent accesses to the partition are fast, but something about mapping it the first time takes a while.
Is there a way to accelerate the initial load of the nvs partition after wakeup? Alternatively, is there a way to hold the partition map in RTC memory so I only have to suffer that 1.6s penalty once, then don't have to do it after wakeup?
Thank you!
I am working on a project that uses NVS and deep sleep, and I've noticed that the size of the nvs partition makes a huge difference in the wakeup time - I think the default "nvs" partition is opened whenever the chip wakes up from deep sleep.
Unfortunately, I need a lot of storage (currently set aside 2M) and I need to access it right on wakeup - the data is too large to store in the RTC memory 8KB. When the partition is set to 2M, the wakeup time (before setup is even called) takes ~1.6s. If I change the "nvs" partition to be small (default 12K) and then make a new partition of 2M for my data, the actual wakeup time is fast, but when I try to open the Preferences library on my partition, it takes that same ~1.6s. All subsequent accesses to the partition are fast, but something about mapping it the first time takes a while.
Is there a way to accelerate the initial load of the nvs partition after wakeup? Alternatively, is there a way to hold the partition map in RTC memory so I only have to suffer that 1.6s penalty once, then don't have to do it after wakeup?
Thank you!