Writing a single value to NVS from a PC
Posted: Wed Oct 08, 2025 8:11 pm
I have an ESP32-S3 and I've set up the partition table to have a 24K NVS partition.
One of the values in NVS is called `serialno`. It is a 32-bit serial number that should be unique to each device.
There are other values stored in NVS. Some of them are constant, but others may be set during operation of the device (such as calibration data).
If I never need to update the serial number at a later date, is there a way I can do this without affecting the other data already stored in NVS?
I've tried using, but that overwrites the entire partition. My ideal solution would allow me to modify just one value.
I'm thinking that it may be possible to achieve by doing something like
but I don't know what to do between the parttool steps. As far as I can tell, there is no way to convert nvs.bin back into a CSV which can then be easily modified with a Python script. I understand that I can convert it into JSON, but I'm also unaware of any way to convert it back to a .bin file after modifying it.
One of the values in NVS is called `serialno`. It is a 32-bit serial number that should be unique to each device.
There are other values stored in NVS. Some of them are constant, but others may be set during operation of the device (such as calibration data).
If I never need to update the serial number at a later date, is there a way I can do this without affecting the other data already stored in NVS?
I've tried using
Code: Select all
parttool.py write_partitionI'm thinking that it may be possible to achieve by doing something like
Code: Select all
parttool.py read_partition -n nvs --output nvs.bin
# Do something here to modify nvs.bin to have new serial number
parttool.py write_partition -n nvs --input nvs.bin