Peripheral: nRF52840 DK
Central: OnePlus 6T, nRF Connect app
I modified ble_app_uart example, to support Bluetooth Long Range:
static void advertising_init(void)
{
uint32_t err_code;
ble_advertising_init_t init;
memset(&init, 0, sizeof(init));
init.advdata.name_type = BLE_ADVDATA_FULL_NAME;
init.advdata.include_appearance = false;
init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
init.config.ble_adv_primary_phy = BLE_GAP_PHY_CODED; // I added this
init.config.ble_adv_secondary_phy = BLE_GAP_PHY_CODED; // I added this
init.config.ble_adv_extended_enabled = true; // I added this
init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]); // I changed srdata to advdata
init.advdata.uuids_complete.p_uuids = m_adv_uuids; // I changed srdata to advdata
init.config.ble_adv_fast_enabled = true;
init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
init.config.ble_adv_fast_timeout = APP_ADV_DURATION;
init.evt_handler = on_adv_evt;
err_code = ble_advertising_init(&m_advertising, &init);
APP_ERROR_CHECK(err_code);
ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
}
I observe two issues:
- Advertising is in short bursts. I measured, that device advertises for 5 seconds, and then 15 seconds delay. Because of this, it's hard to find and connect to device
(this is long-range)
(this is normal phy) - It's hard to connect. From like 15 tries of connecting, only 4 was successful, after connection, the connection was stable and everything was working correctly
After deleting Long Range code added upper (thus, using normal PHY), everything works perfect.
Any ideas where could be a problem?
Thanks
