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

Proper place and exact change to increase the tx power in ble_app_att_mtu_throughput example(nRF5_SDK_15.0.0)

Hardware used: 2 nRF52480 DK boards 

I am running nRF5_SDK_15.0.0_a53641a\examples\ble_central_and_peripheral\experimental\ble_app_att_mtu_throughput example, I want to increase the tx power of the both sender and receiver boards.

I am adding the below change to increase the tx power of the nRF52840 boards to run the att_mtu example. But tx power value is not changing.

I checked the tx power value by keeping the debug breakpoint in the adv_data.c file(ble_advdata_encode()). Please help me regarding the changes need to be added, so that i can increase tx power and test the att_mtu example by keeping the 2 boards in long range.

ble_advdata_encode(): // Here everytime it is showing tx power level to zero.

// Encode TX power level.
if (p_advdata->p_tx_power_level != NULL)
{
err_code = tx_power_level_encode(*p_advdata->p_tx_power_level,
p_encoded_data,
p_len,
max_size);
VERIFY_SUCCESS(err_code);
}

int main(void)
{
// Initialize.
log_init();
cli_init();
leds_init();
timer_init();
counter_init();
buttons_init();
power_management_init();
ble_stack_init();
gap_params_init();
+ sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN,m_conn_handle,8);
+ sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV,m_conn_handle,8);
gatt_init();
advertising_data_set();

---

}

Parents
  • Hi Prasanna, 

    if you look at advertising_data_set() in main.c you'll see that the ble_advdata_t adv_data struct only populates the .name_type, .flags and .include_apperance fields, i.e. 

    Fullscreen
    1
    2
    3
    4
    5
    6
    ble_advdata_t const adv_data =
    {
    .name_type = BLE_ADVDATA_FULL_NAME,
    .flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE,
    .include_appearance = false,
    };
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     

    hence (p_advdata->p_tx_power_level != NULL) evaluates to false in ble_advdata_encode. If you want to include the tx power in the advertisment packet you need to populate this in the adv_data struct yourself. 

    You're also calling sd_ble_gap_tx_power_set without checking the return codes, please implement this. You're also passing the connection handle(m_conn_handle) when you're trying to set the advertisment role TX power, which is incorrect, you need to pass the advertisement handle(m_adv_handle) as stated in the documentation. 

    Best regards

    Bjørn 

  • Hi Bjorn,

    1. Followed the steps mentioned by you and changed the code accordingly for setting the tx power to 8dBM. Did i properly set in source code, Please help to check my source code file.

    2. To perform long range throughput testing with tx power 8dBM, I am trying to set the PHY channel to CODED in the ble_app_att_mtu_throughput  example source code.When i changed the PHY channel to CODED and flashed through IAR embedded workbench and pressed switch 3 on board 1(tester role board is ready to perform run command).But on board2, after pressing switch 4, It is throwing fatal error.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**
    * Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
    *
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without modification,
    * are permitted provided that the following conditions are met:
    *
    * 1. Redistributions of source code must retain the above copyright notice, this
    * list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form, except as embedded into a Nordic
    * Semiconductor ASA integrated circuit in a product or a software update for
    * such product, must reproduce the above copyright notice, this list of
    * conditions and the following disclaimer in the documentation and/or other
    * materials provided with the distribution.
    *
    * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
    * contributors may be used to endorse or promote products derived from this
    * software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Not sure,What is going wrong in the code ? Attached the main file source code(nRF5_SDK_15.0.0_a53641a/ble_app_att_mtu_throughput  example). Please help to check the source code.

    3. Please let me know exactly what changes need to perform for testing the long range by using ble_app_att_mtu_throughput example.

Reply
  • Hi Bjorn,

    1. Followed the steps mentioned by you and changed the code accordingly for setting the tx power to 8dBM. Did i properly set in source code, Please help to check my source code file.

    2. To perform long range throughput testing with tx power 8dBM, I am trying to set the PHY channel to CODED in the ble_app_att_mtu_throughput  example source code.When i changed the PHY channel to CODED and flashed through IAR embedded workbench and pressed switch 3 on board 1(tester role board is ready to perform run command).But on board2, after pressing switch 4, It is throwing fatal error.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**
    * Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
    *
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without modification,
    * are permitted provided that the following conditions are met:
    *
    * 1. Redistributions of source code must retain the above copyright notice, this
    * list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form, except as embedded into a Nordic
    * Semiconductor ASA integrated circuit in a product or a software update for
    * such product, must reproduce the above copyright notice, this list of
    * conditions and the following disclaimer in the documentation and/or other
    * materials provided with the distribution.
    *
    * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
    * contributors may be used to endorse or promote products derived from this
    * software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Not sure,What is going wrong in the code ? Attached the main file source code(nRF5_SDK_15.0.0_a53641a/ble_app_att_mtu_throughput  example). Please help to check the source code.

    3. Please let me know exactly what changes need to perform for testing the long range by using ble_app_att_mtu_throughput example.

Children