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

Deinit the stack

Hi,

Let's say that you have a processor and a nRF51822 as a coprocessor. The first processor sends commands to the nRF51822 to drive it (init the stack, init the services, start advertising...). Let's say that you want to run two different BLE applications. So you init the stack, the services of the first application, you execute the application. You disconnect and you want to launch the second application. Here is my question, what is the way to do it using the softdevice? Is it possible to deinit the stack and make the nRF51822 sleep to consume less and then init again the stack, the services and launch a second application?

  • Calling sd_ble_softdevice_disable() will disable the softdevice, and this also clears the GATT table and all stored state in the softdevice. This should therefore be a reasonable way to switch between applications.

    You can put an nRF51822 to sleep at any time, and the wake-up capabilities will depend on the sleep mode and enabled peripherals. You can take a look at this question, which tries to explain that.

    Also, if you put the chip in system off mode, a wakeup will cause a reset anyway, in which case all state of the softdevice is lost anyway.

Related