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

nRF52840 Dongle long range (coded PHY) testing

Hi,

I am interested in testing the capability of Bluetooth 5's long range.

I have two nRF52840 dongles (pca10059 v1.0.0). So far I have had one dongle using nRF Connect v2.5.0 - Bluetooth Low Energy app on Windows 10 to scan and have attempted to program the second dongle with the ble_app_blinky_pca10059_s140 example (from nRF_SDK_15.1.0), slightly modified to advertise using coded PHY (this has not been successful).

I just want to test what rssi values I get at different distances using this long range feature, if anyone can suggest an easy way to do this using the two dongles I have that would be great.

Some other questions I have.

1. Does the nRF Connect - Bluetooth Low Energy app scan for coded PHY advertisements by default if I am using an nRF52840 dongle? Assuming I got one dongle to correctly advertise using coded PHY, would it show up on the Connect - BLE app when scanning with the other dongle?

2. I have been unsuccessful in changing the ble_app_blinky example to advertise using coded PHY. The code snippets below reflect the only changes I have made to the example in my attempts.

    // Set advertising parameters.
    memset(&adv_params, 0, sizeof(adv_params));

    adv_params.primary_phy     = BLE_GAP_PHY_CODED;
    adv_params.secondary_phy   = BLE_GAP_PHY_CODED;
    adv_params.duration        = APP_ADV_DURATION;
    adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED; //from not extended and scannable
    adv_params.p_peer_addr     = NULL;
    adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
    adv_params.interval        = APP_ADV_INTERVAL;

    err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
    APP_ERROR_CHECK(err_code);

/**@brief Struct that contains pointers to the encoded advertising data. */
static ble_gap_adv_data_t m_adv_data =
{
    .adv_data =
    {
        .p_data = m_enc_advdata,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = NULL,
        .len    = 0 //was as abve

    }
};

In this case the green LED that is supposed to turn on when advertising does not turn on. 

I have also tried leaving the code unchanged from when I initially downloaded it and only adding secondary_phy = BLE_GAP_PHY_CODED

    // Set advertising parameters.
    memset(&adv_params, 0, sizeof(adv_params));

    adv_params.primary_phy     = BLE_GAP_PHY_1MBPS;
    adv_params.secondary_phy   = BLE_GAP_PHY_CODED;
    adv_params.duration        = APP_ADV_DURATION;
    adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED; //from not extended and scannable
    adv_params.p_peer_addr     = NULL;
    adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
    adv_params.interval        = APP_ADV_INTERVAL;

    err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
    APP_ERROR_CHECK(err_code);

/**@brief Struct that contains pointers to the encoded advertising data. */
static ble_gap_adv_data_t m_adv_data =
{
    .adv_data =
    {
        .p_data = m_enc_advdata,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX
    },
    .scan_rsp_data =
    {
        .p_data = m_enc_scan_response_data,
        .len    = BLE_GAP_ADV_SET_DATA_SIZE_MAX

    }
};

In this case the dongle is advertising (LED is green and I can see it in scan) but I don't think it is using the long range (coded PHY)

Any help/suggestions is appreciated.

Thanks, Reece

Parents
  • Hello,

    I would recommend that you try to port it to SDK15.2.0. SDK15.1.0 was pulled (not from all download sites, but some). There was some issues. It is fixed in SDK15.2.0. It should be API compatible.

    Just to mention first, the RSSI is not stronger when you use long range. But you can get the RSSI value from e.g. the advertising reports.

    1: No. The nRF Connect for desktop can't scan with CODED_PHY. The reason for this is that it is currently using an old version of the softdevice.

    2: You can't use Coded Phy as the primary phy, but you can use it as the secondary phy. This is why you can't see it when you try to use coded as primary phy. sd_ble_gap_adv_set_configure will not return NRF_SUCCESS with coded phy as primary phy.

    If you have an nRF52840DK, I would suggest that you use this for development. First when you know that the application is running, you can flash it to the dongle. The reason for this is that you can debug with the DK, and not with the dongle. So it is easier to catch errors like this with the DK.

    To see scan using coded phy, you must create a central application that does this.

    Best regards,

    Edvin

Reply
  • Hello,

    I would recommend that you try to port it to SDK15.2.0. SDK15.1.0 was pulled (not from all download sites, but some). There was some issues. It is fixed in SDK15.2.0. It should be API compatible.

    Just to mention first, the RSSI is not stronger when you use long range. But you can get the RSSI value from e.g. the advertising reports.

    1: No. The nRF Connect for desktop can't scan with CODED_PHY. The reason for this is that it is currently using an old version of the softdevice.

    2: You can't use Coded Phy as the primary phy, but you can use it as the secondary phy. This is why you can't see it when you try to use coded as primary phy. sd_ble_gap_adv_set_configure will not return NRF_SUCCESS with coded phy as primary phy.

    If you have an nRF52840DK, I would suggest that you use this for development. First when you know that the application is running, you can flash it to the dongle. The reason for this is that you can debug with the DK, and not with the dongle. So it is easier to catch errors like this with the DK.

    To see scan using coded phy, you must create a central application that does this.

    Best regards,

    Edvin

Children
  • Hi, 

    Thanks for this information it has been very helpful.

    Reece

  • Hello,

    I want also test the long range feature with my dongle but can it be possible ? Indeed, the dongle hardware seems to have been designed for short range, no ?

    Regards,

    Aurélien

  • "2: You can't use Coded Phy as the primary phy, but you can use it as the secondary phy. This is why you can't see it when you try to use coded as primary phy. sd_ble_gap_adv_set_configure will not return NRF_SUCCESS with coded phy as primary phy."

    Is this still relevant for the SDK 15.3.0 ? 

    I am using the nRF52840DK with SDK15.3.0, and I'd like to perform a range test.
    I have coded phy advertising from the unit, but I can't connect. I am trying to connect using nRF Connect on a OnePlus6 mobile phone (which supports coded phy, and I set on the phone to prefer coded phy). 

    I run when test when primary phy is coded.

    Do I need to set the peripheral's primary phy to be coded, or not?

  • Hi ,

    Can you guide me on how to advertise coded phy using the nRF52840PDK with SDK15.3.0?

    I only modified the code ble_app_template in the ble_advertising_init function in ble_advertising.c as well as set the primary phy to BLE_GAP_PHY_1MBPS, and the secondary phy was set to BLE_GAP_PHY_CODED.

    Code in ble_advertising.c:

     

     // Configure a initial advertising configuration. The advertising data and and advertising
        // parameters will be changed later when we call @ref ble_advertising_start, but must be set
        // to legal values here to define an advertising handle.
           
        p_advertising->adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED; // change this only
        p_advertising->adv_params.duration        = p_init->config.ble_adv_fast_timeout;
        p_advertising->adv_params.p_peer_addr     = NULL;
        p_advertising->adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
        p_advertising->adv_params.interval        = p_init->config.ble_adv_fast_interval;
        p_advertising->adv_params.primary_phy     = p_init->config.ble_adv_primary_phy;
        p_advertising->adv_params.secondary_phy   = p_init->config.ble_adv_secondary_phy;
        p_advertising->adv_params.scan_req_notification =1;/*just added*/

    Code in main.c:

    static void advertising_init(void)
    {
        ret_code_t             err_code;
        ble_advertising_init_t init;
    
        //clear init memory 
        memset(&init, 0, sizeof(init));
    
        init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
        init.advdata.include_appearance      = false;//true
        init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
        init.advdata.uuids_complete.p_uuids  = m_adv_uuids;
    
        init.config.ble_adv_fast_enabled  = true;
        init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
        init.config.ble_adv_fast_timeout  = 0; //Setting duration to 0 means no timeout. 
    
        init.config.ble_adv_extended_enabled = true;
        init.config.ble_adv_primary_phy      = BLE_GAP_PHY_1MBPS;
        init.config.ble_adv_secondary_phy    = BLE_GAP_PHY_CODED;
           
        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);
    }
    

    However, 

    I compile the code ,I have no warning or errors. The debug terminal showed as below:

    <info> app: Template example started.
    <info> app: Fast advertising.

    I only get 1 advertise packet only where my ble_adv_fast_timeout = 0. The led 1 is blinking.

    Can you guide me as I just want to try on the coded phy advertising. 

    Thank you.

    Regards,

    Kathleen

Related