Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

How to enable Bonding without passkey in an existing code.

Hi,

I am new to the nrf52 platform.

I am working on adding just works pairing and bonding to my BLE peripheral code. I tried to take reference from ble_app_bms example but it is not working. Is there a step-by-step guide that I can follow to enable security and bonding in an existing BEL code?

Regards

Parents
  • Hi,

    We don't have a guide for this, unfortnately. It's mostly a matter of adding the neccessary source files and include paths. Did you start completely from scratch, or did you use one of the SDK examples as a starting point when you made your project?

    It's often easier to start with an example that already integrates the Peer manager. Lets for instance say you used the ble_app_uart example, then it would have been easier to take the NUS service and add it to another example such as ble_app_hrs that already support pairing than it would be to add the peer manager to the NUS example. 

    I can also help with the intergration if you are able to share your project. 

    Best regards,

    Vidar

  • Hi Vidar,

    I tried doing that but my device goes in some kind of exception state and never boots. I am not using 32K crystal.

    I took references from both hrs and ble_blinky example.

    I am sharing my project in private.

    Reagrds

Reply Children
  • Hi,

    You need to apply the following configuration to your sdk_config.h file if you don't have a 32K crystal mounted on your board:

    //==========================================================
    
    // <h> Clock - SoftDevice clock configuration
    
    //==========================================================
    // <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.
     
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 0
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval. 
    #ifndef NRF_SDH_CLOCK_LF_RC_CTIV
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature. 
    // <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated
    // <i>  if the temperature has not changed.
    
    #ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_ACCURACY  - External clock accuracy used in the LL to compute timing.
     
    // <0=> NRF_CLOCK_LF_ACCURACY_250_PPM 
    // <1=> NRF_CLOCK_LF_ACCURACY_500_PPM 
    // <2=> NRF_CLOCK_LF_ACCURACY_150_PPM 
    // <3=> NRF_CLOCK_LF_ACCURACY_100_PPM 
    // <4=> NRF_CLOCK_LF_ACCURACY_75_PPM 
    // <5=> NRF_CLOCK_LF_ACCURACY_50_PPM 
    // <6=> NRF_CLOCK_LF_ACCURACY_30_PPM 
    // <7=> NRF_CLOCK_LF_ACCURACY_20_PPM 
    // <8=> NRF_CLOCK_LF_ACCURACY_10_PPM 
    // <9=> NRF_CLOCK_LF_ACCURACY_5_PPM 
    // <10=> NRF_CLOCK_LF_ACCURACY_2_PPM 
    // <11=> NRF_CLOCK_LF_ACCURACY_1_PPM 
    
    #ifndef NRF_SDH_CLOCK_LF_ACCURACY
    #define NRF_SDH_CLOCK_LF_ACCURACY 1
    #endif
    

Related