Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What happens when the scheduler gets full?

Hello!

On the firmware for a certain product, we are using the scheduler module to manage the access to the peripherals (SPI, TWI, Timer, ...), and have also enabled its use for the SoftDevice.

My question is what happens to the Softdevice events if the queue becomes full? Do they have some sort of priority over the other ones? Does the device block?

We're using SDK 12.3 (we need nRF51 support...).

Thanks!

Parents
  • Hi,

    The SoftDevice events are transferred to the scheduler by simply calling app_sched_event_put(). In SDK 12.3 this is done by softdevice_evt_schedule(), which is registered as the event handler, and called from SOFTDEVICE_EVT_IRQHandler(). If there is an error (e.g. queue full), this will be caught by the error check on line 427 in softdevice_handler.c (For SDK 15 this is similar, but there SD_EVT_IRQHandler() in nrf_sdh.c calls app_sched_event_put() in case NRF_SDH_DISPATCH_MODEL is set to NRF_SDH_DISPATCH_MODEL_APPSH in the projects sdk_config.h).

    As mentioned above, an APP_ERROR_CHECK will capture the error if there is an error while attempting to put a SoftDevice event to the scheduler queue. The default error handler will reset the device if DEBUG is not defined. Alternatively, it will enter an eternal loop in the error handler if DEBUG is defined. You should make sure that the scheduler queue is large enough that this never happen under normal circumstances.

Reply
  • Hi,

    The SoftDevice events are transferred to the scheduler by simply calling app_sched_event_put(). In SDK 12.3 this is done by softdevice_evt_schedule(), which is registered as the event handler, and called from SOFTDEVICE_EVT_IRQHandler(). If there is an error (e.g. queue full), this will be caught by the error check on line 427 in softdevice_handler.c (For SDK 15 this is similar, but there SD_EVT_IRQHandler() in nrf_sdh.c calls app_sched_event_put() in case NRF_SDH_DISPATCH_MODEL is set to NRF_SDH_DISPATCH_MODEL_APPSH in the projects sdk_config.h).

    As mentioned above, an APP_ERROR_CHECK will capture the error if there is an error while attempting to put a SoftDevice event to the scheduler queue. The default error handler will reset the device if DEBUG is not defined. Alternatively, it will enter an eternal loop in the error handler if DEBUG is defined. You should make sure that the scheduler queue is large enough that this never happen under normal circumstances.

Children
No Data
Related