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

Enabling long rage in nRF52840

Hello,

 

I am using nRF52840, SDK_16.0.0, S140 SoftDevice and Segger 4.16 for flashing the image. I am using ‘ble_app_blinky’.

 

As per below mail I changed settings for long range.

https://devzone.nordicsemi.com/f/nordic-q-a/40365/how-to-use-ble_gap_phy_coded-in-ble_app_beacon-example/157628#157628

https://devzone.nordicsemi.com/f/nordic-q-a/36364/enable-coded-phy-long-range-for-peripheral-blinky-code

 

    //adv_params.primary_phy   = BLE_GAP_PHY_1MBPS; // 1Mbps PHY layer

    adv_params.primary_phy     = BLE_GAP_PHY_CODED; //  For long range

    adv_params.secondary_phy   = BLE_GAP_PHY_CODED;

 

Even I have gone through ble_app_att_mtu_throughput. It says below changes to be done in advertising_data_set() for long range.

.primary_phy = BLE_GAP_PHY_1MBPS, // Must be changed to connect in long range. (BLE_GAP_PHY_CODED)
.secondary_phy = BLE_GAP_PHY_1MBPS,

But still I am getting fatal error as 7 at sd_ble_gap_adv_set_configure() within advertising_init()

 

My queries are:

1) Any settings to be enabled further on top of ble_app_blinky.

2) I need only long range but not Extended Advertisement. So I used BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED. Will this cause any issue.

3) As per uart example code below, do I need to comment case BLE_GAP_EVT_PHY_UPDATE_REQUEST under ble_evt_handler() ?

              https://github.com/NordicPlayground/nRF52-ble-long-range-demo

 

4) As per standards there are two LE Codes (S=2 with 500 Kb/s and the other one is S=8 with 125 Kb/s). Whether both are supported, if so how to set the same in nRF52840. For long range we want S=8. How to set this ?

5) If BLE_GAP_PHY_CODED is enabled, whether can I connect with my Mobile which is not BLE 5.0 compatible.

 

Below is my code snapshot.

 

static void advertising_init(void)
{
    ret_code_t    err_code;
    ble_advdata_t advdata;  // Advertisement Data
    ble_advdata_t srdata;   // Scan Response Data
    ble_advdata_manuf_data_t manufData;
    
    // Build and set Advertising data.
    memset(&advdata, 0, sizeof(advdata));
    advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance = false; // GAP apperance 0x19
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    
    // Build and set Scan response data.
    memset(&srdata, 0, sizeof(srdata));
    srdata.name_type          = BLE_ADVDATA_FULL_NAME; // BLE_ADVDATA_NO_NAME;
    srdata.include_appearance = false; // GAP apperance 0x19
    
    manufData.company_identifier = 0xFFFF;
    manufData.data.p_data        = &u8TadUID[0];
    manufData.data.size          = sizeof(u8TadUID);
    
    srdata.p_manuf_specific_data  = &manufData;
    advdata.p_manuf_specific_data = &manufData;
    
    err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
    APP_ERROR_CHECK(err_code);
    
    err_code = ble_advdata_encode(&srdata, m_adv_data.scan_rsp_data.p_data, &m_adv_data.scan_rsp_data.len);
    APP_ERROR_CHECK(err_code);
    
    ble_gap_adv_params_t adv_params;
    
    // Set advertising parameters.
    memset(&adv_params, 0, sizeof(adv_params));
    
    #if 0
    adv_params.primary_phy   = BLE_GAP_PHY_1MBPS; // 1Mbps PHY layer
    #else
    adv_params.primary_phy     = BLE_GAP_PHY_CODED; // For long range
    adv_params.secondary_phy   = BLE_GAP_PHY_CODED;
    #endif
    
    adv_params.duration        = APP_ADV_DURATION;
    adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
    //adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
    adv_params.p_peer_addr     = NULL;
    adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY; // Filter policy as part of 'White list'
    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);
}

Thanks & Regards

Vishnu Beema

Parents
  • Hi Vishnu

    1. The flag seems to be set correctly.

    2. I'm sorry, BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED should be the correct advertising type for Coded PHY.

    3. Please check out this case, where a lot of common mistakes when setting up a long-range project are clarified by my colleague Håvard.

    4. I'm sorry, but our SoftDevices does not support S=2 yet, so there is no way to enable this.

    Best regards,

    Simon

Reply
  • Hi Vishnu

    1. The flag seems to be set correctly.

    2. I'm sorry, BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED should be the correct advertising type for Coded PHY.

    3. Please check out this case, where a lot of common mistakes when setting up a long-range project are clarified by my colleague Håvard.

    4. I'm sorry, but our SoftDevices does not support S=2 yet, so there is no way to enable this.

    Best regards,

    Simon

Children
No Data
Related