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

pstorage: unable to write twice on the same block

It seems that is not possible to rewrite data on a block ? I want to persist some data. The first time (after erasing all the flash memory) I store a data on a block, it works: I restart the chip, and I can retrieve my data. But the second time, the data is not replaced. Is it a normal behaviour ?

If I call pstorage_clear before writing the data on the second time, it works... But pstorage_clear clears all blocks, not just the one I want to clear...

As a workaround, I register a block (pstorage_register) for each data I need to save. Is it correct ?

Parents
  • Hi Benoit,

    The pstorage_clear API clears all blocks registered by the application, not only one block. This is currently an implementation limitation, the API itself take a 'size' parameter to allow for selective clearing of data. Reason for this limitation is that clearing of flash is permitted only per page and not individual words.

    Coming to your first issue of write not succeeding the second time, it is strange and unexpected. Is it possible to provide sequence of operations you are performing. Also, are you certain that you have received success events for each of the pstorage_clear and pstorage_write that you have requested?

    Regards, Krishna

Reply
  • Hi Benoit,

    The pstorage_clear API clears all blocks registered by the application, not only one block. This is currently an implementation limitation, the API itself take a 'size' parameter to allow for selective clearing of data. Reason for this limitation is that clearing of flash is permitted only per page and not individual words.

    Coming to your first issue of write not succeeding the second time, it is strange and unexpected. Is it possible to provide sequence of operations you are performing. Also, are you certain that you have received success events for each of the pstorage_clear and pstorage_write that you have requested?

    Regards, Krishna

Children
No Data
Related