FDS initialization hangs/returns NO_SWAP error on nRF52840

Hi,

I am working with NRF52840 where I use the FDS library from the nRF5 SDK, currently SDK v15.3.0.

My issue is that I have seen my hardware suddently halts/hangs due to faillure to initialize FDS under boot. The function "fds_init" returns the error NO_SWAP even though a SWAP page is defined. My hardware is thereafter "bricked"/non-working and it is necessary to format the Flash memory in the NRF5.

I have searched this support forum and Google, and found a similar issue reported here:

NO_SWAP error from pages_init() when initializing FDS - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)

My issue seems to be the same as the one mentioned in the link just above.

When reading the release notes from the newest version of the nRF5 SDK v. 17.1.0, I have found the following shown below.

My question is therefore if someone can confirm that SDK v. 17.1.0 solves my issue? - and the solution for me is to update the SDK v. 17.1.0.

Thank you in advance!

Regards,
Ulrik

** FDS **

- Fixed a bug that would prevent re-initialization when fds_init() returned
  FDS_ERR_NO_PAGES or FDS_ERR_NO_SWAP (NRFFOETT-2552).
- Fixed a bug in FDS that could occur if the device lost power during garbage collection,
  that would result in the swap page being incorrectly tagged, and fds_init() returning
  FDS_ERR_NO_SWAP on initialization (NRFFOETT-2506).



Parents
  • Hi Ulrik

    Yes, either moving to SDK v17.1.0 or implementing these fixes yourself should solve your issues as well. The "prevent re-init when fds_init() returns NO_PAGES or NO_SWAP is reported here:  https://devzone.nordicsemi.com/f/nordic-q-a/68770/fds---initializing-flag-not-unset-when-fds-init-returns-with-error-potential-bug 

     The other bug is reported in a private ticket, but the fix is as follows: 

    In <sdk folder>/components/libraries/fds/fds.c, in the function init_execute(), in the switch case FDS_OP_INIT_PROMOTE_SWAP, remove the lines:

                // When promoting the swap, keep the write_offset set by pages_init().
                ret = page_tag_write_data(m_swap_page.p_addr);

    In the same switch case, add the following lines right before the break:

                // Promote the old swap page to data, but do this at the end
                // because we can re-enter this function; we must update have
                // updated the page in RAM before that.
                ret = page_tag_write_data(p_old_swap);

    So that the full case FDS_OP_INIT_PROMOTE_SWAP now looks like this:

            case FDS_OP_INIT_PROMOTE_SWAP:
            {
                p_op->init.step       = FDS_OP_INIT_TAG_SWAP;
    
                uint16_t const         gc         = m_gc.cur_page;
                uint32_t const * const p_old_swap = m_swap_page.p_addr;
    
                // Execute the swap.
                m_swap_page.p_addr = m_pages[gc].p_addr;
                m_pages[gc].p_addr = p_old_swap;
    
                // Copy the offset from the swap to the new page.
                m_pages[gc].write_offset = m_swap_page.write_offset;
                m_swap_page.write_offset = FDS_PAGE_TAG_SIZE;
    
                m_pages[gc].page_type = FDS_PAGE_DATA;
    
                // Promote the old swap page to data, but do this at the end
                // because we can re-enter this function; we must update have
                // updated the page in RAM before that.
                ret = page_tag_write_data(p_old_swap);
            } break;

    Best regards,

    Simon

  • Hi Simon,

    Thank you very much for your reponse! Really appreciate it.

    I tried this morning replacing the "FDS source files" from SDK 17.1.0 with those I currently use from SDK 15.3.0. Besides some return value defines having their name changed (FDS_SUCCESS -> NRF_SUCCESS), I got my code to compile with the new FDS source files. Of course the best (= safest) solution is most likely to update the whole SDK to the latest version but that decision is not mine to make.

    I have a device which is unable to boot due to "fds_init" that hangs/halts during device boot. I will try to see if the device can be recovered with the new FDS version (I have JTAG access) without having to re-format the Flash memory used for FDS.

    Thank you again!

    Br,

    Ulrik

Reply
  • Hi Simon,

    Thank you very much for your reponse! Really appreciate it.

    I tried this morning replacing the "FDS source files" from SDK 17.1.0 with those I currently use from SDK 15.3.0. Besides some return value defines having their name changed (FDS_SUCCESS -> NRF_SUCCESS), I got my code to compile with the new FDS source files. Of course the best (= safest) solution is most likely to update the whole SDK to the latest version but that decision is not mine to make.

    I have a device which is unable to boot due to "fds_init" that hangs/halts during device boot. I will try to see if the device can be recovered with the new FDS version (I have JTAG access) without having to re-format the Flash memory used for FDS.

    Thank you again!

    Br,

    Ulrik

Children
No Data
Related