Long range data transfer from central to peripheral

Hi,

 In my application i am trying out to transfer data in Long range BLE_GAP_PHY_CODED mode , i have set my peripheral has to advertise in PHY coded mode below is the advertising init function which changed to phy coded. i am using ble_app_blinky_c  for central and ble_app_blinky  example in peripheral

static void advertising_init_phycoded(uint16_t adv_timeout)
{
ret_code_t err_code;
ble_advdata_t advdata;
ble_advdata_t srdata;
ble_advdata_manuf_data_t manuf_specific_data;

manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
manuf_specific_data.data.p_data = (uint8_t *) NORMAL_BEACON;
manuf_specific_data.data.size = APP_BEACON_INFO_LENGTH;

// ble_uuid_t adv_uuids[] = {{LBS_UUID_SERVICE, m_lbs.uuid_type}};

// Build and set advertising data.
memset(&advdata, 0, sizeof(advdata));

// advdata.name_type = BLE_ADVDATA_NO_NAME;
advdata.include_appearance = false;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
advdata.p_manuf_specific_data = &manuf_specific_data;
memset(&srdata, 0, sizeof(srdata));
// srdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
// srdata.uuids_complete.p_uuids = adv_uuids;

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));

adv_params.primary_phy = BLE_GAP_PHY_CODED;
adv_params.secondary_phy = BLE_GAP_PHY_CODED;
adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
// }
// else{
// adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_SCANNABLE_UNDIRECTED;
// }
adv_params.p_peer_addr = NULL;
adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
adv_params.scan_req_notification = 1;
if(battery_level == 0 || battery_level >= BATTERY_VOLTAGE_MIN_FOR_DISPLAY){
adv_params.interval = COASTER_ADV_INTERVAL;
}
else{
adv_params.interval = LOW_LEVEL_BATTERY_INTERVAL;
}
adv_params.duration = adv_timeout; // Never time out.

err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
APP_ERROR_CHECK(err_code);
sd_ble_gap_adv_set_configure(&m_adv_handle,&m_adv_data,&adv_params);
NRF_LOG_INFO("m_adv_data.adv_data.p_data address %p", m_adv_data.adv_data.p_data);
}

same as my central is in scannng the beacon which is in phy coded and gets connected also but no data transfrer happens after MTU request gets disconnecting from the peripheral .

#define SCAN_INTERVAL (2*0x00A0) /**< Determines scan interval in units of 0.625 millisecond. */
#define SCAN_WINDOW 0x00A0 /**< Determines scan window in units of 0.625 millisecond. */
#define SCAN_DURATION 0x0000


static ble_gap_scan_params_t m_scan_param = /**< Scan parameters requested for scanning and connection. */
{
.active = 0x01,
.interval = SCAN_INTERVAL,
.window = SCAN_WINDOW,
.filter_policy = BLE_GAP_SCAN_FP_ACCEPT_ALL,
.timeout = SCAN_DURATION,
.scan_phys = BLE_GAP_PHY_1MBPS|BLE_GAP_PHY_CODED,
.extended = 1,
};

please advise what i have missed here for PHY coded data transfer .

Thanks in advance.

best regards.

  • Hi 

    My colleague Vidar shared an example showing how to use the ble_app_uart and ble_app_uart_c examples in long range mode, and he shared the code in this case.

    I would recommend you start by taking a look at his examples. 

    Then if you're still having issues I will do my best to help next week. 

    Best regards
    Torbjørn 

  • Hi ,

    I have tried ble_app_uart and ble_app_uart_c examples in long range data gets transfer from central to peripheral . same way tried ble_app_blinky and ble_app_blinky_c  example with lbs services in long range gets succesfully connected but stil no data transfer happens.in first query is my PHY_CODED chnages in ble_app_blinky example.

    Would you please help provide more details as suggested.

  • Hi 

    Any reason you can't just use the UART example instead of blinky?

    The only difference between the UART service and the LED button service is that the UART services uses variable length characteristics (to send strings), while the LED button service uses 1 byte characteristics (to send the LED and button status). 

    As for debugging the issue, have you tried to check the log output to see if there is anything there that could explain the issue?

    Are you sure that the code for sending data is actually run?

    Have you used the debugger to check whether or not the function for sending data runs, and if it returns any errors?

    Best regards
    Torbjørn

  • Hi ,

    thanks for the reply , my application  already added with LBS services to scan Both 1Mpbs and PHY CODED beaccons and now trying the same in connected mode to transfer data in LONG RANGE AND 1mpbs here 1mpbs connected and data transfer working. so adding the same for PHY CODED. I am using the softdevice s140_nrf52_6.1.0_softdevice in my application. 

    i have debugged the demo long range code https://devzone.nordicsemi.com/f/nordic-q-a/40476/unable-to-convert-to-long-range-after-looking-at-umpteen-examples--/157300#157300      here softdevice s140_nrf52_6.1.1_softdevice.hex 

    is this supported only on 6.1.1 softdevice ?

  • i have checked the demo code with  s140_nrf52_6.1.0_softdevice  its working.

    same way checking on LBS service on central side ble_lbs_led_status_send  is getting succes while connecting to send the message.

    but on Periperal side connecting and disconnection happens.

    ret_code_t err_code;
    ble_advdata_t advdata;
    ble_advdata_t srdata;
    ble_advdata_manuf_data_t manuf_specific_data;

    manuf_specific_data.company_identifier = APP_COMPANY_IDENTIFIER;
    manuf_specific_data.data.p_data = (uint8_t *) NORMAL_BEACON;
    manuf_specific_data.data.size = APP_BEACON_INFO_LENGTH;

    // ble_uuid_t adv_uuids[] = {{LBS_UUID_SERVICE, m_lbs.uuid_type}};

    // Build and set advertising data.
    memset(&advdata, 0, sizeof(advdata));

    // advdata.name_type = BLE_ADVDATA_NO_NAME;
    advdata.include_appearance = false;
    advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    advdata.p_manuf_specific_data = &manuf_specific_data;
    memset(&srdata, 0, sizeof(srdata));
    // srdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
    // srdata.uuids_complete.p_uuids = adv_uuids;

    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));

    printf("phy coded startes------\n");

    adv_params.primary_phy = BLE_GAP_PHY_CODED;
    adv_params.secondary_phy = BLE_GAP_PHY_CODED;
    adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
    // }
    // else{
    // adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_SCANNABLE_UNDIRECTED;
    // }
    adv_params.p_peer_addr = NULL;
    adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
    adv_params.scan_req_notification = 1;
    if(battery_level == 0 || battery_level >= BATTERY_VOLTAGE_MIN_FOR_DISPLAY){
    adv_params.interval = ADV_INTERVAL;
    }
    else{
    adv_params.interval = LOW_LEVEL_BATTERY_INTERVAL;
    }
    adv_params.duration = adv_timeout; // Never time out.

    err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
    APP_ERROR_CHECK(err_code);
    sd_ble_gap_adv_set_configure(&m_adv_handle,&m_adv_data,&adv_params);
    NRF_LOG_INFO("m_adv_data.adv_data.p_data address %p", m_adv_data.adv_data.p_data);

Related