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

How to calculate FLASH life by garbage collection

SDK: 15.3.0
Device: EYSHJNZWZ (nRF52832)

I want to know the life of FLASH by garbage collection.
Assume that garbage collection is performed only when "PM_EVT_STORAGE_FULL" occurs.
Assume that no FLASH erasure is performed other than garbage collection.
In the data sheet, the life of FLASH is described as follows.

Flash memory
Endurance 10 000 Write / erase cycles


A) Suppose the FDS settings are as follows.

#define FDS_ENABLED 1
#define FDS_VIRTUAL_PAGES 3
#define FDS_VIRTUAL_PAGE_SIZE 1024
#define FDS_VIRTUAL_PAGES_RESERVED 0

We recognize that it has the following configuration.
① Virtual page for garbage collection
② Usable virtual page A
③ Usable virtual page B

How many garbage collections have been performed when the life of FLASH has expired?
In other words, how many garbage collections can be done to end the life of FLASH?
Also, please tell me how to calculate the number of times.

B) It is assumed that the FDS settings are as follows.

#define FDS_ENABLED 1
#define FDS_VIRTUAL_PAGES 5
#define FDS_VIRTUAL_PAGE_SIZE 1024
#define FDS_VIRTUAL_PAGES_RESERVED 0

We recognize that it has the following configuration.
① Virtual page for garbage collection
② Usable virtual page A
③ Usable virtual page B
④ Usable virtual page C
⑤ Usable virtual page D

Is the life of FLASH longer than in case A)?
The following is the answer I expect.
The number of garbage collections when the life of FLASH has expired does not change.
However, the frequency of garbage collection decreases.
Therefore, the life of FLASH is extended.

  • Hi Takashina, 

    As I explained in the other case, the page erase happens when the node has some invalidated records and it will be erased to be used as swap page. The swap page is rotated between pages. 
    So the more pages you use for FDS, the longer the Flash life can go because you will have less number of  PM_EVT_STORAGE_FULL event.
    The flash life is limited to 10000 write-erase cycle. And since each page with invalided record will be erased once on each GC. The life of the flash is limited to 10000 of GC calls (on average, if the page doesn't have any invalided record it will not be erased)

Related