You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a Galaxy Tab A8 and a modified "soc-empty" example I cannot reliably connect to a bonded device. On other android tablets that I have tried, there are no issues. Below is the example bonding settings that I am using (pardon the custom log functions). I can include the entire app.c file later if you would like.
If no bonding exists on either MCU or Tablet, then connection is successful and bond is then created (expected).
If existing bonding has been deleted on MCU but not tablet, then first attempt fails (expected) and it auto attempts a second time to connect and is successful (expected).
If both bonded and App is turned off and on, the connection and bonding is successful (expected).
If both bonded and MCU is turned off, the devices will never reconnect, no matter how many times the app or MCU restarts. The MCU reports SL_STATUS_BT_CTRL_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE and the tablet reports 0x08 GATT_INSUFFICIENT_AUTHORIZATION see here.
If existing bonding has been deleted on Tablet but not MCU, same as Scenario 4.
`
case sl_bt_evt_system_boot_id:
LOG_TRACE("sl_bt_evt_system_boot_id");
LOG_TRACE("evt->data.evt_system_boot.bootloader [%u]",
evt->data.evt_system_boot.bootloader);
LOG_TRACE("evt->data.evt_system_boot.build [%u]",
evt->data.evt_system_boot.build);
LOG_TRACE("evt->data.evt_system_boot.hash [%u]",
evt->data.evt_system_boot.hash);
LOG_TRACE("evt->data.evt_system_boot.hw [%u]",
evt->data.evt_system_boot.hw);
LOG_TRACE("evt->data.evt_system_boot.major [%u]",
evt->data.evt_system_boot.major);
LOG_TRACE("evt->data.evt_system_boot.minor [%u]",
evt->data.evt_system_boot.minor);
LOG_TRACE("evt->data.evt_system_boot.patch [%u]",
evt->data.evt_system_boot.patch);
// We decided to keep it as only delete bonds if the maximum has been
// exceeded since tablets don't delete bonds and it's causing issues
status = sl_bt_sm_store_bonding_configuration(MAX_ALLOWED_BONDS, 2);
if(status != SL_STATUS_OK){
//ble_send_device_event(connection_handle, nb_error_code_mcu_2_miscellaneous_error);
LOG_DEBUG("[E: 0x%04x] Failed to store bonding configuration\n", (int)status);
}
// Configure the Bluetooth security options
// Bit 0 = 1: Bonding requires MITM protection
// Bit 1 = 1: Encryption requires bonding. Note that this setting will
// also enable bonding.
// Bit 2 = 1: Secure connections only (no legacy connections)
// Bit 3 = 0: Bonding requests does not need to be confirmed. Received bonding
// requests are notified by @ref sl_bt_evt_sm_confirm_bonding
// Bit 4 = 0: Allow all connections
status = sl_bt_sm_configure(0x07, (uint8_t) sl_bt_sm_io_capability_displayonly);
if(status != SL_STATUS_OK){
LOG_DEBUG("[E: 0x%04x] Failed to set io capability\n", (int)status);
}
// Set it to "bondings allowed" mode
status = sl_bt_sm_set_bondable_mode(1);
if(status != SL_STATUS_OK){
LOG_DEBUG("[E: 0x%04x] Failed to allow bonding\n", (int)status);
}
// Default passkey. Valid range is 000000-999999 (-1 for random passkey)
status = sl_bt_sm_set_passkey(p_passkey);
if(status != SL_STATUS_OK){
LOG_DEBUG("[E: 0x%04x] Failed to set passkey\n", (int)status);
}
// Extract unique ID from BT Address.
status = sl_bt_system_get_identity_address(&address, &address_type);
if(status != SL_STATUS_OK){
LOG_DEBUG("[E: 0x%04x] Failed to get Bluetooth address\n", (int)status);
}
// Pad and reverse unique ID to get System ID.
system_id[0] = address.addr[5];
system_id[1] = address.addr[4];
system_id[2] = address.addr[3];
system_id[3] = 0xFF;
system_id[4] = 0xFE;
system_id[5] = address.addr[2];
system_id[6] = address.addr[1];
system_id[7] = address.addr[0];
status = sl_bt_gatt_server_write_attribute_value(gattdb_system_id, 0,
sizeof(system_id),
system_id);
if(status != SL_STATUS_OK){
LOG_DEBUG("[E: 0x%04x] Failed to write attribute\n", (int)status);
}
// Create an advertising set.
status = sl_bt_advertiser_create_set(&p_advertising_set_handle);
if(status != SL_STATUS_OK){
LOG_DEBUG("[E: 0x%04x] Failed to create advertising set\n", (int)status);
}
// Set advertising interval to 100ms.
status = sl_bt_advertiser_set_timing(p_advertising_set_handle, 160UL, // min. adv. interval (milliseconds * 1.6)
160UL, // max. adv. interval (milliseconds * 1.6)
0U, // adv. duration
0U); // max. num. adv. events
if(status != SL_STATUS_OK){
LOG_DEBUG("[E: 0x%04x] Failed to set advertising timing\n", (int)status);
}
// Start general advertising and enable connections.
status = sl_bt_advertiser_start(p_advertising_set_handle,
(uint8_t) sl_bt_advertiser_general_discoverable,
(uint8_t) sl_bt_advertiser_connectable_scannable);
if(status != SL_STATUS_OK){
LOG_DEBUG("[E: 0x%04x] Failed to start advertising\n", (int)status);
}
LOG_TRACE("Starting Advertising!");
break;`
The text was updated successfully, but these errors were encountered:
Update: One of the tablets that it works on is an A10.1 (AKA t510) and the one it doesn't work on is A8 (AKA X200).
If you would like to run my MCU project, I'm using a BGM111 soc-empty project. This app.txt (had to change from .c because GitHub limitations) can replace the existing app.c contents, and the included soc_empty.txt can replace the default soc_empty.slcp (again, I had to change the file name to include it here).
Using a Galaxy Tab A8 and a modified "soc-empty" example I cannot reliably connect to a bonded device. On other android tablets that I have tried, there are no issues. Below is the example bonding settings that I am using (pardon the custom log functions). I can include the entire app.c file later if you would like.
`
The text was updated successfully, but these errors were encountered: