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

Priority of SWI0 (app_timer) and sd_app_evt_wait

I am attempting to wake up every 250ms using an app timer to manage some background tasks and update our BLE advertising manufacturer data if needed. However, once we enter power_manage(); and execute sd_app_evt_wait(); we no longer get SWI0 interrupts, unless a BLE event occurs. Is this because the SWI0 interrupt is too low of a priority to wake the MCU? Can this be changed to a higher priority? Is there a better way to accomplish this task than app_timer?

int main(void) {
  // Startup Delay: 0.1s
  nrf_delay_ms(100);
  // Initialize
  watchdog_init();
  ble_stack_init();  // Initialize SoftDevice here
  ble_vendor_uuids();
  timers_init();

	// Initialize persistent storage module.
  uint32_t err_code = pstorage_init();
  APP_ERROR_CHECK(err_code);

  gap_params_init();
  advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE);
  services_init();   // Create and start 250ms repeated timer here
  conn_params_init();
  sec_params_init();
  advertising_start();
  // Enter main loop
  for (;;)
  {
    power_manage();
    // Feed Watchdog
    NRF_WDT->RR[0] = WDT_RR_RR_Reload;
  }}