FDS swap page not found

nRF5 SDK v15.2.0, nRF52840

This issue occurs on reset, most often after cycling power.

There are 4 pages reserved and 4 data pages are found.  Since a swap page isn't found, the initialization of FDS fails.

Changes made to debug this issue:

fds.c line 96 - static fds_page_t m_pages[FDS_DATA_PAGES+1]; // add one for the swap page in the event it isn't recognized as swap

fds_internal_defs - line 112 - Make default values bad state

typedef enum
{
FDS_PAGE_UNDEFINED = 0, // Undefined page type.
FDS_PAGE_DATA, // Page is ready for storage.
FDS_PAGE_SWAP, // Page is reserved for garbage collection.
FDS_PAGE_ERASED, // Page is erased.
} fds_page_type_t;


typedef enum
{
FDS_HEADER_CORRUPT = 0, // Header contains corrupt information, not related to CRC.
FDS_HEADER_VALID, // Valid header.
FDS_HEADER_DIRTY // Header is incomplete, or record has been deleted.
} fds_header_status_t;

What are possible paths for this state to occur? Is it most likely an interrupted garbage collection?

Is there a reason FDS_PAGE_TAG_SWAP and FDS_PAGE_TAG_DATA only differ by one bit?

If there is an empty page, can it be converted to a swap page?  There are 3 empty pages in my case.

/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-9cd8a7416485476db0b604e483852e1c/noSwap.png