This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

fds invalid page tag

Hi guys,

we have triggered one interesting state of fds module… This could be somehow connected to https://devzone.nordicsemi.com/f/nordic-q-a/27259/fds-data-corrupted/107629#107629

We are using nrf51822, sdk12.3.0 and softdevice s130 2.0.1… Also we are using only one peripheral link, with one service and one characteristic which we set security mode BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM for read/write permissions.

Most of the time we were able to pair with smart device – but then after some connecting issues fails on pm_init – which cause app_error_check, we fall in never ending reset loop.

It actually fails in fds_init function, where pages_init return NO_SWAP…

After flash readout we noticed that on all three flash pages DEADCODE is written as expected but all three pages are marked as they contains data (0xF11E01FE) – during debugging and normal operation at least one page is always marked as swap (0xF11E01FF)…

Now we are wondering what could trigger that case?

As mentioned above we are using only one peripheral link which is secured – somehow we picked up configuration (app_ram_base.h configuration):

APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_0_VS_UUID_COUNT_1_MID_BW 0x20001fe8

After some calculations (difference between configurations with and without sec_count0 and sec_count1 on other configurations) we should add 456 bytes for secure connections, because APP_RAM_BASE_CENTRAL_LINKS_0_PERIPH_LINKS_1_SEC_COUNT_1_VS_UUID_COUNT_1_MID_BW is not in app_ram_base.h

Is it possible that missing those 456 bytes could impact on NO_SWAP issue?

After all we made a workaround and in case that there is no more SWAP pages – we clear those pages manually and after the reset the peer manager initialize as it should…

But we are interested in root cause, to prevent such behavior.

Thank you for info!

Best regards,

Matej

Parents
  • Hey Matej,

    My first guess is that you have set an invalid memory space for the FDS library(used by other libraries or S130).

    My second guess is that you have not allocated an additional page for the SWAP, f.ex. 3 pages for user data + 1 page SWAP.

    Do you mind sharing your code in a project that compiles with SDK12.3? 

    Cheers,
    Håkon

  • Hi Håkon,

    We set FDS_VIRTUAL_PAGES to 3 and flash is not used by any other module so from that we conclude that memory space is valid.

    With define FDS_MAX_PAGES(FDS_VIRTUAL_PAGES - 1) fds module itself takes care that two pages are used for data and one is used for swapping data. Or did we miss something?

    We have readout flash after each pairing and swapping works fine – except once… when all 3 pages were marked as they contains data (0xF11E01FE), unfortunately we are not able to reproduce it.

    Removing all propriety code from project will take quite a long time that will be buildable…

    What is your opinion about RAM settings (please check previous post)?

    Thank you for response!

    BR,
    Matej

  • I don't think the RAM settings is an issue. The SoftDevice Handler would notify you if there's a collision with the app ram region and SoftDevice ram region. 

    Do you perform garbage collection at any point?

     

  • Yes, on peer manager event PM_EVT_STORAGE_FULL....

    case PM_EVT_STORAGE_FULL:
            {
                // Run garbage collection on the flash.
                err_code = fds_gc();
                if (err_code != FDS_ERR_BUSY && err_code != FDS_ERR_NO_SPACE_IN_QUEUES)
                {
                    APP_ERROR_CHECK(err_code);
                }
                break;
            }

Reply
  • Yes, on peer manager event PM_EVT_STORAGE_FULL....

    case PM_EVT_STORAGE_FULL:
            {
                // Run garbage collection on the flash.
                err_code = fds_gc();
                if (err_code != FDS_ERR_BUSY && err_code != FDS_ERR_NO_SPACE_IN_QUEUES)
                {
                    APP_ERROR_CHECK(err_code);
                }
                break;
            }

Children
No Data
Related