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

How to use BLE_GAP_PHY_CODED in ble_app_beacon Example

Dear Team,

I am using NRF52840 for ble_app_beacon and working fine. Now I want to extend the range using 'PHY_CODED' option. Please let me know in this 'ble_app_beacon' example code where I have to update.

Regards

Ashiq Mohammed.

Parents
  • Hi Ashiq,

    The following changes should be sufficient to advertise with CODED PHY:

    diff --git a/examples/ble_peripheral/ble_app_beacon/main.c b/examples/ble_peripheral/ble_app_beacon/main.c
    index abe39e1..9e3d484 100644
    --- a/examples/ble_peripheral/ble_app_beacon/main.c
    +++ b/examples/ble_peripheral/ble_app_beacon/main.c
    @@ -187,11 +187,13 @@ static void advertising_init(void)
         // Initialize advertising parameters (used when starting advertising).
         memset(&m_adv_params, 0, sizeof(m_adv_params));
     
    -    m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
    +    m_adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
         m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
         m_adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
         m_adv_params.interval        = NON_CONNECTABLE_ADV_INTERVAL;
         m_adv_params.duration        = 0;       // Never time out.
    +    m_adv_params.primary_phy     = BLE_GAP_PHY_CODED;
    +    m_adv_params.secondary_phy   = BLE_GAP_PHY_CODED;
     
         err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
         APP_ERROR_CHECK(err_code);

    Note: as far I know, there are no cell phones that have support for coded phy so you need a custom central/BT5 sniffer to receive the packets.

    Regards,

    Vidar

Reply
  • Hi Ashiq,

    The following changes should be sufficient to advertise with CODED PHY:

    diff --git a/examples/ble_peripheral/ble_app_beacon/main.c b/examples/ble_peripheral/ble_app_beacon/main.c
    index abe39e1..9e3d484 100644
    --- a/examples/ble_peripheral/ble_app_beacon/main.c
    +++ b/examples/ble_peripheral/ble_app_beacon/main.c
    @@ -187,11 +187,13 @@ static void advertising_init(void)
         // Initialize advertising parameters (used when starting advertising).
         memset(&m_adv_params, 0, sizeof(m_adv_params));
     
    -    m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
    +    m_adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
         m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
         m_adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
         m_adv_params.interval        = NON_CONNECTABLE_ADV_INTERVAL;
         m_adv_params.duration        = 0;       // Never time out.
    +    m_adv_params.primary_phy     = BLE_GAP_PHY_CODED;
    +    m_adv_params.secondary_phy   = BLE_GAP_PHY_CODED;
     
         err_code = ble_advdata_encode(&advdata, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
         APP_ERROR_CHECK(err_code);

    Note: as far I know, there are no cell phones that have support for coded phy so you need a custom central/BT5 sniffer to receive the packets.

    Regards,

    Vidar

Children
Related