Page 1 of 1

[NVS] Smallest partition size

Posted: Fri Nov 24, 2017 12:52 pm
by LorenzoM
Hi guys,

I made a simple demo for esp32 to test non-volatile storage on three partitions.
You can find the source attached.

The demo reads, updates and writes back the value in each partition, then after five seconds it resets.


If i use partitions of 8K size, all works properly. The attached file "partitions_success.log" confirms this statement.

This is the partition table used:

Code: Select all

# Name,       Type, SubType,  Offset,  Size
product_data, data, nvs,     0x9000 ,  0x2000
prov_data,    data, nvs,            ,  0x2000
nvs,          data, nvs,            ,  0x2000
phy_init,     data, phy,     0xf000 ,  0x1000
factory,      app,  factory, 0x10000, 1M

The problem is that if i use partitions of 4k size, the initialization of the partitions fails.

This is my partition table:

Code: Select all

# Name,       Type, SubType,  Offset,  Size
product_data, data, nvs,     0x9000 ,  0x1000
prov_data,    data, nvs,            ,  0x1000
nvs,          data, nvs,            ,  0x1000
phy_init,     data, phy,     0xf000 ,  0x1000
factory,      app,  factory, 0x10000,  1M
You can see the problem in the attached file "partitions_fail.log" .


Does this mean that the smallest partition size that I can use is 8K?

I read in the guide that it is strongly recommended to specify an NVS partition of at least 0x3000 bytes in the project.

Why does my demo work also with 0x2000 bytes? Is it mandatory to use 0x3000 bytes or this rule is only a suggestion?

Best regards

LM

Re: [NVS] Smallest partition size

Posted: Sat Nov 25, 2017 4:06 am
by WiFive
I believe Nvs needs at least 2 pages so it can move data and erase one when necessary and each page is 4k. But only 2 pages means more frequent erase cycles and shorter flash sector lifetime.