Memory management with NVS

Hi

I am using Nordic's NVS system on an nRF5340.
I have successfully got the code mounting, writing and reading from a user defined partition in flash memory.

For now, I am using just two sectors

The documentation here contains information on calculating flash wear etc.

My question:
Does the NVS system automatically manage sector clean-up / erasing, or is this something that I need to manually look after by using the nvs_calc_free_space() function?

Regards

Garrett

Parents
  • Hi Swathy

     

    Thanks for the response.

     

    I read the post you refer to.

    The information is not too clear though.

     

    From reading that post, it seems to state:

    • If you are using only one variable, and you keep over-writing that variable, then the NVS system will look after tidy up / erasing, when a sector becomes full
    • If you are continuously writing new data, the NVS system will NOT look after the tidy up / erasing. Instead, when it eventually runs out of space, the write function will return an error.
    • If you have, say, 10 variables, and some of these are being updated from time to time, then...???

     

    In the end, I have about 10 variables I want to store in Flash. My code will be writing to Flash to update a single variable, whenever that variable is changed.

     

    Question: Will the tidy up / erasing be managed automatically by the NVS system, or will I eventually run out of space?

     

    Regards

     

    Garrett

     

Reply
  • Hi Swathy

     

    Thanks for the response.

     

    I read the post you refer to.

    The information is not too clear though.

     

    From reading that post, it seems to state:

    • If you are using only one variable, and you keep over-writing that variable, then the NVS system will look after tidy up / erasing, when a sector becomes full
    • If you are continuously writing new data, the NVS system will NOT look after the tidy up / erasing. Instead, when it eventually runs out of space, the write function will return an error.
    • If you have, say, 10 variables, and some of these are being updated from time to time, then...???

     

    In the end, I have about 10 variables I want to store in Flash. My code will be writing to Flash to update a single variable, whenever that variable is changed.

     

    Question: Will the tidy up / erasing be managed automatically by the NVS system, or will I eventually run out of space?

     

    Regards

     

    Garrett

     

Children
Related