fds data corrupted

Hello all,

My project based on NRF52832 SDK13 has some bug I trying to solve. Some users of my product very rarly faces with problem of constantly rebooting NRF52. After some investigations I'm revealed that the bond info sectors contain very strage data and the fds_init(void) function allways returns FDS_ERR_NO_PAGES. In the attachment you can find hex dump of those three sectors and screenshot of debug window with deatails about m_pages struct while in pages_init() function. I have build some protection code to just erase all fds pages in case of this error, but I want to understant the reason of error. May be it is already solved in SDK14?

  • Could you explain a bit more about how you are using FDS? Are you sure that the flash area used by FDS/Fstorage isn't corrupted by something else? Do you have a bootloader? Doing DFU? Is it only used by Peer Manager or are you using FDS to store your own data? Why does fds_init() return FDS_ERR_NO_PAGES? Have you tried to debug the function?

  • The FDS is used only by Peer Manager, my own code uses flash write operation only through nrf_dfu_settings_write(). My project uses the bootloader and buttonless DFU. I performed DFU process many times without that type of error. I don't suspect the bootloader to be the reason of data corruption in the FDS storage. My first post is the result of debugging of fds_init(). I just saw very strange data in the FDS storage region (hex dump included) and thought that someone can explain possible reason of that sort of data. Can it be a result of interrupted garbage collection for example?

  • Yes, I understand that fds_init() returns FDS_ERR_NO_PAGES, have you tried to debug further? Inside fds_init()? Why is FDS_ERR_NO_PAGES returned?

    The data in flash does look strange, I'm not sure how this can happen.

    How difficult is this to reproduce? Can you share your complete project so I can try it here?

  • My debug chain: fds_init() > pages_init() > [screenshot] > (fds_init_opts_t)NO_SWAP So pages_init() results in: 1 page marked as FDS_PAGE_DATA (but with write_offset = 1026), and 2 pages are FDS_PAGE_UNDEFINED. That produces total result of FDS_ERR_NO_PAGES. You can see it on the screenshot. I tried to reproduce this many times but with no luck. Unfortunately I have no reliable description of situation where bug appears because this bug never appeared in my lab.

  • Hi,

    it seems that something is writing in the fds area, overwriting its data, so fds won't recognize it anymore. That seems likely, given also the contents of the flash as can be seen in the screenshot: mostly zeroes.