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

BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE after re-connection

Hi,

I ported some SDK code into my device (SDK 10 adapted for S110v7x) where I can successfully Bond my device and use the Services I need (ANCS on my case). I have simplified the example to not use the Whitelist.

The problem occurs when on my iPhone I turn OFF bluetooth (link is disconnected) and turn back ON. The BLE connection is correctly made. When I receive the BLE_GAP_EVT_SEC_INFO_REQUEST, the Device Manager can find the Device and can load bonding information.

But the I receive BLE_GAP_EVT_DISCONNECTED with 0x3D reason -> BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE. And I dont understand what could be wrong.

Here's log for first working connection with Bonding :

ANCS : ANCS ble_evt_dispatch id : BLE_GAP_EVT_CONNECTED (16)
[DM]: Request to allocation connection instance
[DM]:[00]: Connection Instance Allocated.
[DM]: Searching for device 0xBC 0xDD 0xF1 0x2A 0xB1 0x6B.
[DM]:[DI 0x00]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x01]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x02]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x03]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x04]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x05]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x06]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]: Notifying application of event 0x11
ANCS : Connected.
[DM]: >> dm_security_status_req
[DM]: << dm_security_status_req
[DM]: >> dm_security_setup_req
[DM]: << dm_security_setup_req, 0x00000000
ANCS : ANCS ble_evt_dispatch id : BLE_GAP_EVT_SEC_PARAMS_REQUEST (19)
[DM]: >> BLE_GAP_EVT_SEC_PARAMS_REQUEST
[DM]: Notifying application of event 0x13
ANCS : ANCS ble_evt_dispatch id : BLE_GAP_EVT_CONN_SEC_UPDATE (24)
[DM]: >> BLE_GAP_EVT_CONN_SEC_UPDATE
[DM]: --> gatts_context_apply
[DM]:[CI 0x00]: State 0x46, Size 0x00000000
[DM]: Notifying application of event 0x15
ANCS : ANCS ble_evt_dispatch id : BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP (48)
ANCS : ANCS ble_evt_dispatch id : BLE_GATTC_EVT_CHAR_DISC_RSP (50)
ANCS : ANCS ble_evt_dispatch id : BLE_GATTC_EVT_CHAR_DISC_RSP (50)
ANCS : ANCS ble_evt_dispatch id : BLE_GAP_EVT_AUTH_STATUS (23)
[DM]: >> BLE_GAP_EVT_AUTH_STATUS, status 00000000
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]: Allocated device instance 0x01
[DM]:[CI 0x00]:[DI 0x01]: Bonded!
[DM]: --> device_context_store
[DM]:[DI 01]:[CI 00]: -> Storing bonding information.
[DM]:pstore bond info, src : 20003820, size : 18, offset : 1c
[DM]: --> gatts_context_store
[DM]: Notifying application of event 0x14

And here's the second connection log, after BLE turned OFF and back ON on the iPhone :

ANCS : ANCS ble_evt_dispatch id : BLE_GAP_EVT_CONNECTED (16)
[DM]: Request to allocation connection instance
[DM]:[00]: Connection Instance Allocated.
[DM]: Searching for device 0x1A 0x25 0xD4 0x1C 0x96 0x6C.
[DM]:[DI 0x00]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x01]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x02]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x03]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x04]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x05]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x06]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]: Notifying application of event 0x11
ANCS : Connected.
ANCS : ANCS ble_evt_dispatch id : BLE_GAP_EVT_SEC_INFO_REQUEST (20)
[DM]: >> BLE_GAP_EVT_SEC_INFO_REQUEST
[DM]: Searching for device 0x07 0x00 0x00 0xD1 0x06 0x00.
[DM]:[DI 0x00]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]:[DI 0x01]: Device type 0xFF.
[DM]: Device Addr 0x00 0x00 0x00 0x00 0x00 0x00.
[DM]: Found device at instance 0x01
[DM]:[00]:[Block ID 0x0003F850]:Loading bond information at 20003820, size 0x00000018, offset 0x0000001C.
[DM]:[0x01]:[0xFF]: Bond context Event
[DM]: Notifying application of event 0x21
[DM]:[00]:Loading service context at 20003838, size 0x00000018, offset 0x00000034.
[DM]:[CI 0x00]:[DI 0x01]: --> gatts_context_load
[DM]:[0x01]:[0xFF]: Service context Event
[DM]: Notifying application of event 0x31
[DM]:[00]:[Block ID 0x0003F850]: Service context loaded, size 0xFFFFFFFF
ANCS : ANCS ble_evt_dispatch id : BLE_GAP_EVT_DISCONNECTED (17)
[DM]: Disconnect Reason 0x003D

We can see here, after loading bond information, the BLE_GAP_EVT_DISCONNECTED with 0x003D reason.

Any idea what could be wrong or missing ? I already looked for other subject about this error, but didn't find anything helpful.

Parents
  • You will get this error if you try to use incorrect encryption keys. Are you using the device manager from SDK 10? Does it work if you use whitelist? Does it work if you use an example from SDK 10, for example ble_app_hids_keyboard? Have many bonds have you stored in flash? Does it work if you only have one bond stored? Retry after you have erased and reprogrammed softdevice+app.

Reply
  • You will get this error if you try to use incorrect encryption keys. Are you using the device manager from SDK 10? Does it work if you use whitelist? Does it work if you use an example from SDK 10, for example ble_app_hids_keyboard? Have many bonds have you stored in flash? Does it work if you only have one bond stored? Retry after you have erased and reprogrammed softdevice+app.

Children
No Data
Related