If the NVM data is read prior to erase or write, what will the flash storage return

I would like to know and understand the implication of what will happen, if i use the 

nrf_fstorage_read before calling either nrf_fstorage_write or  nrf_fstorage_erase. 
Which will be a good place to erase the flash storage just once? prior to writing any data.
Parents Reply Children
  • How much data do you want to store? There is space in UICR that can for instance be used for the purpose.

    Kenneth

  • 1. I need to store 2 x uint32_t bits of data. 

    2. The NVM should be initialized just once after the firmware is upgraded, for any further upgrade, it should hold the value. 

    3. The value is NVM should be updated for every factory reset, based on the internal count set.

    4. The value in NVM will be read on every power cycle, so the value should not be corrupted due to not being initialized. 

    Could we achieve all the above mentioned points using UICR, or is NVM capable of achieving that all? 

    If I'm planning to use the NVM FDS backend SD, 

    1) which is the best place to initialize only once, and after which, it should only be updated for every factory reset.

    2) how many times, can NVM be erased and re-written (since I'm clearing every time, before i update it)

    3) Why do i have to call nrf_fstorage_init every time, before the value is read? if i don't call the init just before the read, it doesn't read the value. 

Related