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

What is the difference between pstorage_store and pstorage_update?

I am using the pstorage API and I would like to understand what the difference is between these two methods (if any)

Parents Reply Children
  • Thanks for the link. Just to confirm that I understand it correctly:

    • Store can only set bits in flash from 1 to 0, so the area that needs to be modified must be set to 0xFF before
    • Clear only works for a whole page and sets all its bits to 1 (all its bytes to bytes to 0xFF)
    • There is no way to clear an area/block smaller than a page so before storing any block, the page that contains the block must be cleared
    • In order not to lose the rest of the data stored in the page, the page is swaped/backed up through the update command as explained in the previous link.

    My doubt is what happens if the chip loses power during the update command. Does the update command implement any recovery mechanism to avoid memory corruption? I do not mind about losing the last updated block but about corruption of the whole flash page

  • For your points mentioned above, they are all correctly understood. As far as I know, we do not implement any flash integrity tests, not for flash update operations or for flash write operations. You could perform this by creating a checksum for the data you intend to write or for the flash page you intend to write to, and then compare this checksum with the data you read from the page after a reset.

Related