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

Nordic52840 --- How to fixed PHY rate at 500 and 125 Kbps.

Hello everyone

I am a beginner in BLE.

I am working on nRF5_SDK_14.1.0-Nordic with nRF52840-PDK.

#define BLE_GAP_PHY_1MBPS 0x01 /**< 1 Mbps PHY. */
#define BLE_GAP_PHY_2MBPS 0x02 /**< 2 Mbps PHY. */
#define BLE_GAP_PHY_CODED 0x04 /**< Coded PHY. */

Is CODED support 500/125Kbps ?  Is auto change PHY rate betwen  500kbps and 125kbps ?

How to fixed PHY rate at 500 and 125 Kbps ?

Thaks

 Louis

Parents
  • Hi Louis.

    In SDK 14.1 which uses SoftDevice 5.0.0-2.alpha, you can only receive and transmit at 125 kbps.

    I recommend that you use SDK 15.2, as this is our newest SDK with most features and fewest bugs.

    In SDK 15.2, you can use the latest release of the SoftDevice (version 6.1.0), which lets you either receive at 500 kbps, and transmit and receive at 125 kbps.

    You can read more about this in the BLE 5.0 specification, at page 2565.

    So, to sum up:

    In SDK 14.1 with SoftDevice 5.0.0-2.alpha:

    BLE_GAP_PHY_CODED is receive and transmit at 125 kbps

    In SDK 15.2 with SoftDevice 6.1.0:

    BLE_GAP_PHY_CODED is receive and transmit at 125 kbps, and receive at 500 kbps

    - Andreas

     

  • Hi  Andreas  

    Thanks your quick response.

    In SDK 15.2 with SoftDevice 6.1.0:  BLE_GAP_PHY_CODED 

    is receive and transmit at 125 kbps.

    is only receive at 500 kbps ?

    Is able to set fixed rate at 125 or 500 kbps ?

    Best regards

    Louis

  • Hi Louis.

    SoftDevice 6.1.0 is able to receive at 125 kbps and 500 kbps. But it can only transmit at 125 kbps.

    These rates are fixed, you only have to set your scanning or advertising phys to BLE_GAP_PHY_CODED,

    Like this in nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\ble_app_blinky\main.c :

    Line 256:
    adv_params.primary_phy     = BLE_GAP_PHY_1MBPS;
    
    Change this line to:
    
    adv_params.primary_phy     = BLE_GAP_PHY_CODED;

    For scanning, you should for example in nRF5_SDK_15.2.0_9412b96\examples\ble_central\ble_app_gatts\, edit scan_phys in m_scan_param in main.c

    FROM THIS:
    
    /**< 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_1MBPS,
    };
    
    TO THIS:
    
    /**< 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,
    };

    - Andreas

  • Hi  Andreas

    Deeply appreciated.

    Very clear.

    nRF5_SDK_14.1.0\examples\ble_central\ble_app_blink_c\main.c

    Does not has ".scan_phys" to set BLE_GAP_PHY_CODED ? Am I right ?

     static ble_gap_scan_params_t const m_scan_params =
    {
    .active = 0x1,
    .interval = SCAN_INTERVAL,
    .window = SCAN_WINDOW,
    .timeout = SCAN_TIMEOUT,
    #if (NRF_SD_BLE_API_VERSION <= 2)
    .selective = 0,
    .p_whitelist = NULL,
    #endif
    #if (NRF_SD_BLE_API_VERSION >= 3)
    .use_whitelist = 0,
    #endif
    };

    Best regards

    Louis

  • Hi.

    In SDK 14.1 in nRF5_SDK_14.1.0\examples\ble_central\ble_app_blinky_c\main.c, this is defined on line 386 and 387.

    ble_gap_phys_t const phys =
    {
        .rx_phys = BLE_GAP_PHY_AUTO,
        .tx_phys = BLE_GAP_PHY_AUTO,
    };

    Change this to this:

    ble_gap_phys_t const phys =
    {
        .rx_phys = BLE_GAP_PHY_CODED,
        .tx_phys = BLE_GAP_PHY_CODED,
    };

    - Andreas

Reply Children
No Data
Related