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

Does "pm_peer_delete" delete the peer information written in Flash?

Hello.
Developed with nrf52832 (S132 v7.0.1, SDK v16.0.0).

"pm_peer_delete" is used to delete the peer created during bonding.
When I checked Flash when "PM_EVT_PEER_DELETE_SUCCEEDED" was called after calling this function, the data was not erased.

I thought that the data would be deleted from Flash, but isn't it deleted?

Thank you.

Parents
  • Hi,

    How did you check that the data was not erased?

    pm_peer_delete() will erase the data, but not in the sense that it is wiped of the flash immediately. The peer manager use FDS, so what it does is that it calls fds_file_delete(), which deletes all records related to that file, which is a specific peer. However, the way FDS works means that the only thing that happens at this point is that the records are flagged as dirty. This is how the FDS file system works, and it means that the records will no longer show up if searching for them using the FDS API (which is used by the peer manager and all other users of FDS), but the data resides at the same location in flash until a FDS garbage collection is performed. The Peer manger will call fds_gc() to do garbage collection if the FDS storage is full, but not before that (you can do it yourself earlier than this if you have a need for it).

Reply
  • Hi,

    How did you check that the data was not erased?

    pm_peer_delete() will erase the data, but not in the sense that it is wiped of the flash immediately. The peer manager use FDS, so what it does is that it calls fds_file_delete(), which deletes all records related to that file, which is a specific peer. However, the way FDS works means that the only thing that happens at this point is that the records are flagged as dirty. This is how the FDS file system works, and it means that the records will no longer show up if searching for them using the FDS API (which is used by the peer manager and all other users of FDS), but the data resides at the same location in flash until a FDS garbage collection is performed. The Peer manger will call fds_gc() to do garbage collection if the FDS storage is full, but not before that (you can do it yourself earlier than this if you have a need for it).

Children
No Data
Related