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

Toggle 1Mbit PHY and CodedPHY

Hi.

I want to advertise switching 1Mbit PHY and CodedPHY every 5 seconds.

I designed it like this based on nrf52 ble app uart long range example.

advertising_start(coded)-->5s-->BLE_GAP_TIMEOUT_SRC_ADVERTISING{advertising_start(1MbpsPHY)}-->5s
-->BLE_GAP_TIMEOUT_SRC_ADVERTISING{advertising_start(coded)}-->....

 

The code is as follows.

#define APP_ADV_TIMEOUT_IN_SECONDS  5


void advertising_start(void)
{
    static ble_gap_adv_params_t adv_params = {0};

    adv_params.properties.connectable = 1;
    // Setting up the scan response packet is currently not supported when using CODED phy
    adv_params.properties.scannable = 0;
    adv_params.properties.legacy_pdu = 0;
    adv_params.p_peer_addr   = NULL;
    adv_params.fp            = BLE_GAP_ADV_FP_ANY;
    adv_params.interval      = APP_ADV_INTERVAL;
    adv_params.duration      = APP_ADV_TIMEOUT_IN_SECONDS * 100;
    if(adv_coded){
        adv_params.primary_phy   = BLE_GAP_PHY_1MBPS;
        adv_params.secondary_phy = BLE_GAP_PHY_1MBPS;
        adv_coded = false;
    }
    else{
        adv_params.primary_phy   = BLE_GAP_PHY_CODED;
        adv_params.secondary_phy = BLE_GAP_PHY_CODED;
        adv_coded = true;
    }

    sd_ble_gap_adv_start(BLE_GAP_ADV_SET_HANDLE_DEFAULT, &adv_params, APP_BLE_CONN_CFG_TAG);
}

However, in my Xperia it was not displayed at 1Mbps PHY.
Is there anything else I need to change?

thanks

Parents
  • Hi saka4849,

    You say it does not display 1MBPS phy, and that CODED phy works. are you sure it was not the other way around? 1MBPS phy should definetly work. CODED may not be supported, depending on you phone. Also, I think the current android version will always use 1MBPS are primary phy, so it may fail to see your CODED advertising

    Is your Xperia new? Are you sure it supports BLE5?

Reply
  • Hi saka4849,

    You say it does not display 1MBPS phy, and that CODED phy works. are you sure it was not the other way around? 1MBPS phy should definetly work. CODED may not be supported, depending on you phone. Also, I think the current android version will always use 1MBPS are primary phy, so it may fail to see your CODED advertising

    Is your Xperia new? Are you sure it supports BLE5?

Children
Related