<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Changing the Tx Power in sdk 15.2.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40904/changing-the-tx-power-in-sdk-15-2-0</link><description>Hello, 
 I am trying to change the tx power for my nRF52-DK which is having nRF52832 chip. I trying the following code to change the tx power to -40 dB. 
 
 int8_t tx_power_level = -40; 
 init.advdata.p_tx_power_level = &amp;amp;tx_power_level; 
 sd_ble_gap_tx_power_set</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Jan 2019 11:51:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40904/changing-the-tx-power-in-sdk-15-2-0" /><item><title>RE: Changing the Tx Power in sdk 15.2.0</title><link>https://devzone.nordicsemi.com/thread/164887?ContentTypeID=1</link><pubDate>Thu, 10 Jan 2019 11:51:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d70fb2cf-57e5-4128-a851-8820b5d14db6</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I&amp;#39;m a bit unsure on what you mean, you can use the same method in the &lt;strong&gt;ble_app_blinky&lt;/strong&gt; project to change the TX Power.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Tx Power in sdk 15.2.0</title><link>https://devzone.nordicsemi.com/thread/164595?ContentTypeID=1</link><pubDate>Wed, 09 Jan 2019 00:12:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a3b25c7-38fa-4a83-a597-9f300dc91fb0</guid><dc:creator>Arepa</dc:creator><description>&lt;p&gt;Hi Andreas, is there any other option to change the TX power? I mean for that example you posted above you have to call&amp;nbsp;ble_advertising_init adding an advertising instance, what for an example like ble_blinky peripheral?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Changing the Tx Power in sdk 15.2.0</title><link>https://devzone.nordicsemi.com/thread/159034?ContentTypeID=1</link><pubDate>Mon, 26 Nov 2018 13:31:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d289952-bcc6-47cc-ab26-41073b149c90</guid><dc:creator>AndreasF</dc:creator><description>&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Hi.&lt;br /&gt;&lt;br /&gt;There is an example which demonstrates how to change the TX power, the example is found in examples\ble_peripheral\ble_app_proximity\main.c&lt;br /&gt;&lt;br /&gt;If you look at this example, the TX power is changed in the function&lt;strong&gt; tx_power_set(void)&lt;/strong&gt;, which is called after the &lt;strong&gt;advertising_start(erase_bonds)&lt;/strong&gt; function, which again is called after the advertising is initialised in &lt;strong&gt;the advertising_init()&lt;/strong&gt; function.&lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;tx_power_set(void)&lt;/strong&gt; function looks like this:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@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_ADV, m_advertising.adv_handle, TX_POWER_LEVEL);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;You can use this function, and you also need to define the &lt;strong&gt;TX_POWER_LEVEL&lt;/strong&gt; in your &lt;strong&gt;main.c&lt;/strong&gt; file like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define TX_POWER_LEVEL                  (-40)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The&lt;strong&gt; main(void)&lt;/strong&gt; function of the example, &lt;strong&gt;examples\ble_peripheral\ble_app_proximity&lt;/strong&gt;, looks like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for application main entry.
 */
int main(void)
{
    bool erase_bonds;

    // Initialize.
    log_init();
    timers_init();
    buttons_leds_init(&amp;amp;erase_bonds);
    power_management_init();
    ble_stack_init();
    adc_configure();
    gap_params_init();
    gatt_init();
    advertising_init();
    db_discovery_init();
    services_init();
    conn_params_init();
    peer_manager_init();

    // Start execution.
    NRF_LOG_INFO(&amp;quot;Proximity example started.&amp;quot;);
    advertising_start(erase_bonds);
    tx_power_set();

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here you see that the TX power is changed at the bottom before the main loop, by the function call &lt;strong&gt;tx_power_set();&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;Best regards.&lt;/p&gt;
&lt;p&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>