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

FDS module not working while migrating from sdk13 to sdk 15.2

Hi everyone,

I am using SDK 15.2 with keil microvision and softdevice132 nrf52_6.1.

In version 13, system dispatch event was regestired with Softdevice handler as below

static void sys_evt_dispatch(uint32_t sys_evt)
{
    fs_sys_event_handler(sys_evt);
}

//Register with the SoftDevice handler module for SYS events.
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);

In 15.2, I replaced this part with

NRF_SDH_SOC_OBSERVER(m_sys_obs, 0, nrf_fstorage_sys_evt_handler, NULL);

I get an implicit declaration error even with correct header nrf_storage_sd.h included in the file. I even defined nrf_storage_sys_evt_handler in the same file, but its like writing most of the part which is already in nrf_storage_sd.c. Even then its not working, when the fds intialising is done and if its true again the my_flash_evt_handler should be called to reset it. Its not called and my program hangs in a infinite while loop.  The fds event handler is as below

// register event handler
    err_code = fds_register(my_flash_evt_handler);

void locid_flash_evt_handler(fds_evt_t const * const p_fds_evt){
    switch (p_fds_evt->id){
    case FDS_EVT_INIT:
        {
   //handle error
        }
        break;
    case FDS_EVT_WRITE: {
   //handle error
        }

Am I doing it right ? I also went through the available fds example in pheripheral folder and even usage part in nordic info center, it has no OBSERVER macro defined. I am confused. Please help me find the solution.

Thanks in advance

Parents
  • Hi,

    extern nrf_fstorage_api_t nrf_fstorage_sd is the appropriate backend used to access flash when Softdevice is enabled. 

    I'm not sure I understand the necessity of changing the backend module fstorage module when you want to migrate a project that use FDS. The proper way to migrate a project that use Flash Data Storage module is to update the functions that are used from FDS in your application. Backend modules such as fstorage shouldn't be necessary to modify as they can be included directly from the newest SDK. 

    You can try including your project into the flash fds example in the newest SDK and replace the updated API functions with the appropriate function call in your application.  

    Best regards

    Jared 

  • Hi,

    Thanks for the explaination. I even tried withe example available.It only writes, if the record is not found.

    Even if the board is earsed and softdevice is progammed newly, it finds the record, opens it, closes it and then updates it. It never writes any thing.

    how can it update a record when its closed?

    Now, In my program, the initialisng event works after running and resetting  twice in debug mode and write event is never called even after successullfy finishing the write operation. The program hangs in a infinte while loop. I dont know why? Please guide

    Thanks in advance

  • So you're having issues with the flash_fds example from SDK 15.2? Are you using a custom board? If not, what DK are you using? What are you using to read the output? 

  • I have issues even with my own code.

    So I tried debugging example code for hints and i have issues with it too.

    I am using nrf52832. Just the stack window in debug mode. The nrf log is not working. I tried adding nrf log backend, even then its not working. I got error. So, just used stack window.

Reply Children
Related