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

Issue in pairing in ble_app_hids_keyboard example code

I am working on ble_app_hids_keyboard example code. I downloaded the bin file in my eval kit and tried to connect the Nordic_keyboard device with my android device. Then, i forget the device while the eval kit is powered ON then after that now the device is not showing when i search for all bluetooth device but when do the same thing through nrf_connect app, it is showing the device but i am not able to pair with the device.

Finally, i observed 1 more thing that when i connect the device using j-link and select Erase all option and then flash the code, it starts working.

Parents
  • Hi,

    I assume that you are using SDK version 15.0. The default behavior is to reject pairing request from an already bonded peer. You can change this by setting .allow_repairing to true. You need to do this in pm_evt_handler() for the event PM_EVT_CONN_SEC_CONFIG_REQ.

            case PM_EVT_CONN_SEC_CONFIG_REQ:
            {
                //  pairing request from an already bonded peer.
                pm_conn_sec_config_t conn_sec_config = {.allow_repairing = true}; //Now changed from false to true.
                pm_conn_sec_config_reply(p_evt->conn_handle, &conn_sec_config);
            } break;

Reply
  • Hi,

    I assume that you are using SDK version 15.0. The default behavior is to reject pairing request from an already bonded peer. You can change this by setting .allow_repairing to true. You need to do this in pm_evt_handler() for the event PM_EVT_CONN_SEC_CONFIG_REQ.

            case PM_EVT_CONN_SEC_CONFIG_REQ:
            {
                //  pairing request from an already bonded peer.
                pm_conn_sec_config_t conn_sec_config = {.allow_repairing = true}; //Now changed from false to true.
                pm_conn_sec_config_reply(p_evt->conn_handle, &conn_sec_config);
            } break;

Children
Related