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

Bluetooth Long Range - Advertising and Connection issues

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:

  1. 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)
  2. 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

Parents
  • Hi

    Please note that you need to set the advdata.flags to BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE in order to use Coded PHY advertising. Also make sure that the scan response data is set to null, as extended advertising (which is used by Coded PHY) does not support scan response data.

    The long range scanner log you're seeing is reminiscent of that in a phone that does not support Coded PHY fully, as it's not able to scan on the secondary advertising channels. (which are the gaps you're seeing). A Coded PHY advertisement will advertise for a small amount of time on the primary channels (37, 38, 39) which are the "RSSI snippets" you're seeing in nRFConnect.

    The nRFConnect app only checks for a specific bit in the Android stack for whether BLE Coded PHY is supported. Unfortunately, this bit does not require that the device is able to scan for devices advertising over Coded PHY.

    Best regards,

    Simon

Reply
  • Hi

    Please note that you need to set the advdata.flags to BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE in order to use Coded PHY advertising. Also make sure that the scan response data is set to null, as extended advertising (which is used by Coded PHY) does not support scan response data.

    The long range scanner log you're seeing is reminiscent of that in a phone that does not support Coded PHY fully, as it's not able to scan on the secondary advertising channels. (which are the gaps you're seeing). A Coded PHY advertisement will advertise for a small amount of time on the primary channels (37, 38, 39) which are the "RSSI snippets" you're seeing in nRFConnect.

    The nRFConnect app only checks for a specific bit in the Android stack for whether BLE Coded PHY is supported. Unfortunately, this bit does not require that the device is able to scan for devices advertising over Coded PHY.

    Best regards,

    Simon

Children
  • Hi Simonr and thank you for your fast response.

    I changed the code according to your advices, and it's easier to connect now, still sadly, it's very hard to connect onto it. Sometimes it works good, sometimes not. I also tried it on some other phone, and it had same issue (some Qualcomm based phone, probably different SoC that one I have in OnePlus 6T).

    Anyway, my question is, does nRF58420 Dongle can support Long Range through nRF Connect app?

    Thanks 

Related