This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

flash erase in fstorage & FDS

Hi guys,

I am developing a appilication using nrf51822 using SDK 11. I am trying to use Fstorage and FDS to store data. I need this data to be updated frequently. As I awared, the flash can only be erase and write for 10000 times. Since I need to update the data very fast. Therefore, I need more than that.

I wonder if it is possible to store data in several registers and then after around 10000 times, I store the data in other register and keep updating? I have searched that there is a function in S130 that: sd_flash_page_erase. However, it erases the whole flash page, is there other API for erase reveral registers only because as I know, the flash pages is 3 or 4 only?

Thank you for your kind support.

  • Do you need to store it in flash for every update? Note that you only need to store it to flash before you power off the board. So as long as the board is powered on, you update the variable "locally" any number of times, before you write it to flash before shutting down.

    Anyway, FDS will itself do "wear limitation", which means that it will use different areas of flash for each write until it has used all of its allocated area. So if you are only updating a small set of values, and you have allocated a lot of space for FDS you will be able to perform many updates before a flash erase needs to be performed.

    There is no way to erase a flash area smaller than a single page.

  • Thank you for your answer. I have noticed that but I have no choice. So you mean that by writing the updated value and erase it when the whole page fulls will save the number of using flash? I thought each write or erase is considered as 1 time the flash is used? And can you please tell me what happened if a flash is over 10000 times? As I understand, the flash will not be able to write and erase anymore but still can be read. Can FDS intelligent enough to detect that and move to next page to avoid that dead page?

  • Say that you have 4000 bytes of flash, and you are writing a value of 4 bytes. Then if you do "wear limitation" you would get to update you value 1000 times before having performed 1 erase/write cycle on that area.

    Nothing happenes after 10 000 times, but nordic does not guarantee that it will work any more. Personally I have boards with several million cycles, and they are still working fine. So if this is just for personal, non-commercial use, you don't have to care too much about it IMO.

    I don't know of any way to detect that the flash is worn out, but I am quite certain that FDS does not perform this check.

  • I am very sorry for this situation. I was wondering if there is any soft device API to erase just several registers from your suggestion last time but not the whole page. Once again, I am very sorry for this spam.

Related