Long range data transfer from central to peripheral


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

err_code = ble_advdata_encode(&srdata, m_adv_data.scan_rsp_data.p_data, &m_adv_data.scan_rsp_data.len);

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;
// }
// else{
// }
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;
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);
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,
.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

  • 0
    0 pts.
    in reply to ovrebekk

    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.

  • 0
    12543 pts.
    in reply to sowmiya


    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