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

Peer manager, bonding fails with error code 133

I am working on two devices, a peripheral and a central.  The peripheral is custom hardware.  The central is being run on a Rigado BMD-300 series evaluation kit.  I'm using Segger IDE and NRF5 SDK 16.

I can get the central and peripheral to pair consistently.  Discovery works and the central sees the characteristics (and changes) correctly.  Now I'm working on bonding and whitelisting.

After discovery is complete (in the discovery event handler), I am calling pm_conn_secure():

// Initiate bonding.
ret_code_t err_code = pm_conn_secure(p_evt->conn_handle, false);
NRF_LOG_DEBUG("Called pm_conn_secure, conn_handle = %d, err_code = %d", p_evt->conn_handle, err_code);
if (err_code != NRF_ERROR_BUSY)
{
  APP_ERROR_CHECK(err_code);
}

which returns NRF_SUCCESS.  Quickly thereafter, I get a PM_EVT_CONN_SEC_FAILED event in the Peer Manager event handler.  In the logs, I  see the following:

changes to <debug> app: Called pm_conn_secure, conn_handle = 0, err_code = 0

<debug> nrf_ble_gq: Processing the request queue...

<debug> nrf_ble_gq: Processing the request queue...

<info> peer_manager_handler: Connection security failed: role: Central, conn_handle: 0x0, procedure: Bonding, error: 133

<debug> app: Got PM_EVT_CONN_SEC_FAILED event

<debug> nrf_ble_gq: Processing the request queue...

<debug> nrf_ble_gq: Processing the request queue...

Questions:

1) Is there something I have to do in the peripheral to allow bonding?

2) Any ideas on what could be causing this?

Parents
  • Here is my peer_manager_init():

    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           = true;
        sec_param.mitm           = false;
        sec_param.lesc           = false;
        sec_param.keypress       = false;
        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;
    
        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);
    }
    

  • Hi, 

    Are you sure the peripheral is supposed to support bonding? The log shows the peripheral is responding with status code 133/0x85 which corresponds to BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP (MSC: Pairing failure: Pairing aborted by the application). Maybe you can try to bond with the peripheral using our nRF connect app on Android/iOS and see if that works

Reply Children
Related