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

Disconnect of bonded device

Hi!

I am having problems with bonding and the UART service. To connect to the peripheral I am using nrfConnect and nrfToolbox (UART) on an iPhone 6.

I am trying to setup an encrypted and bonded connection in the ble_app_uart example from SDK 8.0.0.

I am using a static passkey and have added this permissions to the characteristics/attributes:

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(&cccd_md.write_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(&attr_md.write_perm);

The TX char. has the same settings.

If the devices are not bonded, the pairing procedure starts (I need to enter the pin on the iPhone, etc.). In this case everything works fine. I can send, I can receive strings.

The problems start after the first disconnect. When I connect back (the devices are bonded) I get disconnected almost immediately with the disconnect reason 0x003D from the device manager.

Can you give me any thoughts on what am I doing wrong.

Thank you and kind regards, Rok

Parents
  • @petter thanks for your comment

    I am using SDK10 (and SoftDevice 130 version 1 on the nRF51 rev.3 ) with an unmodifed device manager and I also get the 0x003D (BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE) disconnection error. I enabled the log of the DM, here is the output (with some other debug logs):

    [DM]: Request to allocation connection instance
    [DM]:[00]: Connection Instance Allocated.
    [DM]:[00]:[Block ID 0x0003F800]:Loading bond information at 20002D70, size 0x0000001C, offset 0x0000001C.
    [DM]:[0x00]:[0xFF]: Bond context Event
    [DM]: Notifying application of event 0x21
    [DM]:[00]:Loading service context at 20002D8C, size 0x00000010, offset 0x00000038.
    [DM]:[0x00]:[0xFF]: Service context Event
    [DM]:[00]:[Block ID 0x0003F800]: Service context loaded, size 0xFFFFFFFF
    ���������|�5cDM_EVT_CONNECTION
    * Event id 16
    > LOCAL - Push new state = 2
    [DM]: >> BLE_GAP_EVT_SEC_INFO_REQUEST
    ����������������* Event id 20
    [DM]: Disconnect Reason 0x003D
    [DM]: Notifying application of event 0x12
    [DM]:[CI 0x00]: Freeing connection instance
    [DM]:[00]: Freed connection instance.
    [DM]: Initializing Connection Instance 0x00000000.
    * Event id 17
    

    I can reproduce this error when connecting the nRF51 peripheral software (which produce this error) with an Android and iOS phone. I use the "Just Works" pairing mechanism. Some characteristics are open, some other are BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM.

    Here is the procedure to reproduce it:

    1. Clear the list of the paired device in the DM on the nRF side
    2. Forget/Remove the paired device on the smartphone (iOS, Android)
    3. Start advertising on the peripheral and connect to it
    4. Connection is successful. The smartphone is bonded and paired and we can write to protected characteristics
    5. Disconnect. Make sure the device is disconnected. On Android, sometimes a paired device keep connected.

    This was the first use case and it works. Then, this is the procedure to reproduce the 0x003D error:

    1. Erase bonds on the nRF side. I use dm_device_delete_all.
    2. Start advertising.
    3. Connect to the peripheral from a smartphone (iOS or Android).
    4. Crash! Cannot connect (or immediately disconnected). We even do not get the connection event on the smartphone. We get the 0x003D error code on the nRF side.

    The reason why we got this error is because the device is still known as a paired device on the smartphone but no more on the peripheral. The only way to be able to connect again is to clear the device from the list of known device on the smartphone (step 2).

    In my opinion, this use case should be handle correctly by the device manager. In that error case, we got the connection failure quickly and we cannot send a security request to initiate the bonding request again.

    Are you aware of this use case and bug ? SDK10 is quite old now but could you provide a patch of the device manager ?

    Thank you in advance.

  • @Christopher Could you add a new question and rather add a link to this one? This could get a bit messy.

  • Hi guys,

    I have the completely same issue, so I’m wondering where can I found the debate about this issue? Or how to proceed in case that central have invalid encryption key?

    One approach is of course deleting bonding on smart device… any other idea?

    Thank you!

Reply Children
No Data
Related