<?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 Gatt Queue Library with sd_ble_gattc_write NRF_ERROR_RESOURCES</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57919/ble-gatt-queue-library-with-sd_ble_gattc_write-nrf_error_resources</link><description>I am running SDK 16.0 on nrf52840. For GATT Writes I am using the BLE Gatt Queue Library. When I try to performing lots of writes in succession some packets do not get transmitted and I have tied it to sd_ble_gattc_write returning NRF_ERROR_RESOURCES</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 25 Feb 2023 17:05:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57919/ble-gatt-queue-library-with-sd_ble_gattc_write-nrf_error_resources" /><item><title>RE: BLE Gatt Queue Library with sd_ble_gattc_write NRF_ERROR_RESOURCES</title><link>https://devzone.nordicsemi.com/thread/412088?ContentTypeID=1</link><pubDate>Sat, 25 Feb 2023 17:05:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69a53c40-6dd9-4f38-98c5-264ac6e672af</guid><dc:creator>rastik</dc:creator><description>&lt;p&gt;In my experience the internal SD queue requires a lot of RAM. If you modify nrf_ble_gq.c and add&amp;nbsp;&lt;code&gt;&amp;nbsp;|| err_code == NRF_ERROR_RESOURCES&lt;/code&gt; to both places where&amp;nbsp;&lt;code&gt;NRF_ERROR_BUSY&lt;/code&gt; is checked then the library should work fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Gatt Queue Library with sd_ble_gattc_write NRF_ERROR_RESOURCES</title><link>https://devzone.nordicsemi.com/thread/241777?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 10:27:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a7074f6-fc44-4f1d-a8aa-bcca4aeca4c2</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I would suggest that you use either internal Softdevice queue (configurable &lt;a title="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/structble__gattc__conn__cfg__t.html#a5c4f01dc7a8236a3dcb31959a18e0e62" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/structble__gattc__conn__cfg__t.html#a5c4f01dc7a8236a3dcb31959a18e0e62" rel="noopener noreferrer" target="_blank"&gt;ble_gattc_conn_cfg_t::write_cmd_tx_queue_siz&lt;/a&gt;e) or BLE Gatt Queue module for GATTC Writes. Actually, the Softdevice queue is a better option because you can track its size at the application level.&lt;/p&gt;
&lt;p&gt;You cannot assess BLE GATT Queue size the same way, because all Softdevice requests use exactly the same queue and the information about it is unavailable. So the algorithm for tracking the BLE GATT&amp;nbsp;queue state cannot be used in this case: &amp;quot;&lt;span&gt;Store initial queue element count in a variable&lt;/span&gt;&amp;quot; can work well....&amp;quot;.&lt;/p&gt;
&lt;p&gt;You are probably using&amp;nbsp;both queues in your solution (judging from&amp;nbsp;your screenshot). In that case, the SD queue will fill up first and the BLE GATT Queue will be used. That&amp;#39;s why you see the disparity between the number of times when the item was added to the BLE GATT queue (only 1 time in your screenshot) and the number of BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE events (5).&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Gatt Queue Library with sd_ble_gattc_write NRF_ERROR_RESOURCES</title><link>https://devzone.nordicsemi.com/thread/241708?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 02:49:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3914688-48ad-4c36-ac87-31d8de7faf2a</guid><dc:creator>Taoo</dc:creator><description>&lt;p&gt;I had try as your suggestion,but i found when i send a packege to slave, there appear five time call back for &amp;quot;BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE&amp;quot;.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think &amp;quot;&lt;span&gt;Store initial queue element count in a variable&lt;/span&gt;&amp;quot; can work well.&lt;/p&gt;
&lt;p&gt;My chip is 52832,SDK 16.0.0&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/_004E216BD15301905F001A59216B_complete.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Gatt Queue Library with sd_ble_gattc_write NRF_ERROR_RESOURCES</title><link>https://devzone.nordicsemi.com/thread/235743?ContentTypeID=1</link><pubDate>Fri, 21 Feb 2020 14:20:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87665d2e-02ca-49c8-b23c-591f8b48ec6c</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It seems like NRF_ERROR_RESOURCES error should also trigger the queuing mechanism in the BLE Gatt Queue Library so that Softdevice request could be handled later on when Softdevice is free. You can modify the library code so that this error is also taken into account when queuing data, we will fix it in future releases.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Gatt Queue Library with sd_ble_gattc_write NRF_ERROR_RESOURCES</title><link>https://devzone.nordicsemi.com/thread/235549?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2020 16:18:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b8be272-5e82-496a-be56-a1429f76b5c5</guid><dc:creator>Matt22</dc:creator><description>&lt;p&gt;Yes, my question is why doesn&amp;#39;t the Gatt Queue do all of this for me? What is the rationale behind not queuing Write Without Responses when it will queue Write With Response? You are pointing me to all great information but I have read and know all of this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Gatt Queue Library with sd_ble_gattc_write NRF_ERROR_RESOURCES</title><link>https://devzone.nordicsemi.com/thread/235483?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2020 14:03:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1591455a-0463-47a4-978a-e620a55a6cce</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Please see&amp;nbsp;&lt;a title="GATTC Characteristic Value Write Without Response" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group___b_l_e___g_a_t_t_c___v_a_l_u_e___w_r_i_t_e___w_i_t_h_o_u_t___r_e_s_p___m_s_c.html?cp=4_5_3_1_2_2_3_2"&gt;GATTC Characteristic Value Write Without Response&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Gatt Queue Library with sd_ble_gattc_write NRF_ERROR_RESOURCES</title><link>https://devzone.nordicsemi.com/thread/234997?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 16:26:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5da1cf89-8ef8-4a49-8b03-12465ba3702c</guid><dc:creator>Matt22</dc:creator><description>&lt;p&gt;Hi, yes I read all of that. I have increased&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/structble__gattc__conn__cfg__t.html#a5c4f01dc7a8236a3dcb31959a18e0e62"&gt;ble_gattc_conn_cfg_t::write_cmd_tx_queue_size&lt;/a&gt;&amp;nbsp;to the maximum my ram will allow and I still get NRF_ERROR_RESOURCES. I could keep my own queue for this case but then what is the point of the Gatt Queue? I feel this would be a perfect use of the Gatt Queue. If the Gattc Tx Queue is full then push to Gatt Queue. And then it could handle popping off the data when BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE is received.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My question truly is why does it not do this already? What is the rationale? It seems that Gatt Queue only handles a small set of use cases and could be easily expanded, it already handles Write with Response properly, would be easy to handle Write without Response.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Gatt Queue Library with sd_ble_gattc_write NRF_ERROR_RESOURCES</title><link>https://devzone.nordicsemi.com/thread/234916?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2020 12:57:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c598746-a576-4e97-9dcc-889c37604baa</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please see&amp;nbsp;&lt;a title="sd_ble_gattc_write" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group___b_l_e___g_a_t_t_c___f_u_n_c_t_i_o_n_s.html?cp=4_5_3_1_2_2_2_11#ga90298b8dcd8bbe7bbe69d362d1133378"&gt;sd_ble_gattc_write&lt;/a&gt;() document:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Only one write with response procedure can be ongoing per connection at a time. If the application tries to write with response while another write with response procedure is ongoing, the function call will return&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group__nrf__error.html#ga5d2d8608f6d6a0329f58961a969e946e"&gt;NRF_ERROR_BUSY&lt;/a&gt;. A&lt;span&gt;&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_t_t_c___e_n_u_m_e_r_a_t_i_o_n_s.html#ggafd9b8b42eeb832d688e33f4561f97efca6a70fe83b91997c8d3cd47b6cd98a91a"&gt;BLE_GATTC_EVT_WRITE_RSP&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;event will be issued as soon as the write response arrives from the peer. The number of Write without Response that can be queued is configured by&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/structble__gattc__conn__cfg__t.html#a5c4f01dc7a8236a3dcb31959a18e0e62"&gt;ble_gattc_conn_cfg_t::write_cmd_tx_queue_size&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;When the queue is full&lt;/strong&gt;, the function call will return&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group__nrf__error.html#gac94383171545e604e8347a044e8be13f"&gt;NRF_ERROR_RESOURCES&lt;/a&gt;. A&lt;span&gt;&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_t_t_c___e_n_u_m_e_r_a_t_i_o_n_s.html#ggafd9b8b42eeb832d688e33f4561f97efca69bce270587ac00d7a1c3bd976cfd902"&gt;BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;event will be issued as soon as the transmission of the write without response is complete. The application can keep track of the available queue element count for writes without responses by following the procedure below:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Store initial queue element count in a variable.&lt;/li&gt;
&lt;li&gt;Decrement the variable, which stores the currently available queue element count, by one when a call to this function returns&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group__nrf__error.html#ga7e6367efeaac363d8cf024940b4ec123"&gt;NRF_SUCCESS&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Increment the variable, which stores the current available queue element count, by the count variable in&lt;span&gt;&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_t_t_c___e_n_u_m_e_r_a_t_i_o_n_s.html#ggafd9b8b42eeb832d688e33f4561f97efca69bce270587ac00d7a1c3bd976cfd902"&gt;BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;event.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>