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

Why can't I use CODED PHY in ipsp example?

Hi Now I am developing the application to measure PER of each data rate of BLE.

For packet exchange, I use IPSP example in the latest nRF5 SDK version 15, s140.

I could change data rate to 2Mbps and 1Mbps, but I could not change to coded phy.

I add some part of ipsp accetor's code below

For Coded phy, in line 19,20, I use BLE_GAP_PHY_CODED only.

Thank you, 

Elissa Park

static void on_ble_evt(ble_evt_t const * p_ble_evt)
{
    uint32_t err_code;
    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            printf("BLE_GAP_EVT_CONNECTED\n");
            APPL_LOG("Connected.");

            LEDS_ON(CONNECTED_LED);
            LEDS_OFF(ADVERTISING_LED);
            
            if(p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_PERIPH)
            {
                printf("change phy as a periph\n");
  
                ble_gap_phys_t const phys =
                {
                    .rx_phys = BLE_GAP_PHY_2MBPS | BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_CODED,
                    .tx_phys = BLE_GAP_PHY_2MBPS | BLE_GAP_PHY_1MBPS | BLE_GAP_PHY_CODED,
                };
                err_code = sd_ble_gap_phy_update(p_ble_evt->evt.gap_evt.conn_handle, &phys);

            }
            else 
            {
                printf("change phy as a central\n");
                

                err_code = sd_ble_gap_phy_update(m_conn_handle, &m_test_params.phys);
                APP_ERROR_CHECK(err_code);
            }
              
            break;
        case BLE_GAP_EVT_DISCONNECTED:
            printf("BLE_GAP_EVT_DISCONNECTED\n");
            APPL_LOG("Disconnected.");

            LEDS_OFF(CONNECTED_LED);

            advertising_start();
            break;
        case BLE_GAP_EVT_PHY_UPDATE:
        {
            printf("BLE_GAP_EVT_PHY_UPDATE\n");
            ble_gap_evt_phy_update_t const * p_phy_evt = &p_ble_evt->evt.gap_evt.params.phy_update;

            if (p_phy_evt->status == BLE_HCI_STATUS_CODE_LMP_ERROR_TRANSACTION_COLLISION)
            {
                // Ignore LL collisions.
                NRF_LOG_DEBUG("LL transaction collision during PHY update.");
                break;
            }

            ble_gap_phys_t phys = {0}; 
            phys.tx_phys = p_phy_evt->tx_phy;
            phys.rx_phys = p_phy_evt->rx_phy;
            printf("PHY update %s. PHY set to %s.\n",
                         (p_phy_evt->status == BLE_HCI_STATUS_CODE_SUCCESS) ?
                         "accepted" : "rejected",
                         phy_str(phys));
        } break;

        case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
        {
            printf("BLE_GAP_EVT_PHY_UPDATE_REQUEST\n");
             m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
            //err_code = sd_ble_gap_phy_update(m_conn_handle, &m_test_params.phys);
            //APP_ERROR_CHECK(err_code);
        } break;

        default:
            break;
    }
}

Parents Reply Children
No Data
Related