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

How to update advertised TX power?

Using the 15.3 SDK and the 6.1 software device I am successfully changing the transmit power as needed.  When not connected and advertising I would like to update the advertised TX power initialized with:

init.srdata.p_tx_power_level

I have read multiple, multiple posts to DevZone regarding updating the advertising information but so many are out of date or links are broken.  Given advertising the transmit power must be a rather routine situation I'm assuming there is some simple way to do the update.  If there is not a simple way could you provide a complete SDK 15.3, SD 6.1 compatible method example please?  I'm sure others would appreciate a recent example.

Any help would be appreciated as we are doing a pre-production run in China in about two weeks and I would like to have this addressed.  I'm not willing to update to SDK 16.0 because of how close to pre-production date.

Sincerely,

Michael M.

  • calling to sd_ble_gap_tx_power_set should the tx power of the radio in any role. Just call this function and set to the tx power you need before starting to advertise 

  • I think you misunderstood.  As I stated, "How to update ADVERTISED TX power?"  I understand setting the transmit power will change the transmit power for advertisements but what it doesn't change is the content of the advertisement which in my case includes a custom service UUID and TX Power.

    I can rephrase this: how do I update the advertisement information contained in the advertisement packet to indicate properly the actual transmit power being used to transmit the advertisement??

  • Ah, sorry about that, I totally misread your question.

    The default transmit power is always set to 0dBm which can also be the default value you include in your advertising packet.

    The application has to manually change the advertising power whenever needed and when the application does it, it can actually change the advertising parameters when it chagnes the TX power. For example a pseudocode could be

    void lost_connection()
    {
        // attempt to increase the adv tx power to regain connection
        sd_ble_gap_tx_power_set
    
        // readjust the adv packet to reflect the above chagne    
        sd_ble_gap_adv_set_configure // look for the examples in ble_app_hrs:main.c
    }

  • I assume that you already have used sd_ble_gap_adv_set_configure to initally transmit a UUID+TX_POWER. I thought that you just wanted to know exactly when to update it. encoding your UUID+TX_Power is something you must have already done in your advertising_init function

  • HI Susheel:

    I'm glad you now understand my question and thank you for answering so promptly.

    in my original question I stated, "Given advertising the transmit power must be a rather routine situation I'm assuming there is some simple way to do the update."

    If I understand your answer correctly, the only way to update the advertised transmit power is to create another advertising set??

    I really think there should be a simple call like sd_ble_gap_adv_enable_actual_tx_power.   Just a suggestion!

    With regard to your assumption I'm using sd_ble_gap_adv_set_configure initially, I'm not.  In order to include TX Power in the advertisement packet you have to set  init.srdata.p_tx_power_level to some value which I'm doing in the advertising_init().  Thereafter I have no need of additional advertising sets because the only data within the advertising packets I need to update is the TX Power .. hence my question.

    With regard to your pseudocode and your advice to look at ble_app_hrs:main.c as and example of using sd_ble_gap_adv_set_configure ... It doesn't exist!!  The following is a grep of the example looking for it.

    pwd
    /Users/MM/Desktop/RF5_SDK_15.3.0/examples/ble_peripheral/ble_app_hrs
    $ls
    ble_app_hrs.eww	main.c		pca10040e	pca10056e
    hex		pca10040	pca10056	pca10059
    $grep "sd_ble_gap_adv_set_configure" *.[ch]
    $

    Just to let you know the DevZone answers are rampant with responses to questions with links to things that don't exist, broken links or irrelevant links for current SDKs.  You just added one more!

    So, could you provide an example of how I should update the advertised transmit power which exists?

Related