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

fs_event_handler callback is delayed


It takes time for fs_event_handler to be called back after nrf_fstorage_erase is executed.

In SDK13.1.0, it didn't take much time, but in SDK15.3.0 currently being developed, it takes time to be called back.

The priority cannot be set in the fstorage config of SDK15.3.0.
It is assumed that there is a delay due to not setting here.


*SDK13.1.0 
    FS_REGISTER_CFG(fs_config_t fs_config) =
    {
        .callback = fs_event_handler,
        .num_pages = PDL_PAGE_NUM,
        // We register with the highest priority in order to be assigned
        // the pages with the highest memory address (closest to the bootloader).
        .priority = 0xFE //***************this config*****************//
    };

*SDK15.3.0
    NRF_FSTORAGE_DEF(nrf_fstorage_t fs_mainte_config) =
    {
        .evt_handler = fs_event_handler,
        .start_addr = 0xD5000,
        .end_addr = 0xF6000,
    };

Parents Reply Children
  • I am not sure what has changed. I am not able to reproduce this in SDK15.3

    Some else had a similar problem like you so I had to test this on my desk.

    On nRF52832 (PCA10040 DK), with BLE connection established with HRS example, I saw diff as 2 ticks 

    And with nRF52840 (PCA10056 DK), with BLE connection established with the same HRS example, it is same 2 RTC ticks as below

    I am guessing that the difference in timing is something to do with the other contexts running in your app, interrupting your measurement. 

    Can I suggest you do another measurement like below on both 52832 and 52840, but this time disable the application interrupts by executing the below code in critical section.

    CRITICAL_REGION_ENTER() 
    uint32_t start = nrf_drv_rtc_counter_get(&rtc);
    
    nrf_fstorage_write(&rc_fs_instance, (uint32_t)addr, val, 4, NULL);
    
    uint32_t finish = nrf_drv_rtc_counter_get(&rtc);
    CRITICAL_REGION_EXIT() 

    I am thinking that the problem is that some other context has gained priority between the SDK, due to the default values in the sdk_config.h being changed.

  • The time was different depending on the chip difference (nrf52832 vs nrf52840).

    It was described in the following thread.

    https://devzone.nordicsemi.com/f/nordic-q-a/26929/sd_flash_page_erase-on-nrf52840-takes-a-long-time

Related