What is the proper way to temporarily disable the softdevice? Currently I have the following
sd_ble_gap_adv_stop();
bool disabled_softdevice = false;
if (nrf_sdh_is_enabled())
{
nrf_sdh_disable_request();
while (nrf_sdh_is_enabled()) {}
disabled_softdevice = true;
}
nrf_nvmc_write_bytes((uint32_t)&NRF_UICR->CUSTOMER[0], ...);
...
if (disabled_softdevice)
{
nrf_sdh_enable_request();
while (!nrf_sdh_is_enabled()) {}
disabled_softdevice = false;
}
But soon after reenabling the softdevice asserts with the following callstack
SWI2_EGU2_IRQHandler
nrf_sdh_evts_poll
nrf_sdh_ble_evts_poll
where sd_ble_evt_get returns error code 0x4001.