This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nrf52840 BLE Radio Disable

I would like to disable completely the 2.4Ghz radio after the 52840 has full soft device enabled and ble stack has been run.

This is after the full sequence of bluetooth communication has been started and is ongoing.

I have attempted to use both

nrf_sdh_disable_request();
or
sd_softdevice_disable();
sd_softdevice_disable() results in a call stack like this
app_error_fault_handler@0x00027fbe (...nordic\nRF5_SDK_17.0.2_d674dde\components\libraries\util\app_error_weak.c:100)
app_error_handler_bare@0x00027f88 (...nordic\nRF5_SDK_17.0.2_d674dde\components\libraries\util\app_error.c:73)
nrf_sdh_evts_poll@0x0003373a (...nordic\nRF5_SDK_17.0.2_d674dde\components\softdevice\common\nrf_sdh.c:358)
<signal handler called>@0xffffffe9 (Unknown Source:0)
??@0x00025f40 (Unknown Source:0)
??@0x0001671c (Unknown Source:0)
I end up in
app_error_fault_handler()
and a fatal error is reported.
I think my problem is that after I disable the SoftDevice with either of the two functions the following two polling functions are still firing.
How do I stop these now that the soft device is down? Are there any additional steps or teardown I should be doing before calling the above two functions in my attempt to shutdown the soft device and return the 2.4Ghz radio to a "Disabled" state.
nrf_sdh_ble_evts_poll@0x00033792 (...nordic\nRF5_SDK_17.0.2_d674dde\components\softdevice\common\nrf_sdh_ble.c:313)
nrf_sdh_evts_poll@0x0003373a (...nordic\nRF5_SDK_17.0.2_d674dde\components\softdevice\common\nrf_sdh.c:358)
<signal handler called>@0xffffffe9 (Unknown Source:0)
??@0x00025f40 (Unknown Source:0)
??@0x0001671c (Unknown Source:0)
  • Hi 

    Is there any chance you are trying to call nrf_sdh_disable_request() from interrupt context? 

    If so, do you know which level?

    If you are calling this function from main context I don't understand why it would fail. 

    Is your code based on one of the standard SDK examples, or is it mostly custom?

    Best regards
    Torbjørn 

  • Dang Torbjorn!

    I think you nailed it. I was calling from a NUS response handler.

    Setup to call from main instead, seems good to go!

    I used nrf_sdh_disable_request() from main (not a handler/callback)

    I also had to dodge

    ```buttonless_dfu_sdh_state_observer()```
    servicing the
    ```NRF_SDH_EVT_STATE_DISABLED```
    event and shutting down the system by setting my own flag.

    Appreciate the help.I assume the soft device releasing the radio peripheral would put the radio peripheral into "Disabled" state.

    Regards,
    Chris.

  • Hi Chris

    Good to hear you figured it out Slight smile

    The radio will be disabled after you have disabled the SoftDevice, that is correct. 

    Best regards
    Torbjørn

Related