I am having trouble changing the 'ble_app_multiperipheral_pca1056_s140' example to work with long range. I have read a few of the blog posts and similar devzone posts but I can't seem to find an answer that works.
Here is my code for configuring the gap advertising set:
// only extended advertising will allow primary phy to be coded
NRF_LOG_INFO("Advertising type set to EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED ");
//adv_params.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
// Start advertising.
memset(&adv_params, 0, sizeof(adv_params));
adv_params.p_peer_addr = NULL;
adv_params.filter_policy = BLE_GAP_ADV_FP_ANY;
adv_params.interval = APP_ADV_INTERVAL;
adv_params.duration = 0;//APP_ADV_DURATION;
NRF_LOG_INFO("Setting adv params phy to coded phy .. ");
adv_params.primary_phy = BLE_GAP_PHY_CODED;
//adv_params.secondary_phy = BLE_GAP_PHY_CODED;
err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
The error I get is :
<info> app: Setting adv params phy to coded phy .. <error> app: ERROR 7 [NRF_ERROR_INVALID_PARAM] at :0 PC at: 0x00000000 <error> app: End of error report
Any help where I am going wrong or anything that I have missed would really be appreciated.
Hi Michael, for extended advertising to work, it must use the secondary phy.
When using extended advertising, the primary phy is only used to "point" over to the secondary phy, where the much longer data can exist.
So you probably don't want to comment out the secondary phy. :)
Thanks for the input. I have tried it with and without priory to submitting the ticket and it didn't make any difference (the error 7 was still reported).
Do you know what the 'adv_params.duration' should be set too? (I have tried both 0 and APP_ADV_DURATION) ??
Do I need to add the line (i'm not sure what the srdata is used for) -
err_code = ble_advdata_encode(&srdata, m_adv_data.scan_rsp_data.p_data, &m_adv_data.scan_rsp_data.len); ??
I can't seem to find a large amount of information on the setting requirements for long range so I'm shooting in the dark
Any help appreciated