sd_flash_write does not update flash , if already written

Hello Nordic team,

In my application, I was using nrf_nvmc_write_words() to write data to flash. this was working as expected and was able to update value in flash more than once. When I added BLE Softdevice to my application, I replaced this function with sd_flash_write(). After this change, I notice that flash gets written with expected data the first time (i.e flash was previously erased). However, after writing to flash once, if I try to update with another value, I don't see that the value gets updated.

Can you please let me know what could be the issue here? Is there any extra step to be done when using sd_flash_write() to update flash? 

Wishing you Happy Holidays,

Anusha

Parents
  • Hi,

    Are you writing to the same address gain? If so, you are probably facing the inherent physical limitation of flash memory, that writing only flips bits from 1 to 0. To flip bits from 0 to 1 you need to do a page erase, which will flip all bits in the 4kB page to 1's. Therefore you normally always one to use a simple file system if you need to update data in flash. The nRF5 SDK includes Flash Data Storage (FDS) that is suitable for this, and is used by SDK modules that needs to write data to flash (like the peer manger library used for handling BLE bonding). You can also use this to store other application data.

Reply
  • Hi,

    Are you writing to the same address gain? If so, you are probably facing the inherent physical limitation of flash memory, that writing only flips bits from 1 to 0. To flip bits from 0 to 1 you need to do a page erase, which will flip all bits in the 4kB page to 1's. Therefore you normally always one to use a simple file system if you need to update data in flash. The nRF5 SDK includes Flash Data Storage (FDS) that is suitable for this, and is used by SDK modules that needs to write data to flash (like the peer manger library used for handling BLE bonding). You can also use this to store other application data.

Children
Related