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

How to update a 32-bit word in flash - SDK13.1

Hi everybody,

I was looking for a better way to update a data, like a 32-bit-word, without the need to erase the entire page. Part of this question is already been asked HERE but for some different reasons has not been answered. If I need to store different values and I want to update only one of them at time now I have to backup my data before erasing the flash page and then re-write everithing back with the new value of the only one data I wanted to update originally.

There must be a better way! Is there one?

Thanks in advance

Massimo Pilia

Parents
  • The reason why it wasn't answered probably is because requested didn't want to accept the answer which is: you can write to any flash memory address as much as you want but you will never turn single bit from 0 back to 1 unless you erase whole page. That's how flash technology works, you cannot workaround the physics. You can still do certain smart things like:

    • Dedicate one (or more) page to all writes, erase it once and then just have some mechanism how to find out which was the last written address and where you can continue.
    • Use some more sophisticated "file system" which can use several pages and thanks to smart write policy minimize number of erases needed (but this needs o have many assumptions about the intended use to have it really effective...)

    (and your "There must be a better way!" reminds passengers on sinking ship screaming "it cannot be true, this cannot happen to us!":)

  • Hi Endnode and thanks for your reply.

    You said "you cannot wokaround the physics" but why, working on the nRF51 chip with SDK11 and s130, I could update single 32-bit word with the function pstorage_update? Has flash technology changed?

    Anyway, thank you for your advices.

    Massimo Pilia

Reply Children
No Data
Related