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

Bonding errors in SDK 14

Hello,

I have recently ported our application from SDK 13 to SDK 14. Everything that worked in SDK 13 works in SDK 14. I then added the peer manager according to the ble_hrs example.

Every time I try to initiate bonding (through the nRF connect android app) I get a PM_EVT_ERROR_UNEXPECTED error in the pm_evt_handler() function.

When I trace it, it is originating in the pm_sm_evt_handler() function inside peer_manager.c, where it receives SM_EVT_ERROR_UNEXPECTED.

Do you have any ideas regarding what could cause this and where to check?

Thanks, Michael.

Parents
  • This was solved in MyPage.

    sd_ble_gap_sec_params_reply() was called twice, once inside Peer Manager and once in ble_evt_handler() in main.c. When it is called for the second time, inside Peer Manager, it returned an error because there was no BLE_GAP_EVT_SEC_PARAMS_REQUEST left to reply to.

    The solution was to remove:

    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; // BLE_GAP_EVT_SEC_PARAMS_REQUEST
    
Reply
  • This was solved in MyPage.

    sd_ble_gap_sec_params_reply() was called twice, once inside Peer Manager and once in ble_evt_handler() in main.c. When it is called for the second time, inside Peer Manager, it returned an error because there was no BLE_GAP_EVT_SEC_PARAMS_REQUEST left to reply to.

    The solution was to remove:

    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; // BLE_GAP_EVT_SEC_PARAMS_REQUEST
    
Children
Related