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

"Pairing rejected by Nordic_HRM"

While I am going to pair with my android 9 Asus mobile phone with SDK 17 nRF52840. It in my mobile showing "Pairing rejected by Nordic_HRM". After that  I have added a some code line to

static void peer_manager_init(bool erase_bonds);

sec_param.bond = false;
sec_param.mitm = false;
sec_param.lesc = 0;
sec_param.keypress = 0;
sec_param.oob = false;
sec_param.min_key_size = 7;
sec_param.max_key_size = 16;
sec_param.kdist_own.enc = 0;
sec_param.kdist_own.id = 0;
sec_param.kdist_peer.enc = 0;
sec_param.kdist_peer.id = 0;
And getting same "Pairing rejected by Nordic_HRM"
After that I have added this code,
sec_param.bond = true;
sec_param.mitm = false;
sec_param.lesc = 0;
sec_param.keypress = 0;
sec_param.io_caps = BLE_GAP_IO_CAPS_NONE;
sec_param.oob = false;
sec_param.min_key_size = 7;
sec_param.max_key_size = 16;
sec_param.kdist_own.enc = 1;
sec_param.kdist_own.id = 1;
sec_param.kdist_peer.enc = 1;
sec_param.kdist_peer.id = 1;
And getting same "Pairing rejected by Nordic_HRM"
Please give some solution.
  • Hi

    Could it be that the pairing information is stored in one of the devices, as errors like these are prone to happen if one of the devices thinks it is connected to the other one? On the nRF side, please try doing an nrfjprog --eraseall with the nRF Command line tools or with the nRF Connect for Desktop Programmer application. On the Asus mobile, please try deleting bonding information as well. 

    Best regards,

    Simon

  • Hi

    Setting sec_param.bond = false; as you've done in the first snippet will cause this "pairing rejected" message as well, as this will disable the bonding feature. I would suggest leaving the parameters as they are by default in the ble_app_hrs example project (see snippet below).

    // Defines used to initialize the peer manager
    
    #define SEC_PARAM_BOND                      1                                       /**< Perform bonding. */
    #define SEC_PARAM_MITM                      0                                       /**< Man In The Middle protection not required. */
    #define SEC_PARAM_LESC                      1                                       /**< LE Secure Connections enabled. */
    #define SEC_PARAM_KEYPRESS                  0                                       /**< Keypress notifications not enabled. */
    #define SEC_PARAM_IO_CAPABILITIES           BLE_GAP_IO_CAPS_NONE                    /**< No I/O capabilities. */
    #define SEC_PARAM_OOB                       0                                       /**< Out Of Band data not available. */
    #define SEC_PARAM_MIN_KEY_SIZE              7                                       /**< Minimum encryption key size. */
    #define SEC_PARAM_MAX_KEY_SIZE              16                                      /**< Maximum encryption key size. */
    
    // peer manager initialization
    
    static void peer_manager_init(void)
    {
        ble_gap_sec_params_t sec_param;
        ret_code_t           err_code;
    
        err_code = pm_init();
        APP_ERROR_CHECK(err_code);
    
        memset(&sec_param, 0, sizeof(ble_gap_sec_params_t));
    
        // Security parameters to be used for all security procedures.
        sec_param.bond           = SEC_PARAM_BOND;
        sec_param.mitm           = SEC_PARAM_MITM;
        sec_param.lesc           = SEC_PARAM_LESC;
        sec_param.keypress       = SEC_PARAM_KEYPRESS;
        sec_param.io_caps        = SEC_PARAM_IO_CAPABILITIES;
        sec_param.oob            = SEC_PARAM_OOB;
        sec_param.min_key_size   = SEC_PARAM_MIN_KEY_SIZE;
        sec_param.max_key_size   = SEC_PARAM_MAX_KEY_SIZE;
        sec_param.kdist_own.enc  = 1;
        sec_param.kdist_own.id   = 1;
        sec_param.kdist_peer.enc = 1;
        sec_param.kdist_peer.id  = 1;
    
        err_code = pm_sec_params_set(&sec_param);
        APP_ERROR_CHECK(err_code);
    
        err_code = pm_register(pm_evt_handler);
        APP_ERROR_CHECK(err_code);
    }

    Did you have any luck erasing the bonding information on the nRF side, as that was the only way I was able to reproduce the "Pairing rejected by Nordic_HRM" message here on my side.

    Best regards,

    Simon

  • Yes, it is working. But I observed if I forget the "Nordic_HRM" from paired device on my Asus mobile end, then until I clear memory of nordic devices, I can not again paired nordic device again. How can I again pair again the nodic devices with my same mobile without clear Nordic memory. Please help.

  • Hi

    There are a few ways around this. The simplest one is likely to just erase bonding information on the nRF side as well upon a reset of the device, via a button, or whenever it fails to connect due to rejected pairing. deleting bonds can be done by a function like this for example.

    static void delete_bonds(void)
    {
        ret_code_t err_code;
    
        NRF_LOG_INFO("Erase bonds!");
    
        err_code = pm_peers_delete();
        APP_ERROR_CHECK(err_code);
    }

    Note that most examples, by default, checks during start-up if button 2 on the DK is pressed down, and if true calls this delete_bonds() function.

    Best regards,

    Simon

Related