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

How to change tx power in nfr52840 throughput test

Hello, I'm using SDK 15.3.0 throughput test and I want to change TX power to +8dBm. In documents it says change the power from sd_ble_gap_tx_power_set but I couldn't find where this function is. Can you please help me to find where can I change the tx power in firmware?

Parents
  • You can refer to the example.

    https://github.com/jimmywong2003/nrf5-packet-error-rate-measurement-on-ble-connection/blob/master/ble_app_image_transfer/main.c

    static void ble_evt_handler(ble_evt_t const *p_ble_evt, void *p_context)
    {
            ret_code_t err_code;
    
            switch (p_ble_evt->header.evt_id)
            {
            case BLE_GAP_EVT_CONNECTED:
    
                    NRF_LOG_INFO("Connected");
                    bsp_board_led_on(CONNECTED_LED);
                    bsp_board_led_off(ADVERTISING_LED);
    
                    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);
                    err_code = app_button_enable();
                    APP_ERROR_CHECK(err_code);
                    NRF_LOG_INFO("Actual connection parameter %d", p_ble_evt->evt.gap_evt.params.connected.conn_params.max_conn_interval);
    
                    tx_power_set();

    /**@brief Function for changing the tx power.
     */
    static void tx_power_set(void)
    {
    
            // ret_code_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, TX_POWER_LEVEL);
            ret_code_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, m_application_state.tx_power * 4);
            APP_ERROR_CHECK(err_code);
    }

Reply
  • You can refer to the example.

    https://github.com/jimmywong2003/nrf5-packet-error-rate-measurement-on-ble-connection/blob/master/ble_app_image_transfer/main.c

    static void ble_evt_handler(ble_evt_t const *p_ble_evt, void *p_context)
    {
            ret_code_t err_code;
    
            switch (p_ble_evt->header.evt_id)
            {
            case BLE_GAP_EVT_CONNECTED:
    
                    NRF_LOG_INFO("Connected");
                    bsp_board_led_on(CONNECTED_LED);
                    bsp_board_led_off(ADVERTISING_LED);
    
                    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);
                    err_code = app_button_enable();
                    APP_ERROR_CHECK(err_code);
                    NRF_LOG_INFO("Actual connection parameter %d", p_ble_evt->evt.gap_evt.params.connected.conn_params.max_conn_interval);
    
                    tx_power_set();

    /**@brief Function for changing the tx power.
     */
    static void tx_power_set(void)
    {
    
            // ret_code_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, TX_POWER_LEVEL);
            ret_code_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, m_application_state.tx_power * 4);
            APP_ERROR_CHECK(err_code);
    }

Children
Related