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

NRF52832 disable and enable SoftDevice

I work with NRF52832. Implemented an application based on the "ble_app_uart" example. Everything is working. I decided to add the saving of configurable parameters to the internal Flash memory. I write to Flash using the NVMC module, the use of which is possible only
with the SoftDevice stack disabled, otherwise Flash will crash. This is how I initially initialize the stack when power is applied to the device:

Then, in the body of the program, I disable the stack:

Then I successfully work with Flash memory (erase, write):

But I don't understand how to re-run the stack and advertising. Can someone tell me?

Parents Reply Children
  • I agree with here. You can use FDS (or fstorage for that matter). You don't need to disable the softdevice. fstorage and FDS has two backends. Either NVMC or the softdevice. From the application point of view, they do the exact same thing. The difference is that you need to use the softdevice backend when the softdevice is enabled.

    I strongly recommend you to look into that.

    However, you can use nrf_sdh_disable_request(); to request to disable the softdevice. Note the documentation in the declaration of this function:

    First when all modules that are observing the SDH events have acknowledged the request, the softdevice will be disabled. You can check the status of the softdevice handler by using 

    After that you need to enable the stack again. Just use the same function that you used initially, ble_stack_init(), I guess.

    Please look at the examples flash_fstorage or flash_fds examples in SDK\examples\peripheral. Note that they both have projects for "blank" and "s132", which refers to without and with the softdevice, respectively. Look into this.

    If you decide to disable the softdevice, it means you can't use the flash without disconnecting, and seise all softdevice activities.

    BR,

    Edvin