<?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>Calling sd_ble_gap_tx_power_set() errors out with 0x3004, NRF_ERROR_NO_MEM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83685/calling-sd_ble_gap_tx_power_set-errors-out-with-0x3004-nrf_error_no_mem</link><description>Hello, 
 
 I&amp;#39;ve been trying to figure why calling sd_ble_gap_tx_power_set() continues to return the error NRF_ERROR_NO_MEM. I&amp;#39;m using SDK 17.0.2 with S113, v7.2.0 on the NRF52840. 
 I&amp;#39;ve seen previous posted regarding other Softdevice function calls failing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Jan 2022 08:01:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83685/calling-sd_ble_gap_tx_power_set-errors-out-with-0x3004-nrf_error_no_mem" /><item><title>RE: Calling sd_ble_gap_tx_power_set() errors out with 0x3004, NRF_ERROR_NO_MEM</title><link>https://devzone.nordicsemi.com/thread/348186?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 08:01:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae2edeac-9dd0-4473-a781-90d046eaddbb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The API of sd_ble_gap_tx_power_set() changed in SoftDevice version 6.0.0. Since then, you can set TX power separately for different roles, connections, etc. See &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.2.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html"&gt;API documentation&lt;/a&gt; for details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calling sd_ble_gap_tx_power_set() errors out with 0x3004, NRF_ERROR_NO_MEM</title><link>https://devzone.nordicsemi.com/thread/348163?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 05:11:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4556782f-b097-4b89-b9bc-c07c5d359670</guid><dc:creator>Sami</dc:creator><description>&lt;p&gt;Looks like a misread interpreted the error code. Thank you for clarifying. Ok, so I can now successfully call sd_ble_gap_tx_power_set() with the following code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
BLE_ADVERTISING_DEF(m_advertising);                                                 /**&amp;lt; Advertising module instance. */
static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID;                            /**&amp;lt; Handle of the current connection. */


//err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_connHandle, calaTxPower); // this does not work!
err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_advertising.adv_handle, calaTxPower); // this works&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The way that doesn&amp;#39;t work is the way we used to call sd_ble_gap_tx_power_set() from SDK 11.0.0~!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The method that you suggested, which doesn&amp;#39;t use the connection handle but rather, the advertising instance m_advertising, does work. Is my attempt to use m_conn_handle simply deprecated?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I turned on the DEBUG preprocessor as you suggested, however, I got no further information (only the old error code 0x3004).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calling sd_ble_gap_tx_power_set() errors out with 0x3004, NRF_ERROR_NO_MEM</title><link>https://devzone.nordicsemi.com/thread/347919?ContentTypeID=1</link><pubDate>Mon, 17 Jan 2022 07:48:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa727ae2-cb52-4152-9c6f-88d72671588c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The error code 0x3004 is &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.0.1/group__ble__err.html"&gt;BLE_ERROR_INVALID_ADV_HANDLE&lt;/a&gt;&amp;nbsp;(not&amp;nbsp;NRF_ERROR_NO_MEM). Looking at the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html"&gt;API documentation for&amp;nbsp;sd_ble_gap_tx_power_set()&lt;/a&gt;&amp;nbsp;you see that it is returned if you provided an invalid connection handle. I do not see from your code snippet what the value of&amp;nbsp;m_connHandle is, but it is clearly not valid. You get this value from when you initialize advertising (see for instance &amp;lt;SDK 17.x.x&amp;gt;\examples\ble_peripheral\ble_app_proximity\main.c).&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;For future reference, I highly recommend making use of the APP_ERROR_CHECK() function in combination with having DEBUG defined in your preprocessor defines, like shown in the included image:&lt;br /&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1642406568723v1.jpeg" alt=" " /&gt;&lt;/span&gt;&lt;br /&gt;This will make your logger output a detailed error message whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK, which makes debugging much easier. It would be very useful to see the error message output by the logger in this case, if you insert an APP_ERROR_CHECK on the error code returned by sd_ble_gap_tx_power_set.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>