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

Enable/Disable BLE Stack and Softdevice -- SDK 15.3 S132

Have an application that configures a wifi SOC using spim before enabling BLE scanner.

When it is running there are 4 timer events running and the main loop check status and sends data using the wifi soc.

All that works fine until there is a socket error or other issue with the wifi soc.

In order to recover from those errors, you have to stop/start the soc well beyond what the softdevice can tolerate.

So I need to disable the softdevice and scanning and then reconfigure the wifi soc.

I use   ble_stack_stop();, nrf_drv_clock_lfclk_request(NULL);

to stop the softdevice and get the clock going again.

I had to re-init the spim interface but that worked out ok.

But the timer events are not being triggered. Do they need to be re-initialized as well ?

What is the best/correct way to temporarily disable the softdevice while  allowing the application with spim and app_timers to run as they were when the softdevice was enabled ?

This also allows for debugging functions after startup that don't require the softdevice by disabling it and then having full debug capability.

I used the GAZELL/BLE example and added a timer to switch between modes and that worked so I will have to re-visit how/why the timer continued to work in that application but not in my application.  

So the key questions are:

1) Based on the use of spim and timer events, am I disabling the softdevice and stack right ?

2) What should be needed to get the spim interface and timers working other than the lfclk_request referenced above ?

3) Then what is needed to go back to the original environment with the softdevice and stack operational ?