My app (using S130v2.0.1 nRF51822 SDK12.3) triggers app_error_fault_handler (seen on a PIN; since not able to debug due to timing) on sd_softdevice_disable(). A snippet of my code follows (using an available IRQn to trigger sd_softdevice_disable with priority 3):
#define SD_END_IRQn ADC_IRQn // NOt used by app #define SD_END_IRQHandler ADC_IRQHandler #define SD_END_IRQPriority 3 void SD_END_IRQHandler(void) { uint32_t err_code = sd_softdevice_disable(); APP_ERROR_CHECK(err_code); } void nrf_evt_signal_handler(uint32_t evt_id) { uint32_t err_code; switch (evt_id) { case NRF_EVT_RADIO_SIGNAL_CALLBACK_INVALID_RETURN: // No implementation needed break; case NRF_EVT_RADIO_SESSION_IDLE: err_code = sd_radio_session_close(); APP_ERROR_CHECK(err_code); break; case NRF_EVT_RADIO_SESSION_CLOSED: // The session is closed and all acquired resources are released. // Softdevice can be disabled. err_code = sd_nvic_SetPendingIRQ(SD_END_IRQn); APP_ERROR_CHECK(err_code); break; case NRF_EVT_RADIO_BLOCKED: case NRF_EVT_RADIO_CANCELED: configure_next_event_normal(m_ts_distance, m_ts_length); err_code = request_next_event_normal(); APP_ERROR_CHECK(err_code); break; default: break; } }
Any ideas why am I not able to disable softdevice?