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

handling softdevice soc event handler in SDK 14.1.0

Hi,

I am trying to write and update a record in flash but not receiving event callbacks FDS_EVT_WRITE and FDS_EVT_UPDATE. I found that i need to add the following code in my main.c

static void sys_evt_dispatch(uint32_t sys_evt)
{
// Dispatch the system event to the fstorage module, where it will be
// dispatched to the Flash Data Storage (FDS) module.
fs_sys_event_handler(sys_evt);

...
}


static void ble_stack_init(void)
{
    ...
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
}

Am unable to use this in SDK 14.1.0 . How do i write and enable softdevice soc event handler in this SDK version.

Thanks in advance.

Parents
  • In SDK 14.1.0 there are quite a few changes to the SoftDevice handler library. You don't need to call softdevice_sys_evt_handler_set() anymore. Instead the NRF_SDH_SOC_OBSERVER() macro is used.

    This macro is already included in the fstorage library in SDK 14.1.0, so you shouldn't really need to do it either. You can see the following in nrf_fstorage_sd.h:

    /* Define a nrf_sdh_soc event observer to receive SoftDevice system events. */
    NRF_SDH_SOC_OBSERVER(m_sys_obs, 0, nrf_fstorage_sys_evt_handler, NULL);
    
  • In which context are you waiting in this loop? Main context? If you are in interrupt context, that could be the problem. Then your event handler may not get executed.

    I would also recommend checking the result of the operation, check that it is 0x00000000 (NRF_SUCCESS)

Reply Children
No Data
Related