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,

    I'm not sure I understand your intention. To use FDS with the softdevice you first initialize the softdevice with nrf_sdh_ble_enable() and then register a callback handler to FDS events with fds_register(), and lastly initialize the module with fds_init(). 

    Jared 

  • Hi,

    Thanks a lot for your reply Jared.

    I did the same with refence to link here. After being registered and initialized without any error, initialisation flag is set true and the fds event hanlder should be called to set the flag false and this call back is not happening.The program hangs.

    The issue is similar to this link. Also follwed the suggestion in this link. but still not working. Please guide me

  • Hi,

    When do you call fds_init, does it return a FDS_SUCCESS? The FDS registration in the example is done through registering a fstorage handler with the Softdevice as you've done. If possible, It may be easier to build your application ontop of the FDS example in SDK 15.2 instead of porting it? 

    Implicit declaration is often the result when the compiler can't find no prior definition of the function. Is the relevant paths included in the build?

    Jared

Reply
  • Hi,

    When do you call fds_init, does it return a FDS_SUCCESS? The FDS registration in the example is done through registering a fstorage handler with the Softdevice as you've done. If possible, It may be easier to build your application ontop of the FDS example in SDK 15.2 instead of porting it? 

    Implicit declaration is often the result when the compiler can't find no prior definition of the function. Is the relevant paths included in the build?

    Jared

Children
  • Hi,

    I do get FDS_SUCCESS.

    The file nrf_fstorage_sd.h has only one definition and all the necessary headers and function defintions are included in nrf_fstorage_sd.c. For example: the function nrf_fstorage_sys_evt_handler header and its definition both are in nrf_fstorage_sd.c file. In nrf_fstorage_sd.h only nrf_fstorage.h is included. Is that the reason i am getting Implicit declaration error? Else am I missing on something.?

    Could you please explain the importance of  "extern nrf_fstorage_api_t nrf_fstorage_sd" ? Its the only thing mentioned in the nrf_fstorage_sd.h

Related