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

sd_softdevice_disable() causes application to crash/hang if device is paired

If the device is paired (but not bonded) using "Just Works", sd_softdevice_disable() causes the application to hang/crash (nothing happens until reset by watchdog timer).

I use dfu_app_handler.c from sdk 8.1.0, so sd_softdevice_disable() is called from bootloader_start() when going from application to bootloader/DFU.

If pairing is not performed (using the exact same application) before writing START_DFU Op Code to the DFU Control Point characteristic, everything works as expected.

It should be fairly easy to recreate the issue. I use the following security parameters:

#define SEC_PARAM_TIMEOUT                    10
#define SEC_PARAM_BOND                       0
#define SEC_PARAM_MITM                       0
#define SEC_PARAM_IO_CAPABILITIES            BLE_GAP_IO_CAPS_NONE
#define SEC_PARAM_OOB                        0
#define SEC_PARAM_MIN_KEY_SIZE               7
#define SEC_PARAM_MAX_KEY_SIZE               16

And for the services I want encrypted I use:

BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM()

Any help would be greatly appreciated.

Parents
  • I am not sure, as I am using UART printouts for debugging at this point. But the program halts after sd_softdevice_disable() is called, meaning program execution never returns from the point where the function is called. There is no reset. I have adjusted my watchdog timeout to 10 seconds for testing, and this eventually resets the system.

    Although I cannot be sure, I suspect the situation is reproducible by using an example from sdk 8.1.0 which supports entering DFU from the application (using my security parameters). I say this because the issue disappears when setting SEC_PARAM_BOND to '1'. It also disappears if pairing is not performed at all.

Reply
  • I am not sure, as I am using UART printouts for debugging at this point. But the program halts after sd_softdevice_disable() is called, meaning program execution never returns from the point where the function is called. There is no reset. I have adjusted my watchdog timeout to 10 seconds for testing, and this eventually resets the system.

    Although I cannot be sure, I suspect the situation is reproducible by using an example from sdk 8.1.0 which supports entering DFU from the application (using my security parameters). I say this because the issue disappears when setting SEC_PARAM_BOND to '1'. It also disappears if pairing is not performed at all.

Children
No Data
Related