<?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>[nRF52840 SDK 16.0.0] ble beacon example change TX power level</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61254/nrf52840-sdk-16-0-0-ble-beacon-example-change-tx-power-level</link><description>Hi all, 
 
 I&amp;#39;m using the &amp;quot;ble_beacon_app&amp;quot; example from the SDK 16.0.0 with the nRF52840 DK. I would like to change the TX power level. 
 In main.c function, I tried to change the advertising_init() by adding the following code: 
 
 I get no error by</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 May 2020 10:05:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61254/nrf52840-sdk-16-0-0-ble-beacon-example-change-tx-power-level" /><item><title>RE: [nRF52840 SDK 16.0.0] ble beacon example change TX power level</title><link>https://devzone.nordicsemi.com/thread/249647?ContentTypeID=1</link><pubDate>Wed, 13 May 2020 10:05:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22239976-a864-479f-916d-1a2d252605d1</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Please post new questions in a new thread. We want to make the threads follow the topic of the subject, to make information more searchable. Note that many others have asked about long-range advertising before. You should find some examples and suggestions if you use the search-function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 SDK 16.0.0] ble beacon example change TX power level</title><link>https://devzone.nordicsemi.com/thread/249639?ContentTypeID=1</link><pubDate>Wed, 13 May 2020 09:25:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d1f8a24-290b-4e1d-a82f-6d361b176c7b</guid><dc:creator>alfiero</dc:creator><description>&lt;p&gt;Today I also tried to update the parameters&amp;nbsp;m_adv_params of ble_gap_adv_params_t data type, which is declared at the beginning of main.c, by adding in advertising_init() function the last line of the following code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
    m_adv_params.p_peer_addr     = NULL;    // Undirected advertisement.
    m_adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
    m_adv_params.interval        = NON_CONNECTABLE_ADV_INTERVAL;
    m_adv_params.duration        = 0;       // Never time out.
    m_adv_params.primary_phy     = BLE_GAP_PHY_CODED; // added this line,
                                                     // trying to set phy to 125 kbps&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But, even in this case, the application doesn&amp;#39;t work. By building and debugging, the app_error_fault_heandler is called.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 SDK 16.0.0] ble beacon example change TX power level</title><link>https://devzone.nordicsemi.com/thread/249564?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 17:44:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5cc1cd5-006c-475d-abbe-bbc926bd57ff</guid><dc:creator>alfiero</dc:creator><description>&lt;p&gt;I tried to put this code at the end of the advertising_init function, to get the lowest throughput for advertising, which should be 125 kbps (I saw it is supported for advertising non-connectable mode in the latest version of s140):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//set PHY mode: 
    ble_gap_phys_t const myPhys =
            {
                .rx_phys = BLE_GAP_PHY_CODED, //lowest datarate
                .tx_phys = BLE_GAP_PHY_CODED,
            };

    err_code = sd_ble_gap_phy_update(m_adv_handle, &amp;amp;myPhys);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I get no errors from the compiler, but the application doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;I would like to set the 125 kbps data rate to achieve the long-range mode for advertising.&lt;/p&gt;
&lt;p&gt;Any suggestions? Thank you in advance!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 SDK 16.0.0] ble beacon example change TX power level</title><link>https://devzone.nordicsemi.com/thread/249544?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 15:34:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80b7e626-d229-42fa-9fac-4d26a4e71f5c</guid><dc:creator>alfiero</dc:creator><description>&lt;p&gt;Ok, thank you so much, J&amp;oslash;rgen!&lt;/p&gt;
&lt;p&gt;Another question (sorry to bother you): I saw that for &amp;#39;long-range&amp;#39; mode, the data rate should be 125 kbps,&amp;nbsp;so as to reduce receiving errors I guess. What is the default bitrate in this example? 1Mbps? How can I change it to 125 kbps to combine it with the +8 dBm output power, in order to achieve a very long-range transmission? Thank you in advance!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 SDK 16.0.0] ble beacon example change TX power level</title><link>https://devzone.nordicsemi.com/thread/249251?ContentTypeID=1</link><pubDate>Mon, 11 May 2020 15:01:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9eb5b4c-21ac-4c6d-a85e-0c2d8e38d09d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user="alfiero"]So, do I need only to add your code in the init function, or should I also change the&amp;nbsp;advdata.p_tx_power_level in a different way? I do not full understand the functionality of this latter parameter.[/quote]
&lt;p&gt;No, you do not need to add this. As I said, there is most likely not enough space in the advertising packet to include this anyway. The iBeacon format (which ble_app_beacon closely implements) does not include the parameter.&lt;/p&gt;
[quote user="alfiero"]I noticed that in this example project, the function&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html#gad10e80ba20ddab42d1753fd1be2d8c26"&gt;sd_ble_gap_tx_power_set&lt;/a&gt;() is not used at all. does it means that the device will keep the default settings of 0 dBm?&lt;/span&gt;[/quote]
&lt;p&gt;Yes, the default of 0 dBm will be used when the tx_power is not explicitly set.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 SDK 16.0.0] ble beacon example change TX power level</title><link>https://devzone.nordicsemi.com/thread/249246?ContentTypeID=1</link><pubDate>Mon, 11 May 2020 14:55:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4518fa0a-2596-4939-9457-3e64b3d80a04</guid><dc:creator>alfiero</dc:creator><description>&lt;p&gt;Ok thank you so much!&lt;/p&gt;
&lt;p&gt;So, do I need only to add your code in the init function, or should I also change the&amp;nbsp;advdata.p_tx_power_level in a different way? I do not full understand the functionality of this latter parameter.&lt;/p&gt;
&lt;p&gt;I noticed that in this example project, the function&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html#gad10e80ba20ddab42d1753fd1be2d8c26"&gt;sd_ble_gap_tx_power_set&lt;/a&gt;() is not used at all. does it means that the device will keep the default settings of 0 dBm?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you again!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52840 SDK 16.0.0] ble beacon example change TX power level</title><link>https://devzone.nordicsemi.com/thread/249236?ContentTypeID=1</link><pubDate>Mon, 11 May 2020 14:30:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eaae96d3-33bc-4b28-a017-8a6fa3f41c81</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The code you have added is for including the TX power level that the beacon uses in the advertising packet. It does not change the actual TX power. The reason that the application does not work with these additions is most likely that the advertising packet was already full before you added this additional data field, generating an error when you run the application.&lt;/p&gt;
&lt;p&gt;To change the actual TX power level for the advertising, you should call&amp;nbsp;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html#gad10e80ba20ddab42d1753fd1be2d8c26"&gt;sd_ble_gap_tx_power_set&lt;/a&gt;().&amp;nbsp;You can add this to the end of advertising_init() function to set +8 dBm output power:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_adv_handle, 8);
APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>