This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

pstorage_store vs pstorage_update

Hi.

I have been trying to store data in flash by using pstorage. What's the difference between pstorage_store and pstorage_update?

At the first time, I can save data by pstorage_store without error at the callback function. But if I try to save data again at the same block, the data is not saved even though there is no error at the callback function.

And when I use pstorage_update instead of pstorage_store, I get 0x11(Edited : NRF_ERROR_BUSY) error even though I don't get any error when I use the same data for pstorage_store.

Any idea on what is happenning here?

My development environment:

・nRF51822 Developer Kit

・iOS 7.1 iPhone5s

・nRF6310 Rev 1.4

・S110-SD-v6

  • Then.... What's the difference between pstorage_store and pstorage_update?

  • Read this.

    Store:

    • Writing data to blocks that already have data stored is unreliable. The application must clear the blocks before writing fresh data to it.
    • No intermediate copy of source data to be stored in flash is made. Application cannot free or reuse the memory that is the source of data until this operation is complete. Completion of this operation is notified through the event notification callback.

    Update:

    • When using the update routine the Persistent Storage Manager will use a swap area to conserve the blocks not affected. The data page backed up in the swap area, the data page is erased, the non affected blocks are copied back, then the updated block is stored. It is not possible to update multiple blocks in one API call. Module detects if backing up the page is needed or not and optimizes accordingly.
    • No intermediate copy of source data to be stored in flash is made. Application cannot free or reuse the memory that is the source of data until this operation is complete. Completion of this operation is notified through the event notification callback.
    • Update operation is a time intensive operation, hence developer descretion is required on usage of this API. Application should be tolerant to this.
  • You can find the answer on this link but as I understand

    pstorage_update
    

    is a bad effort to safe update information that shoud store in flash memory. I decide to not use it because of time (long, so long) and number of clear operations (that probably killed flash memory).

Related