<?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>Location to set Tx power in Advertisement and Connection mode. Also change them dynamically at runtime</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/54562/location-to-set-tx-power-in-advertisement-and-connection-mode-also-change-them-dynamically-at-runtime</link><description>Hello, 
 
 I am using nRF52840, SDK_16.0.0, S140 SoftDevice and Segger 4.16 for flashing the image. I am using ‘ble_app_blinky’. 
 
 I have few queries on setting Tx power level. I am using sd_ble_gap_tx_power_set() to change power level. 
 
 1) In example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 19 Nov 2019 07:58:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/54562/location-to-set-tx-power-in-advertisement-and-connection-mode-also-change-them-dynamically-at-runtime" /><item><title>RE: Location to set Tx power in Advertisement and Connection mode. Also change them dynamically at runtime</title><link>https://devzone.nordicsemi.com/thread/220723?ContentTypeID=1</link><pubDate>Tue, 19 Nov 2019 07:58:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef257d99-71a8-4136-899c-4ae409395fdb</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Thank you for your inputs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Location to set Tx power in Advertisement and Connection mode. Also change them dynamically at runtime</title><link>https://devzone.nordicsemi.com/thread/220722?ContentTypeID=1</link><pubDate>Tue, 19 Nov 2019 07:42:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b77a3bb6-b4d1-4d52-839e-eb49ac649c0d</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Vishnu&lt;/p&gt;
&lt;p&gt;1.&lt;/p&gt;
&lt;p&gt;a)&amp;nbsp;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;uint32_t err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, -40); 
	    APP_ERROR_CHECK(err_code); 
            break;&lt;/pre&gt;&amp;nbsp; See &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/37630/sd_ble_gap_tx_power_set-not-working"&gt;this case&lt;/a&gt; for an explanation.&lt;/p&gt;
&lt;p&gt;b) Yes, you can make the application check for I.E. battery power during a connection as well, but seeing as a connection will time out, it should be sufficient doing this during advertising start, for example.&lt;/p&gt;
&lt;p&gt;2. You&amp;#39;re correct. I guess it&amp;#39;s just that my suggestion is to set the TX power in the advertising_start and not during init, so that the application can check what TX power it should use at the start of each advertisement.&lt;/p&gt;
&lt;p&gt;3. Please see&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/20013/how-to-change-transmitting-power/77886#77886"&gt; this case&lt;/a&gt; for information on the TX power service.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Location to set Tx power in Advertisement and Connection mode. Also change them dynamically at runtime</title><link>https://devzone.nordicsemi.com/thread/220721?ContentTypeID=1</link><pubDate>Mon, 18 Nov 2019 14:26:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a5e7f8b-0470-4af6-9bce-0cc19c174821</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Thank you for inputs. Please find my response &amp;amp; few more queries.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1) In ble_app_proximity example, I am not able to find the Tx settings changes based on Connection handler.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;a) Based on point ‘5’, in Peripheral, once connection is established, it will inherit Tx settings used during Advertisement. But as part of point ‘2&amp;amp;3’ how to set different levels using connection handler.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;b) Once connection is established, based on algorithm in point ‘6’ whether can I call sd_ble_gap_tx_power_set() at any time.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;/p&gt;
&lt;p&gt;2) I am bit confused with point 4. Once Tx powered configured to 8 dBm. It will be inherited the same after connection established. Even after disconnect and re-start Advertisement, still it should inherit the same Tx during Advertisement. In that case still do we need to call&amp;nbsp;&lt;span&gt;sd_ble_gap_tx_power_set() as part of&amp;nbsp;advertising_start().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;3) Without &amp;quot;Tx Power&amp;quot; Service 0x1804, whether can I use GAP 0x0A &amp;quot;Tx Power level&amp;quot; as part of Advertisement packet. Any difference between these two.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards&lt;/p&gt;
&lt;p&gt;Vishnu Beema&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Location to set Tx power in Advertisement and Connection mode. Also change them dynamically at runtime</title><link>https://devzone.nordicsemi.com/thread/220720?ContentTypeID=1</link><pubDate>Mon, 18 Nov 2019 12:05:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90b4ebc8-7f24-4bea-9ae4-8bc6dca396ae</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;1. The default TX power level is 0dBm. You can set the TX power to a default value by setting #define TX_POWER_LEVEL to your desired default value.&lt;/p&gt;
&lt;p&gt;2. &amp;amp; 3. &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v6.1.0%2Fgroup___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html&amp;amp;anchor=gad10e80ba20ddab42d1753fd1be2d8c26"&gt;sd_ble_gap_tx_power_set &lt;/a&gt;can be used to set the TX power with the handle you want, and you can set it to different levels for the advertising and connection handle. Please see the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Fble_sdk_app_proximity.html&amp;amp;cp=6_1_4_2_2_21"&gt;ble_app_proximity &lt;/a&gt;example to see how that function is used there.&lt;/p&gt;
&lt;p&gt;4. If you see the proximity example, the sd_ble_gap_tx_power_set function is only set as part of advertising_start(). If you&amp;#39;re using it as part of advertising_init() you&amp;#39;ll have to uninit and reinitialize the advertising before you start advertising every time. You can also just set it as part of advertising_start() and not advertising_init().&lt;/p&gt;
&lt;p&gt;5. When a connection is created, the advertiser (peripheral) will inherit the TX power used when advertising. While the scanner (central) will inherit the TX power used while scanning. So the peripheral will stay at the TX power it advertised with.&lt;/p&gt;
&lt;p&gt;6. You can&amp;#39;t change the TX power automatically, but you can set up your own scheme for changing the TX power based on the battery level for example. For example with a simple if/else during advertising_start() like, if battery_level&amp;lt;50% TX_POWER low, else TX_POWER 8dbm.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>