How to enable BLE 2MBPS

Hello,

I'm trying to enable 2MBPS using 2 nRF52840-DK. I'm using SDK17 examples with Segger Embedded Studio. The peripheral uses the ble_app_uart example. The central uses ble_app_uart_c example.

I was able to make them work as default at 1MBPS, but I have problems making them work at 2MBPS. I saw a similar issue at another post but that didn't help me to resolve my issue.

I did the following changes on the central 2MBPS, in ble_evt_handler:

case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
{
    printf("PHY update request.");
    ble_gap_phys_t const phys =
    {
        .rx_phys = BLE_GAP_PHY_2MBPS,
        .tx_phys = BLE_GAP_PHY_2MBPS,
    };
    err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);
    APP_ERROR_CHECK(err_code);
} break;

In the peripheral, I made these changes:

static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    uint32_t err_code;

    ble_gap_phys_t m_test_params;
    m_test_params.tx_phys = BLE_GAP_PHY_2MBPS;
    m_test_params.rx_phys = BLE_GAP_PHY_2MBPS;

    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            printf("Connected\r\n");
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
            err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
            APP_ERROR_CHECK(err_code);
            // Add these lines for 2MBPS
            err_code = sd_ble_gap_phy_update(m_conn_handle, &m_test_params);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GAP_EVT_PHY_UPDATE:
            printf("BLE_GAP_EVT_PHY_UPDATE\r\n");
           break;

..........

}

After the changes, they still operate at 1MBPS. Even though I see the printout BLE_GAP_EVT_PHY_UPDATE on the peripheral, as well a message .'PHY update request' on the central device, showing they are supposed to update the PHY to 2MBPS.

I wonder what else needs to be done. I appreciate any help to resolve the issue.

Related