<?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>ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26166/ble_nus_string_send-error-codes</link><description>Hi all, 
 I&amp;#39;m sending data with ble_nus_string_send() in a loop as shown below. If it returns an error it retries until it gets NRF_SUCCESS. I&amp;#39;m getting an error code 0x0013. Does anyone know what this means or where in the documentation this is stated</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Oct 2017 16:57:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26166/ble_nus_string_send-error-codes" /><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103083?ContentTypeID=1</link><pubDate>Wed, 25 Oct 2017 16:57:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:003b503b-f2a1-41bf-8280-626667e07faa</guid><dc:creator>leonhart88</dc:creator><description>&lt;p&gt;Nevermind, I was able to figure it out after looking at the source code for nrf_sdh_ble_default_cfg_set()...still learning how to use the SDK &amp;amp; documentation =)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103082?ContentTypeID=1</link><pubDate>Wed, 25 Oct 2017 16:25:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7190d3e-0347-4d84-908e-97a32e7bb01f</guid><dc:creator>leonhart88</dc:creator><description>&lt;p&gt;Also, am I able to call sd_ble_cg_set() after nrf_sdh_ble_default_cfg_set() to just modify the tx queue attribute?  Or do I need to set up everything using sd_ble_cfg_set()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103081?ContentTypeID=1</link><pubDate>Wed, 25 Oct 2017 16:03:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a77b696-81dc-46b9-9fbd-9a5d21b593da</guid><dc:creator>leonhart88</dc:creator><description>&lt;p&gt;Great thanks!  I totally missed that last part in the documentation.  Thanks for your help!  Cheers.&lt;/p&gt;
&lt;p&gt;PS is there a maximum queue size?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103085?ContentTypeID=1</link><pubDate>Wed, 25 Oct 2017 11:48:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16ddd1ea-8349-4ee9-a7e6-6fb799a45d1f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You will need to keep track of the value you passed to sd_ble_cfg_set. The default is, as &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/structble__gatts__conn__cfg__t.html?cp=2_3_1_1_0_2_4_4_0_0#ae2a1156d8b06a6ccc70696f2372226cc"&gt;documented in the infocenter&lt;/a&gt;, given by the symbol &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t_s___d_e_f_a_u_l_t_s.html#gadeb57ec178918eea438c8b4a4944ebd2"&gt;&lt;code&gt;BLE_GATTS_HVN_TX_QUEUE_SIZE_DEFAULT&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103080?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 17:07:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eaee740b-11bc-40fd-99fd-0dc2f236185f</guid><dc:creator>leonhart88</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;Thanks.  I&amp;#39;ve modified it so at least when I encounter an error I set a flag until it gets cleared by the TX_COMPLETE event...so at least I&amp;#39;m minimizing the unecessary calls a bit.&lt;/p&gt;
&lt;p&gt;Can you explain how to determine the queue size?  I believe I read there was a function in the old SDK versions which would return this, but it&amp;#39;s now configured via sd_ble_cfg_set.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m currently just using nrf_sdh_ble_default_cfg_set().  What is the default value for the number of tx buffers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103084?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 13:44:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fb1f3aa-4685-4c9f-908d-696051b16d40</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I don&amp;#39;t have any exact details on overhead when calling it the way you do, but I would suggets that you follow the recommendation in the documentation and keep track of the queue size, and only call &lt;code&gt;sd_ble_gatts_hvx&lt;/code&gt; when there is available space in the queue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103076?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 16:38:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c0a7aae-7b60-44fc-ac04-b0d440b897a6</guid><dc:creator>leonhart88</dc:creator><description>&lt;p&gt;Thanks endnode.  I did figure out that it was a resources error from the global error list...but I couldn&amp;#39;t find out specifically why that was being returned in relation to the function.  I now realize I have to delve into some of the source code to find that out.  Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103079?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 16:35:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99f7798b-5a7e-48bd-8e46-6f3bffb170ac</guid><dc:creator>leonhart88</dc:creator><description>&lt;p&gt;Just to add, I actually am already implementing the BLE_GATTS_EVT_HVN_TX_COMPLETE in my handler.  I simply increment a counter to check that the number of packets I tried to send have sent regardless of errors.  I do see the correct number the way I&amp;#39;m doing it now, but as I said, perhaps there is some unwanted overhead in calling the function so many times.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103078?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 16:33:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96dac0a6-da34-4da6-adf1-e7fdf2226bb9</guid><dc:creator>leonhart88</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;Yes SDK 14 and SD S132 v5.&lt;/p&gt;
&lt;p&gt;Thanks for the tip.  I didn&amp;#39;t know I had to comb through the source code to find this info...I thought it would be in the online docs somewhere.&lt;/p&gt;
&lt;p&gt;As for the error, is it best to wait for a TX COMPLETE event upon an error?  Or is it acceptable to do what I&amp;#39;m doing now and keep calling the function until a NRF_SUCCESS is received?  I presume the latter has some undesirable overhead.  Or, should we do what the comments say in ble_gatts.h and keep a count of the tx_queue_size and only call ble_nus_string_send() when there is space?&lt;/p&gt;
&lt;p&gt;Thanks for the help.  Cheers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103077?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 09:15:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0527ac8-417e-4ce6-9358-ca80ed11c550</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you are using SDK v14.x.0, and Softdevice s132 v5.0.0, you can find Global Error Codes documentation &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group__nrf__error.html?cp=2_3_1_1_0_2_0_7"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The error code 0x0013 (decimal 19) corresponds to &lt;code&gt;NRF_ERROR_RESOURCES&lt;/code&gt;. In the source code of &lt;code&gt;ble_nus_string_send()&lt;/code&gt;, you can see that the return value is either &lt;code&gt;NRF_ERROR_INVALID_STATE&lt;/code&gt;. &lt;code&gt;NRF_ERROR_INVALID_PARAM&lt;/code&gt;, or the return value from call to &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#ga313fe43c2e93267da668572e885945db"&gt;&lt;code&gt;sd_ble_gatts_hvx()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The documentation give the following reason for the error code:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NRF_ERROR_RESOURCES&lt;/strong&gt;	Too many
notifications queued. Wait for a
&lt;code&gt;BLE_GATTS_EVT_HVN_TX_COMPLETE&lt;/code&gt; event
and retry.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_string_send error codes</title><link>https://devzone.nordicsemi.com/thread/103075?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 08:26:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb51880e-28ab-4151-b4b9-244ee6bee99b</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;You have all the source code of &lt;code&gt;ble_nus&lt;/code&gt; module in the SDK so just traverse the source code down to SD function calls which have good explanation in header files including error codes returned (and some indication why). All NRF error codes are in SD header files like &lt;code&gt;\components\softdevice\s132\headers\nrf_error.h&lt;/code&gt; etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>