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

Event handler interaction

Is there a document describing the interaction and any asynchronous issues with the different types of event handlers? As I read it there are softdevice events, BLE events, timer events and button events. Are the handlers for all of these and any I've missed, schedule step on each other, or which once do I need to be concerned about critical sections?

Parents
  • The softdevice interrupt your event_handler to process and queue more events, but after that it will pend the SWI2 interrupt again.

    There are two scenarios here

    1)No_scheduler is used for events handling In this case your application event_handler is running at SWI2 interrupt context, the new pend of SWI2 interrupt by the new event inside the softdevice will not interrupt your event_handler until its finished.

    1. scheduler is used for running softdevice_handler module in different interrupt context Then the app_scheduler internal event buffer will make sure that the events are pulled out in serial way.

    One NOTE though, By serial here I mean that the the previous handler is not interrupted by new event until its gets finished.

    By serial I do not say that the sequence of events occurance and the events_handler call is same. Because this cannot be guarenteed as the sd_evt_get searches for events inside the softdevice from the start again. So if event1 handler is executing and while it is executing three more events happen inside softdevice (event3, event 10 and event1) Then after the event_handler for event1 is finished then sd_evt_get will return event1 instead of event3 as it searches for events from the start.

Reply
  • The softdevice interrupt your event_handler to process and queue more events, but after that it will pend the SWI2 interrupt again.

    There are two scenarios here

    1)No_scheduler is used for events handling In this case your application event_handler is running at SWI2 interrupt context, the new pend of SWI2 interrupt by the new event inside the softdevice will not interrupt your event_handler until its finished.

    1. scheduler is used for running softdevice_handler module in different interrupt context Then the app_scheduler internal event buffer will make sure that the events are pulled out in serial way.

    One NOTE though, By serial here I mean that the the previous handler is not interrupted by new event until its gets finished.

    By serial I do not say that the sequence of events occurance and the events_handler call is same. Because this cannot be guarenteed as the sd_evt_get searches for events inside the softdevice from the start again. So if event1 handler is executing and while it is executing three more events happen inside softdevice (event3, event 10 and event1) Then after the event_handler for event1 is finished then sd_evt_get will return event1 instead of event3 as it searches for events from the start.

Children
No Data
Related