Hello,
I am using the ble_advertising module in sdk 17.0.2 on an nRF52840 with softdevice 140. I have the application working but want to convert to using coded PHY. After reading over this post (https://devzone.nordicsemi.com/f/nordic-q-a/40476/unable-to-convert-to-long-range-after-looking-at-umpteen-examples--) it seemed that the only changes I would have to make would be in my advertising_init function. Originally it was:
static void advertising_init(void)
{
uint32_t err_code;
ble_advertising_init_t init;
memset(&init, 0, sizeof(init));
init.advdata.name_type = BLE_ADVDATA_FULL_NAME;
init.advdata.include_appearance = false;
init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
init.srdata.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 = APP_ADV_DURATION;
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);
}
And I added these lines at the end to change to coded PHY so that the function is now:
static void advertising_init(void)
{
uint32_t err_code;
ble_advertising_init_t init;
memset(&init, 0, sizeof(init));
init.advdata.name_type = BLE_ADVDATA_FULL_NAME;
init.advdata.include_appearance = false;
init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
init.srdata.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 = APP_ADV_DURATION;
init.evt_handler = on_adv_evt;
//added to set phy to coded
init.config.ble_adv_primary_phy = BLE_GAP_PHY_CODED; // use Coded PHY
init.config.ble_adv_secondary_phy = BLE_GAP_PHY_CODED;
init.config.ble_adv_extended_enabled = true; // Coded PHY needs extended adv (bigger adv packet size)
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);
}
I don't get any errors compiling but I can't detect any advertising devices on the nRF Toolbox app on my phone so I'm not sure what's going wrong. Are there other changes I need to make to implement the coded PHY, or have I implemented these changes incorrectly?
Also are there any changes to the config file that I need to make?
Thanks for the help,
Jake