<?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>【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo</link><description>Hello Nordic experts, 
 
 Recently, I would like to implement high throughput with multi links. to optimize the system, I have the following doubts: 
 
 First of all, let me introduce the background: 
 
 1. 52840 for central, while 4~8 52832 for peripheral</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Nov 2021 14:01:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo" /><item><title>RE: 【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/thread/340362?ContentTypeID=1</link><pubDate>Tue, 23 Nov 2021 14:01:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12ce924d-0da7-484f-b0c7-5f794293e376</guid><dc:creator>xiaolongba</dc:creator><description>&lt;p&gt;Hello vidar Bro,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;sorry for the late response as I was on annual leave several days ago&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo/339702#339702"]It sets the max. payload length for all packets. [/quote]
&lt;p&gt;Got it. so my understanding above is correct?&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo/339702#339702"]But what is the motivation for using the nrf queue module? [/quote]
&lt;p&gt;no, I just want to know what is the difference between&amp;nbsp;&lt;span&gt;nrf queue module and&amp;nbsp;write_cmd_tx_queue_size&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/thread/339702?ContentTypeID=1</link><pubDate>Thu, 18 Nov 2021 15:58:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef4d9a83-d3fa-4631-8109-ad59ec81647a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It sets the max. payload length for all packets. But what is the motivation for using the nrf queue module? I forgot to mention earlier that there is a bug in the nrf queue module with the way it handles write commands, please see this thread details: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/60557/bug-improvement-in-handling-nrf_error_resources-response-in-gatt-queue-nrf_ble_gq_req_gatts_hvx-processing"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/60557/bug-improvement-in-handling-nrf_error_resources-response-in-gatt-queue-nrf_ble_gq_req_gatts_hvx-processing&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/thread/339698?ContentTypeID=1</link><pubDate>Thu, 18 Nov 2021 15:47:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4338f702-b26d-4ced-89ea-aa8042040050</guid><dc:creator>xiaolongba</dc:creator><description>&lt;p&gt;Hi Vidar Bro,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;most of them are clear, but the following doubts is still exist:&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo/339649#339649"]NRF_BLE_GQ_GATTC_WRITE_MAX_DATA_LEN is set the max. payload length for your write commands[/quote]
&lt;p&gt;Does it mean that the payload length of all packets, or one packet?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;also what is the relationship between&amp;nbsp;&lt;span&gt;NRF_BLE_GQ_DATAPOOL_ELEMENT_COUNT&amp;nbsp;and&amp;nbsp;NRF_BLE_GQ_DATAPOOL_ELEMENT_SIZE? could you give me an example? such as&amp;nbsp;NRF_BLE_GQ_DATAPOOL_ELEMENT_COUNT=8,NRF_BLE_GQ_DATAPOOL_ELEMENT_SIZE=20. what does it mean? it means that the total payload length is 8*20 =160 bytes?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;thanks in advance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/thread/339649?ContentTypeID=1</link><pubDate>Thu, 18 Nov 2021 13:09:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b07caa50-7640-45ad-83b0-a6c718d7e5c4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The time it takes to transmit and and receive the packet does not map 1:1 with the required event length because there&amp;#39;s additional overhead such as post processing that need to be accounted for as well. We have not documented a formula which covers all scenarios (is not as easy as it may sound). Instead we have made the Softdevice notify the application when the event length is too short for a given packet length as you have seen.&lt;/p&gt;
[quote userid="21601" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo/339476#339476"]got it, I still would like to know what is the difference&amp;nbsp;between&amp;nbsp;GATT queue and &lt;span&gt;write_cmd_tx_queue_size&amp;nbsp;&lt;/span&gt;? could you help me clarify?[/quote]
&lt;p&gt;It makes a bit more sense to use the &lt;span class="item"&gt;&lt;a class="" title="BLE GATT Queue" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_ble_gatt_queue.html?cp=8_1_3_2_10"&gt;BLE GATT Queue&lt;/a&gt;&lt;/span&gt; module when you&amp;#39;re doing GATT procedures that can&amp;#39;t run in parallel. For instance, write requests where you have to wait for the write response before the Softdevice allows you to queue up the next.&lt;/p&gt;
&lt;p&gt;&lt;span class="item"&gt;&lt;a class="" title="sd_ble_gattc_write" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/group___b_l_e___g_a_t_t_c___f_u_n_c_t_i_o_n_s.html?cp=4_7_4_1_2_2_2_11#ga90298b8dcd8bbe7bbe69d362d1133378"&gt;sd_ble_gattc_write&lt;/a&gt;&lt;/span&gt;() already lets you add &amp;#39;write_cmd_tx_queue_size&amp;#39; number of write command packets to the Softdevice&amp;#39;s output buffer, so you typically don&amp;#39;t need to keep an additional buffer in the app, which basically is what GATT Queue provides.&lt;/p&gt;
&lt;p&gt;If you want to use the queue module you need to make sure NRF_BLE_GQ_GATTC_WRITE_MAX_DATA_LEN is set the max. payload length for your write commands. NRF_BLE_GQ_DATAPOOL_ELEMENT_COUNT will determine the max. number of packets you can queue up.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/thread/339476?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 15:06:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0046727-75d6-45e9-94d8-ffb4c52f92fd</guid><dc:creator>xiaolongba</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo/339445#339445"]My suggestion was to increase the output buffer in the Softdevice rather than increasing the GATT queue module. The write_cmd_tx_queue_size specifies the number of packets (the Softdevice accounts for the max. packet here) you can place in the Softdevice queue.[/quote]
&lt;p&gt;got it, I still would like to know what is the difference&amp;nbsp;between&amp;nbsp;GATT queue and &lt;span&gt;write_cmd_tx_queue_size&amp;nbsp;&lt;/span&gt;? could you help me clarify?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo/339445#339445"]Please take a look at the &amp;quot;&lt;span&gt;&lt;a title="Suggested intervals and windows" href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/multilink_scheduling/suggested_intervals_windows_s132.html?cp=4_7_4_0_14_9"&gt;Suggested intervals and windows&lt;/a&gt;&lt;/span&gt;&amp;quot; section of the Softdevice specification.[/quote]
&lt;p&gt;Actually, I looked into this section. but I still can not get the correct value. to explain more clear, let me give you an example, as below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;in my case, the&amp;#160;NRF_SDH_BLE_GAP_DATA_LENGTH is 251bytes,&amp;#160;while&amp;#160;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;#160;is 4.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;based on this configuration, the softdevice told me the following error info:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;The requested TX/RX packet length is too long by 16 octets&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;also, I checked Bluetooth spec, the LL data is (251+14)*8 = 2120 us if&amp;nbsp;&lt;strong&gt;NRF_SDH_BLE_GAP_DATA_LENGTH&lt;span&gt;&amp;nbsp;is 251 octets and the 1M PHY,&lt;/span&gt;&lt;/strong&gt;&lt;span&gt; so the CE_Length_measured is (2120 + 2120+2*T_IFS) = 4540us, while the&amp;nbsp;&lt;strong&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH is 4,&amp;nbsp;&lt;/strong&gt;so the CE_LENGTH is 4*1.25ms = 5ms, it should cover 4540us, but the sd still reported me the error info, that is&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;The requested TX/RX packet length is too long by 16 octets&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;so I want to know how to get these 16 octets based on the configuration I mentioned above. could you give me a hand, It took me lots of time recently, so your great support is very useful for me.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;thanks again, bro.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/thread/339445?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 13:35:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:551f0fbc-4951-432c-bcc8-4ac6462c1fd3</guid><dc:creator>Vidar Berg</dc:creator><description>[quote user="xiaolongba"]for queue size, is it only for write cmds cache, without payload? but as you know, each write cmd will carry some payload, such as 200 bytes. which parameters are used for these payload caches? I don&amp;#39;t know if I explained clearly, in other words, there is one write cmd with 200bytes payload, and queue size can cover the cmd and payload together[/quote]
&lt;p&gt;My suggestion was to increase the output buffer in the Softdevice rather than increasing the GATT queue module. The write_cmd_tx_queue_size specifies the number of packets (the Softdevice accounts for the max. packet here) you can place in the Softdevice queue.&lt;/p&gt;
[quote user="xiaolongba"]how to calculate it. could you share the formula for it?[/quote]
&lt;p&gt;Please take a look at the &amp;quot;&lt;span&gt;&lt;a title="Suggested intervals and windows" href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/multilink_scheduling/suggested_intervals_windows_s132.html?cp=4_7_4_0_14_9"&gt;Suggested intervals and windows&lt;/a&gt;&lt;/span&gt;&amp;quot; section of the Softdevice specification. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/thread/338935?ContentTypeID=1</link><pubDate>Mon, 15 Nov 2021 08:55:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e20d73bc-2f84-49f2-86d2-770835d304a7</guid><dc:creator>xiaolongba</dc:creator><description>&lt;p&gt;Hello Victor Bro,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Based on the issue above, I would like to ask you another question about it. as you know, I tried to optimize the max throughput based on the solution above but found that the following warning has been triggered:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;The requested TX/RX packet length is too long by 16 octets&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;in my case, the&amp;nbsp;&lt;strong&gt;NRF_SDH_BLE_GAP_DATA_LENGTH is 251bytes, &lt;/strong&gt;while&amp;nbsp;&lt;strong&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp;&lt;/strong&gt;&lt;strong&gt;is 4.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;also I understood how to fix this warning, that is to increase the&amp;nbsp;&lt;strong&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH &lt;/strong&gt;value from 4 to 5,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;However, I would like to know where are&amp;nbsp;16 bytes coming from? how to calculate it. could you share the formula for it? I need your help, Bro.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thanks in advance.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/thread/338594?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2021 13:57:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55c3545b-134f-4054-b1a0-3dbecef9230f</guid><dc:creator>xiaolongba</dc:creator><description>&lt;p&gt;Hello Bro,&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo/338557#338557"]Are you sure you are performing &lt;span&gt;&lt;a title="GATTC Characteristic or Descriptor Value Reliable Write" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/group___b_l_e___g_a_t_t_c___v_a_l_u_e___r_e_l_i_a_b_l_e___w_r_i_t_e___m_s_c.html?cp=4_7_4_1_2_2_3_5"&gt;GATTC Characteristic or Descriptor Value Reliable Write&lt;/a&gt;&lt;/span&gt; (aka write requests) and not &lt;span&gt;&lt;a title="GATTC Characteristic Value Write Without Response" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/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_7_4_1_2_2_3_2"&gt;GATTC Characteristic Value Write Without Response&lt;/a&gt;&lt;/span&gt; (aka write commands). Write requests will lead to a considerably lower throughput because you can&amp;#39;t issue multiple write requests in parallel (the stack needs to wait for the write response to come back before issuing a new request).&amp;nbsp; This effectively limits you to write per connection event.&amp;nbsp;&amp;nbsp;[/quote]
&lt;p&gt;I used the write commands, sorry for the misunderstanding.&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo/338557#338557"]&lt;p&gt;1. As mentioned above, it&amp;#39;s not possible to send multiple write requests in one connection event.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;I can get your point,&amp;nbsp;&lt;/p&gt;
[quote userid="21601" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo"]I used the gatt queue lib for this case, the default queue length is 4, that means SD can hold 4 write requests. I assumed that the SD received 4&amp;nbsp;&lt;span&gt;write requests before the next connection event is coming, so the SD can transmit these 4 write requests one by one when the connection event has come (CE length is enough).&amp;nbsp; am I correct?&lt;/span&gt;[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;but I used the write cmd. so for this situation, my understanding above if it is correct？&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/81618/gatt-queue-how-to-configure-the-stack-fifo/338557#338557"]2. An easier way to deal with this, assuming you use write commands, is to increase the write_cmd_tx_queue_size (see this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/53233/about-nrf_error_resources"&gt;post&lt;/a&gt;). This defines the number of packets you can add to the Softdevice&amp;#39;s write output buffer.[/quote]
&lt;p&gt;I have checked this link, also I understood that it is used for high throughput when increasing the queue size, but what I was confused about is :&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;for queue size, is it only for write cmds cache, without payload? but as you know, each write cmd will carry some payload, such as 200 bytes. which parameters are used for these payload caches? I don&amp;#39;t know if I explained clearly, in other words, there is one write cmd with 200bytes payload, and queue size can cover the cmd and payload together?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 【GATT Queue】How to Configure the stack FIFO</title><link>https://devzone.nordicsemi.com/thread/338557?ContentTypeID=1</link><pubDate>Thu, 11 Nov 2021 12:13:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:865ce5a7-55a4-4d7a-9f30-5bb0a4b4df7e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Are you sure you are performing &lt;span&gt;&lt;a title="GATTC Characteristic or Descriptor Value Reliable Write" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/group___b_l_e___g_a_t_t_c___v_a_l_u_e___r_e_l_i_a_b_l_e___w_r_i_t_e___m_s_c.html?cp=4_7_4_1_2_2_3_5"&gt;GATTC Characteristic or Descriptor Value Reliable Write&lt;/a&gt;&lt;/span&gt; (aka write requests) and not &lt;span&gt;&lt;a title="GATTC Characteristic Value Write Without Response" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/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_7_4_1_2_2_3_2"&gt;GATTC Characteristic Value Write Without Response&lt;/a&gt;&lt;/span&gt; (aka write commands). Write requests will lead to a considerably lower throughput because you can&amp;#39;t issue multiple write requests in parallel (the stack needs to wait for the write response to come back before issuing a new request).&amp;nbsp; This effectively limits you to write per connection event.&amp;nbsp;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;1. As mentioned above, it&amp;#39;s not possible to send multiple write requests in one connection event.&lt;/p&gt;
&lt;p&gt;2. An easier way to deal with this, assuming you use write commands, is to increase the write_cmd_tx_queue_size (see this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/53233/about-nrf_error_resources"&gt;post&lt;/a&gt;). This defines the number of packets you can add to the Softdevice&amp;#39;s write output buffer.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>