fds data corrupted

Nickon7777 gravatar image

asked 2017-11-14 13:21:24 +0100

updated 2017-11-14 13:22:49 +0100

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?

edit retag flag offensive close delete report spam


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?

Petter Myhre ( 2017-11-15 11:17:34 +0100 )editconvert to answer

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?

Konstantin ( 2017-11-15 12:58:31 +0100 )editconvert to answer

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?

Petter Myhre ( 2017-11-16 13:22:25 +0100 )editconvert to answer

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.

Konstantin ( 2017-11-16 19:38:05 +0100 )editconvert to answer

2 answers

Sort by » oldest newest most voted
Nickon7777 gravatar image

answered 2017-11-27 12:09:21 +0100

I concluded that fds itself is not the reason of the error. The memory content is result of work of pm_local_database_has_changed() function in PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED event. The event appears in case of DFU to newer firmware with different GATTS configuration (one char notify ability is introduced).

edit flag offensive delete publish link more
emdi gravatar image

answered 2017-11-20 12:24:22 +0100


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.


edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower


Asked: 2017-11-14 13:21:24 +0100

Seen: 143 times

Last updated: nov. 27 '17