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);
    
  • Hi Petter, Thanks for the reply. I am able to write and update, but not always.

    1. i am using fds_evt_handler initiated by peer_manager to know write/update events completed. when ever a write or update event is completed i try to update a flag and read it to know that event is completed. But not all write/update operations is triggering the handler and my code is struck as in while loop waiting for the flag to get changed.

    Is there any way i can get know that the event is completed .

    This is how my current evnt handler looks like:

     switch (p_fds_evt->id)
        {
            case FDS_EVT_WRITE:
                  written = true;
                 break;
            case FDS_EVT_UPDATE:
                 updated = true;
                 break;
    
Reply
  • Hi Petter, Thanks for the reply. I am able to write and update, but not always.

    1. i am using fds_evt_handler initiated by peer_manager to know write/update events completed. when ever a write or update event is completed i try to update a flag and read it to know that event is completed. But not all write/update operations is triggering the handler and my code is struck as in while loop waiting for the flag to get changed.

    Is there any way i can get know that the event is completed .

    This is how my current evnt handler looks like:

     switch (p_fds_evt->id)
        {
            case FDS_EVT_WRITE:
                  written = true;
                 break;
            case FDS_EVT_UPDATE:
                 updated = true;
                 break;
    
Children
No Data
Related