Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Would like to require bonds

I have a button that will put my device into pairing mode. While in this mode, I want central devices that connect to form bonds so that when not in pairing mode I have a whitelist for bonded devices. I need to use Just Works parameters as my device only has this one button.

I tried using Just Works security params, but setting the bond param to 1 does not require centrals to bond. Is there a way I can get the desired functionality?

  • Hi,

    Could you provide some more information?

    • Is your device a BLE peripheral ?
    • Is the central a smartphone or a nRF device?
    • Are you using nRF51 or nRF52?
    • What SDK version are you using?
    • Are you using a particular SDK example ?
    • Are you calling pm_sec_params_set() to set the security parameters ?
  • Hi Sigurd,

    Thanks for the quick response. 

    To answer your questions:

    • BLE peripheral
    • Central is a smartphone/tablet
    • nRF52
    • SD 132 v 5
    • SDK 14.2

     Also

    • I'm using using bootloader_secure_ble (working and tested without bonds enabled)
    • The app is a combination of the ble_app_buttonless_dfu and ble_app_hrs examples
    • I am calling pm_sec_params_set() with Just Works settings

    There is some progress since the original post, but I still have the requirement to force bonding for secure DFU.

    * I am setting NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS to 1 in the app

    From looking at other info in the forums I found it isn’t sufficient to set the SEC_PARAM_BOND setting to 1. There must also be device data with access permissions that have non-zero security mode and level. So setting encryption parameters for attributes with:

        BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM( )

    causes Android to bond and causes iOS to ask to Pair or Cancel, which results in a bond if confirmed. If the user cancels, then the data is not readable, which is ok, however the DFU service is still accessible. Seems like that is expected behavior so far?

    *** However, if I set NRF_DFU_BLE_REQUIRES_BONDS to 1 in the bootloader, the app crashes when trying to access the SoftDevice when calling

    nrf_dfu_svci_vector_table_set()

    The last few lines of debug output are:

    <info> app: Setting vector table to bootloader: 0x00078000

    <error> app: ERROR 1 [NRF_ERROR_SVC_HANDLER_MISSING] at ./ble_dfu_service.c:78

    This looks like a missing SoftDevice, but I am programming it to flash along with the BL and App.

    I’m running out of ideas for things to try. Am I missing something?

  • Hi,

    Make sure that bootloader and application is compiled with the same value for the NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS flag.

    You should also make sure that you program the bootloader+app+sd+bootloader settings (needed to validate the application so that bootloader can boot app on startup). You can generate the bootloader settings page by following the instructions outlined here: http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.tools/dita/tools/nrfutil/nrfutil_settings_generate_display.html?cp=5_5_6

    When compiled with NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS flag set to '1' the bootloader will only advertise if peer data is available (i.e., bonding information). Problem is that peer data needs to be set by the application through the Supervisor call interface beforehand. In other words, you need to start DFU from the application. 

    Steps to test DFU with bonds:

Related