Other Parts Discussed in Thread: CC2640, , CC2650
Hi TI expert,
I'm working with CC2640 and sdk_1_35_00_33. My "multi_role" application can accept a connection from a Master, through the passkey process.
I've add the fix required in APP
1. CCCD Not Updated when Bonded Device Reconnects when using IAR EWARM IDE 7.80.3
To workaround this issue, deoptimizing GATTServApp_ProcessCCCWriteReq in gattservapp_util.c solves the issue. Deoptimize by inserting the following code above the function declaration:
#pragma optimize=none bStatus_t GATTServApp_ProcessCCCWriteReq( uint16 connHandle, gattAttribute_t *pAttr, |
as explained here https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/770333
I'm using the following set up
--------------------------------------------------------
uint8_t pairMode = GAPBOND_PAIRING_MODE_INITIATE;
uint8_t mitm = TRUE;
uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
uint8_t bonding = TRUE;
GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);
uint8_t gapbondSecure = GAPBOND_SECURE_CONNECTION_ONLY;
GAPBondMgr_SetParameter(GAPBOND_SECURE_CONNECTION_ONLY, sizeof(uint8_t), &gapbondSecure);
and I've also add
#define APP_TX_PDU_SIZE 27
#define APP_RX_PDU_SIZE 27
#define APP_TX_TIME 328
#define APP_RX_TIME 328
HCI_EXT_SetMaxDataLenCmd(APP_TX_PDU_SIZE , APP_TX_TIME, APP_RX_PDU_SIZE, APP_RX_TIME);
uint8_t featSet[8] = {0};
CLR_FEATURE_FLAG( featSet[0], LL_FEATURE_DATA_PACKET_LENGTH_EXTENSION);
HCI_EXT_SetLocalSupportedFeaturesCmd( featSet );
as suggested here
--------------------------------------------------------
I'm using BLE Scanner o similar APP on my smartphone to test the pairing and bonding process.
At first, the pairing and bonding seems ok( i send the passkey to the multi_role with no problem and i can see the correct bonding complete process).
Once the pairing and Bonding is done, i terminate the link with Sphone.
The problem come when, later, i try to test many times the connections and disconnections between the two device: as expected, during the connection request from the sphone, most of the time multi_role doesn't ask anymore the passkey and everything works fine. But sometime, the multi_role during the connection request seems to lost the LTK, leading to a new pairing and bonding process, wich is not acceptable (from customer point of view).
the error is similar I've found here
With bond already made, if a next connection from Sphone is ok with no issue, i can see from
multi_role_processStackMsg() the event (not handled) HCI_LE_LTK_REQ_REPLY (0x201A) while when the connection lead to the problem above, the event (not handled) is HCI_LE_LTK_REQ_NEG_REPLY (0x201B)
The HCI_LE_LTK_REQ_NEG_REPLY event come out randomically, sometime at the first connection I try to do with SPhone, sometime after 20 Link.. I really cannot understand the problem
In STACK I have set inside build_config.opt
-DV42_FEATURES=SECURE_CONNS_CFG and -DGAP_BOND_MGR
I've also try to add the define SC_HOST_DEBUG (adding the fix needed in gapbondmgr.c required for this SDK) but with same results.
May be I need to handle the event HCI_LE_LTK_REQ_NEG_REPLY when it happen in someway?
I'm attaching sniffer log with both the OK and KO behaviours
Hope you can help me, because I'm stuck in this problem
Thanks and Regards, Federico