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

Which SDH Dispatch mode should I use?

While porting my app to the latest 14.0 SDK, it got a little stuck with the new sdh library. I was previously fetching all events through a custom poll & wait loop, but I decided to switch to the sdh library now. Now the question is, what are the PROS and CONS of each dispatch model? I haven't found no explanation in the Documentation about this.

My application must Process events for Buttons, BLE, Timer, Soc, Radio and maybe more in the future. It is not implemented thread/interrupt safe, so I must make sure that all dispatch methods are called one after the other. (There are some exceptions, e.g. UART having a custom buffering that can be always triggered) How would I make sure that Timer, BLE and Soc Events are delivered one after the other to my application when using the nrf_sdh library?

Thanks, Marius

Parents
  • Hi Marius,

    I assume you modified the softdevice_handler in the older SDK so that instead of pulling the event out on SWI2 interrupt it will fetch the event though a loop and poll?

    The mechanism wasn't change with SDK v14. You still can modify that to your customized one, inside nrf_sdh.c

    What we introduced in SDK v14 with the SDH library was (according to release note):

    - SoftDevice Handler:
        - Can now register 'state event observers' that are notified when the SoftDevice state changes.
        - Can now register 'request event observers' that are notified when a change of the SoftDevice state is requested.
    

    In addition, as stated in the doc, you can choose different priorities for different Observers, so you can control the order of the observer handlers when there is an event.

  • I see, I would suggest to pull the events out using ISR, but offload the time consuming tasks in to main loop using app scheduler for example.

Reply Children
No Data
Related