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

why i am getting pairing rejected by nordic _uart

hi..folks 

wish you happiee new year

i am using nrf52832 whille i tried to pair my device with my android , i am getting an error message " pairing rejected by nordic_uart "  why?

  • I do believe the example you refer to does not support pairing and bonding, refer to:

            case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
                // Pairing not supported
                err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
                APP_ERROR_CHECK(err_code);
                break;

    If you want to support pairing and bonding, then you need to use an example that have peer manager.

  • 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.
  • Presuming your change doesn't give any error code, then I suspect it may be related to HRM already have a bond, thereby doesn't want to allow re-bonding with the same peer. 

    Typically the application can allow re-pairing by adding the following in pm_evt_handler() in main.c:

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

    Though, be aware that the user should somehow control this (e.g. by the user for instance press a pairing button), because always allowing re-pairing should be considered an security issue.

    If this isn't the problem, then I would like a on-air sniffer log (e.g. from nRF sniffer) so I can see the actual on-air error.

Related