Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
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

All the fds virtual pages are not used

In our project, we have defined 5 FDS_VIRTUAL_PAGES each of size 1024 words and have programmed to do GC if > 10 records are deleted. I see the 1st page being used for storing the records and when GC happens, there after 2nd page is used for storing records. and again after GC, 1st page is used for storing records.

 So this way I see only 2 of the 5 pages being used all the time. Any idea why other 3 pages are not used?

Parents
  • Hi,

    Records are written sequentially to flash which means that all records will in the start reside in the same flash page, if you don't write enough data to fill the other flash pages. One page is always used as a swap page. 


    Let's say that you have 3 pages, where 2 is used to store records called data pages and the last one is used as a swap page. 

    Page1

    |Record 1 |  Record 2 | Record 3|

    Page2

    |Record 4 |  Record 5 | Record 6|

    Page3

    |SWAP page |

    You now decide to delete record 5 and call the GC.

    Page1

    |Record 1 |  Record 2 | Record 3|

    Page2

    |Record 4 |  Record 5 | Record 6|

    Page3

    |SWAP page |

    The FDS module will invalidate the deleted record and will copy the remaining records to the swap page

    Page1

    |Record 1 |  Record 2 | Record 3|

    Page2

    |Record 4 |  Record 5 | Record 6|

    Page3

    |Record 4 | Record 6|

    Page 3 will then be promoted to a data page, and Page 2 will be the new Swap page:

    Page1

    |Record 1 |  Record 2 | Record 3|

    Page2

    | SWAP |

    Page3

    |Record 4 | Record 6|


    So the FDS module will always use at least 2 pages, one swap page, and at least one data page(depends on amount of records stored). You get basic wear leveling of the flash since the swap page moves around.

    Hope that it explained it.

    best regards

    Jared 

Reply Children
No Data
Related