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

when I reconnect the device pin or key missing

Dear Nordic:

Help to see this problem,tks

Problem description:

SDK:nRF5_SDK_15.2.0_9412b96

status:bonded device

demo:Let's refer to this sample code ---- nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\ble_app_template

First, bond the nrf52832 device on the sdm845 mobile phone using android settings app. Then turn off the nrf52832 and turn it on again. The nrf52832 and the mobile phone cannot be connected successfully.

hci log on phone:

1,211 Event Disconnection Complete Success 0x0002 4 7 2020/9/28 16:57:28.069864 00:00:00.001053  //turn off nrf52832 and disconnected between nrf52832 and phone

1,216 Command 0x2011 Low Energy HCI_LE_Add_Device_To_White_List 7 11 2020/9/28 16:57:28.074141 00:00:00.000609  // write white list on phone

1,218 Command 0x2043 Low Energy HCI_LE_Extended_Create_Connection_Command 42 46 2020/9/28 16:57:28.079150 00:00:00.000567 //enable background connection on phone

1,220 Event LE Enhanced Connection Complete Success 31 34 2020/9/28 17:04:17.872735 00:06:49.789484  //turn on nrf52832 then receive connection complete event

1,240 Command 0x2019 Low Energy HCI_LE_Start_Encryption 28 32 2020/9/28 17:04:17.895165 00:00:00.000514  // phone Start_Encryption

1,249 Event Encryption Change PIN or Key Missing 0x0004 4 7 2020/9/28 17:04:18.735462 00:00:00.171885  //but Encryption fail 

Attempted operation:

1. turn on then turn off Bluetooth on phone,then Encryption success,connection succeed

2. nrf52832 keep away from the phone. After the link is disconnected, then close to the phone again, and the automatic reconnection is successful.

  • Hi

    First off, have you tried using the nRFConnect for Android app to see if the issue prevails in our app as well? What I assume is happening here, is that one of the devices has erased the bonding information, while the other has not. So if the Android device has the bonding information stored, then it won't be able to bond again as it thinks it is already bonded with your nRF52. Have you made any changes at all to the ble_app_template project? I assume that somehow it deletes the bonding information when you turn it off. Most of our examples does this if button 2 (P0.14) on the DK is pressed upon startup, which might be what is happening here, seeing as this issue only occurs when you turn the device off.

    Best regards,

    Simon

  • Hi,Nordic:

    First off, have you tried using the nRFConnect for Android app to see if the issue prevails in our app as well?

    ==》We use NRFConnect to connect NRF52832. When encrypting, there will be PIN or key missing when reconnecting.

    Scenarioone, Bond first and then connect with NRFConnect step:

    1. Bond the nrf52832 device on the sdm845 mobile phone using android settings app.

    2. On the NRFConnect app, click connect nrF52832.

    3. Turn off NRF52832,then turn it on. and it will reconnect automatically( because Settings APK uses background connection)

    4. The PIN or key missing error is still present. 

    2,796 Event Encryption Change PIN or Key Missing 0x0004 4 7 2020/11/11 6:52:50.346560 00:00:00.173523 

    Now  the encryption process fails, but the ACL link is connected.  The subsequent interactive data then becomes unencrypted data.

    Scenario two We just use NRFConnect APK to connect NRF52832 step:

    1. connect NRF52832 using NRFConnect .

    2. bonded NRF52832 device using NRFConnect .

    3. Turn off NRF52832,then turn it on. and it will reconnect automatically(nrfconnect enable background connection)

    4. The PIN or key missing error is still present. 

    10,436 Event Disconnection Complete Success 0x0007 4 7 2020/11/11 7:22:31.581183 00:00:00.002060

    10,438 Command 0x2043 Low Energy HCI_LE_Extended_Create_Connection_Command 42 46 2020/11/11 7:22:31.584379 00:00:00.000443

    // restart NRF52832 device.

    10,444 Event LE Enhanced Connection Complete Success 31 34 2020/11/11 7:22:58.657200 00:00:27.059425

    10,462 Command 0x2019 Low Energy HCI_LE_Start_Encryption 28 32 2020/11/11 7:22:58.683573 00:00:00.000313

    10,471 Event Encryption Change PIN or Key Missing 0x0008 4 7 2020/11/11 7:22:59.528533 00:00:00.179602

  • What I assume is happening here, is that one of the devices has erased the bonding information, while the other has not

    ==>Yes, the encrypted link can be successful when the Phone switches bluetooth again.When NRF52832 is shut down and recharged, the encrypted link fails due to PIN or key missing. 

    Have you made any changes at all to the ble_app_template project?

    ==>We haven't made any changes to the link connection.

    Most of our examples does this if button 2 (P0.14) on the DK is pressed upon startup, which might be what is happening here, seeing as this issue only occurs when you turn the device off.

    ==>When I started NRF52832, I only pressed the power key.

    Q1:

    In the ble_app_template project, we found no call to save the bond information.In this Template project, how does it save bond information when NRF52832 is shut down?

    Q2:

    In the HID_mouse project, we see that there is a Whitelist configuration. Is it related to storing bond information?

  • Hi

    1. The peer manager should take care of storing bonding information for a connection, both in the ble_app_template and our other examples supporting pairing over BLE.

    2. You can read more about whitelisting here. This is not the same as bonding information.

    Best regards,

    Simon

  • Hi,Nordic:

    I`m sorry, we checked carefully and deleted the delete_bond call that should not have appeared when the nrf52832 was booted up.

    However, the first phone USES NRFConnect to connect NRF52832 to connect normally.When the second phone connects NRFConnect to NRF52832, a paired bounding box appears. What is the reason for this?

    tks

Related