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

NRF51-ble-peripheral-bond-handling example

When i setup DEVICE_MANAGER_MAX_BONDS in 2 and trying to connect third device the nRF 51422 (10028) is freezing and all LED's light up. Why the algorithm in "device_manager_evt_handler" does't work?

Parents
  • I meant to say the values passed to the app_error_handler: uint32_t error_code, uint32_t line_num and const uint8_t * p_file_name.

    Just right click on the variables and add to watch while debugging like shown in the screenshot below.

    debug

    UPDATE 24.07.2015 #1

    I have not been able to recreate the problem on my end. Please try with the application that I compiled here where max bonds is set to '2' and see if it still asserts: nrf51422_xxac_s110.hex

    You can use nrfgo studio to program it. First, make sure to do a full erase first to clear any existing bonds, then program s110 v.8.0.0 and then the attached application.

    UPDATE 24.07.2015 #2

    Ok, was able to recreate the issue now. I have been using iOS devices when testing the code here which use private resolvable addresses as opposed to static ones with older versions of Android.

    Please try to replace 'table_index.mr_cnt_val++;' at line ~679 in main.c with the following lines:

        if(table_index.mr_index != p_handle->device_id)
        {
            //Increment counter variable for last bond for the new device
            table_index.mr_cnt_val++;
        }
    

    UPDATE 25.07.2015

    Uploaded fix to nRF51-ble-peripheral-bond-handling on Github which should work for more than two bonds as well.

    The other error you got is actually an event result from the DM telling the application that pairing failed with 0x00000081 (BLE_GAP_SEC_STATUS_PASSKEY_ENTRY_FAILED). In other words, it seems like iOS may require MITM protection if you do bonding in settings->Bluetooth rather than doing it in the nRFtoolbox app.To avoid this you can use nRFtoolbox instead. Just make sure to clear the existing bond Bluetooth settings reboot the phone first to stop it from reconnecting outside the app.

  • m_error_code == 0x00008010; m_line_num == 0x0000004E; m_p_file_name == 0x00018D94 "...\app_bond.c".

Reply Children
No Data
Related