Way to get the current physical link speed?

Hi. I am developing based on the multi-link central example. In the below code the PHY is set to BLE_GAP_PHY_AUTO.

I don't know if my example therefore is running at 1Mbps or 2Mbps? Is there a way to call a function to find out?

Also why is this set to auto in the example rather than 2Mbps (which would get the best throughput)?


            NRF_LOG_DEBUG("PHY update request.");
            ble_gap_phys_t const phys =
                .rx_phys = BLE_GAP_PHY_AUTO,
                .tx_phys = BLE_GAP_PHY_AUTO,
            err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
        } break;

  • Hi Philip

    You should get the BLE_GAP_EVT_PHY_UPDATE event when the phy changes, and you can use this event to figure out which phy you are currently on. 

    Below I included a small sample which simply outputs the phy to the log when it is updated:

    ble_gap_evt_phy_update_t phy_update = p_ble_evt->evt.gap_evt.params.phy_update;
    if(phy_update.status == BLE_HCI_STATUS_CODE_SUCCESS)
    NRF_LOG_INFO("PHY updated: %i, %i", phy_update.tx_phy, phy_update.rx_phy);
    app_aggregator_phy_update(p_ble_evt->evt.gap_evt.conn_handle, phy_update.tx_phy, phy_update.rx_phy);
    } break;

    Setting the phy to AUTO on the central side allows the peripheral to set the phy freely based on its own requirements. If the peripheral cares more about range than throughput then 1Mbps might be a better choice. 

    Best regards

Reply Children
No Data