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

Increase TX beacon power

How can I increase the TX power on nRF5_SDK_15.3.0?

Parents Reply Children
  • Good, i find the sd_ble_gap_tx_power_set() function in ble_app_proximity example and was very clarify to understand how this function is used.

    But, when i add:
    uint32_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_advertising.adv_handle, 4); 

    I got this error:
    'm_advertising' undeclared (first use in this function)

    What i'm doing wrong? 

    Thanks

  • Well, the error message sums it up: 

     

    Haroldo said:
    'm_advertising' undeclared (first use in this function)

    Before you call sd_ble_gap_tx_power_set you need to have declared the m_advertising struct that you are passing as a parameter to the function.

    regards

    Jared 

  • I tryed declared the m_advertising struct without success...

    I compared the advertising_start() function of ble_app_beacon and ble_app_proximity examples...

    ble_app_proximity example:

    /**@brief Function for starting advertising.
     */
    static void advertising_start(bool erase_bonds)
    {
        if (erase_bonds == true){
            delete_bonds();
            // Advertising is started by PM_EVT_PEERS_DELETE_SUCEEDED event.
        }
        else
        {
            uint32_t err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
    
            APP_ERROR_CHECK(err_code);
        }
    }

    The parameter used in ble_advertising_start is m_advertising.

    ble_app_beacon example:

    /**@brief Function for starting advertising.
     */
    static void advertising_start(void)
    {
        ret_code_t err_code;
    
        err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
        APP_ERROR_CHECK(err_code);
    
        err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
        APP_ERROR_CHECK(err_code);
    }
    

    The parameter used in sd_ble_gap_adv_start is m_adv_handle.

    So i changed the handle parameter of sd_ble_gap_tx_power_set function to m_adv_handle and works good!

    uint32_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_adv_handle, 4); 

    I don't know if what i did is correct but i can measure the difference on power TX...

    Can i keep this modification?

    What is the difference of ble_advertising_start and sd_ble_gap_adv_start?

    PTS.: I also find in main() of ble_app_beacon example:

    static uint8_t      m_adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;

    Thanks

  • Hi,

     It should be alright. It's effectively the same, ble_advertising_start() calls sd_ble_gap_adv_start(), see the definition of the function.

    regards

    Jared

  • Very good, Jared!

    Many thanks to spend your time to help me!

    Regards

Related