2018-01-03 08:23 AM
Hi,
I'm using BlueNRG as bt peripheral. I can successfully pair my android smartphone, but the
BlueNRG doesn'tadd the smartphone to the bonding list.
aci_gap_init(GAP_PERIPHERAL_ROLE, 0x00, 0x08, &BluetoothIOService_ServiceHandle, &dev_name_char_handle, &appearance_char_handle);
aci_gap_set_authentication_requirement(BONDING, MITM_PROTECTION_NOT_REQUIRED, SC_IS_NOT_SUPPORTED, KEYPRESS_IS_NOT_SUPPORTED,
7, 16, USE_FIXED_PIN_FOR_PAIRING, 123456, 0x01);�?�?�?�?
On pairing complete event the bonded devices list is always empty. I suppose it should contains the smartphone address.
numBonds is always 0
void aci_gap_pairing_complete_event(uint16_t Connection_Handle, uint8_t Status, uint8_t Reason) {
if (Status == 0x00) {
uint8_t ret = aci_gap_configure_whitelist();
uint8_t numBonds;
Bonded_Device_Entry_t bonds[12];
ret = aci_gap_get_bonded_devices(&numBonds, bonds);
if (numBonds > 0) {
Whitelist_Identity_Entry_t wle;
wle.Peer_Identity_Address_Type = bonds[0].Address_Type;
memcpy(wle.Peer_Identity_Address, bonds[0].Address, 6);
ret = aci_gap_add_devices_to_resolving_list(1, &wle, 0);
uint8_t i;
for (i = 0; i < numBonds; i++) {
printf('bonded %0X:%0X:%0X:%0X:%0X:%0X', bonds[i].Address[0], bonds[i].Address[1],
bonds[i].Address[2], bonds[i].Address[3], bonds[i].Address[4], bonds[i].Address[5]);
}
}
}
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
What I'm doing wrong?
Thanks
#bluenrg-1 #bluenrg2018-01-08 06:57 AM
Hi Francesco,
according to section 3.5 of
you should add one more step in the pairing process, i.e., you should set the I/O caps (aci_gap_set_io_capability() API) before calling aci_gap_set_authentication_requirement() API.Hope that could help.
Kind regards
Andrea
2018-01-08 07:11 AM
Hi Andrea,
I already have it in my code. Here the complete source:
ret = BlueNRG_Stack_Initialization(&BlueNRG_Stack_Init_params);
if (ret != BLE_STATUS_SUCCESS) {
return false;
}
/* Configure Public address */
ret = aci_hal_write_config_data(CONFIG_DATA_PUBADDR_OFFSET, CONFIG_DATA_PUBADDR_LEN, bdaddr);
if (ret != BLE_STATUS_SUCCESS) {
return false;
}
/* Set the TX power to -2 dBm */
ret = aci_hal_set_tx_power_level(1, 4);
if (ret != BLE_STATUS_SUCCESS) {
return false;
}
/* Init the GATT */
ret = aci_gatt_init();
if (ret != BLE_STATUS_SUCCESS) {
return false;
}
ret = aci_gap_init(GAP_PERIPHERAL_ROLE, 0x00, 0x08, &BluetoothIOService_ServiceHandle, &dev_name_char_handle, &appearance_char_handle);
if (ret != BLE_STATUS_SUCCESS) {
Log_error('BLE', 'cannot init peripheral role 0x%02x', ret);
return false;
}
ret = aci_gap_set_io_capability(IO_CAP_NO_INPUT_NO_OUTPUT);
if (ret != BLE_STATUS_SUCCESS) {
Log_error('BLE', 'cannot set io capability 0x%02x', ret);
return false;
}
// 0x01: Random (static) Identity Address
ret = aci_gap_set_authentication_requirement(BONDING, MITM_PROTECTION_NOT_REQUIRED, SC_IS_NOT_SUPPORTED, KEYPRESS_IS_NOT_SUPPORTED,
7, 16, USE_FIXED_PIN_FOR_PAIRING, 123456, 0x01);
�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
2018-01-08 09:03 AM
Hi Francesco,
let me add one more thing. It could happen that your smartphone is using a Non Resolvable Private Address (this could be checked sniffing packets coming from the master). In this case, the smartphone cannot be added to the bonded devices list unless a more secure I/O capability is set by the slave.
Kind regards
Andrea
2018-01-11 06:02 AM
Hi Andrea,
thanks. The smartphone is not using a
Non Resolvable Private Address. I also verified that with another device (not bluenrg) it can bonds correctly.
I really don't know what to do
Thanks
2018-01-12 01:43 AM
Hi,
I also tried setting
I/O capability to IO_CAP_DISPLAY_ONLY but the bonding list is always empty after the pairing process.