Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How much of NVS Data can we really use in ESP32?

I'm checking my NVS storage capacity. This is my output when i do make partition.

toolchain path: /home/dhananjay/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a

Compiler version: 5.2.0 Python requirements from /home/dhananjay/esp/esp-idf/requirements.txt are satisfied. Partition table binary generated. Contents:


# Espressif ESP32 Partition Table
# Name, Type, SubType, Offset, Size, Flags

nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
ota_0,app,ota_0,0x110000,1M,
ota_1,app,ota_1,0x210000,1M,
*******************************************************************************
Partition flashing command:
python /home/dhananjay/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB1 --baud 115200 --before default_reset --after hard_reset write_flash 0x8000 /home/dhananjay/esp/Homebridge/build/partitions_two_ota.bin
dhananjay

Which shows that i can use 16k of nvs storage, yet when i write into nvs through namespace "storage" and keys "a"-"p" with each key containing 1022 bytes of data. i get this output.

Done
String written successfully
Namespace a Completed
Done
String written successfully
Namespace b Completed
Done
String written successfully
Namespace c Completed
Done
String written successfully
Namespace d Completed
Done
String written successfully
Namespace e Completed
Done
String written successfully
Namespace f Completed
Done
String written successfully
Namespace g Completed
Done
String written successfully
Namespace h Completed
Done
String written successfully
Namespace i Completed
Done
Not enough Storage space
Wrongfull termination in Writing String

i Can only store 10220 Kb of data please help.

like image 922
Dhananjay Sutariya Avatar asked Nov 14 '25 10:11

Dhananjay Sutariya


1 Answers

The 16KB is the amount of (hardware) storage. The NVS library has some overhead, though. You can see what all is consuming the storage by using the nvs_get_stats() command, documented on this page:

ESP32 NVS Library

You can experiment by erasing the partition, then running a loop that adds an entry, then calls the nvs_get_stats() routine.

like image 193
mzimmers Avatar answered Nov 17 '25 08:11

mzimmers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!