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

  • Thanks Vidar, I am planning to use NRF52840 for scanning, do I need to configure for BLE_GAP_PHY_CODED for scanning also?

  • Yes,  "active" scanning must be enabled, and "scan_phys" must be set to BLE_GAP_PHY_CODED:

    /**< Scan parameters requested for scanning and connection. */
    static ble_gap_scan_params_t const m_scan_param =
    {
        .active        = 0x01,
        .interval      = NRF_BLE_SCAN_SCAN_INTERVAL,
        .window        = NRF_BLE_SCAN_SCAN_WINDOW,
        .filter_policy = BLE_GAP_SCAN_FP_WHITELIST,
        .timeout       = SCAN_DURATION_WITELIST,
        .scan_phys     = BLE_GAP_PHY_CODED,
    };

  • I am trying to use '.scan_phys     = BLE_GAP_PHY_CODED' in SDK15.2.0 \Example\ble_central\ble_app_uart_c. But I am not able to find 'm_scan_param'. Any idea how to update .scan_phys     = BLE_GAP_PHY_CODED in SDK15.2? 

Reply Children
Related