[NVS] Smallest partition size

LorenzoM
Posts: 1
Joined: Fri Nov 24, 2017 8:08 am

[NVS] Smallest partition size

Postby LorenzoM » Fri Nov 24, 2017 12:52 pm

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
Attachments
partitions_success.log
(13.97 KiB) Downloaded 658 times
partitions_fail.log
(26.87 KiB) Downloaded 623 times
nvs_blob_example_main.c
(7.4 KiB) Downloaded 670 times

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: [NVS] Smallest partition size

Postby WiFive » Sat Nov 25, 2017 4:06 am

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.

Who is online

Users browsing this forum: Google [Bot], sNova78 and 85 guests