<?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>Having problem with low message rate with BLE Nus Service, help please.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/85958/having-problem-with-low-message-rate-with-ble-nus-service-help-please</link><description>Hello everyone, i am developing a board based on the nRF52832 microcontroller SDK v16.0.0 and sd132 for sending data of a sensor over BLE to a mobile APP. For this i am using the Nordic Uart Service but i am getting bad performance for it. 
 I started</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Mar 2022 15:05:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/85958/having-problem-with-low-message-rate-with-ble-nus-service-help-please" /><item><title>RE: Having problem with low message rate with BLE Nus Service, help please.</title><link>https://devzone.nordicsemi.com/thread/358912?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 15:05:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1bbd545-6b7e-4261-b0d8-90084ffcd754</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Yes you are correct. You can have a look at &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.3.0/group___b_l_e___g_a_t_t_s___h_v_n___m_s_c.html?cp=4_7_3_1_2_4_3_5"&gt;this sequence chart.&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Having problem with low message rate with BLE Nus Service, help please.</title><link>https://devzone.nordicsemi.com/thread/358905?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 14:33:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c64a7aa-a094-4dc1-ac28-8d937802ccb7</guid><dc:creator>Yeyzz</dc:creator><description>&lt;p&gt;Now i see what i am doing wrong, if i understand everything well, every interval the BLE stack send multiple packets and when a interval finish then a event with the&amp;nbsp;&lt;span&gt;BLE_NUS_EVT_TX_RDY occurs right? Right now i am sending one message and set a flag of Tx bussy, and dont send another message until BLE_NUS_EVT_TX_RDY occurs (where i reset the tx_bussy_flag), so basically i am sending 1 message per interval. I think the way to get the best performance is set the tx_bussy_flag when &amp;quot;ble_nus_data_send&amp;quot; return the error meaning the buffer is full.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Having problem with low message rate with BLE Nus Service, help please.</title><link>https://devzone.nordicsemi.com/thread/358899?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 14:16:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eef25c32-8303-4b9d-86b0-b6b63c40c891</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi again,&amp;nbsp;&lt;br /&gt;Yes the BLE stack can send multiple packets on every interval, as long as you can fully fill the buffer of the stack. And also the central need to support multiple packets per connection interval (most centrals support that)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Having problem with low message rate with BLE Nus Service, help please.</title><link>https://devzone.nordicsemi.com/thread/358875?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 13:13:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7920580-de46-4dfc-be3d-ba0079f37e06</guid><dc:creator>Yeyzz</dc:creator><description>&lt;p&gt;Yes, ble_nus_tx_is_ready() just return the tx_char_bussy bool. I was thinking in use the BLE_NUS_EVT_TX_RDY because the purpose of the board is stream data over long period of time, so if i constantly queue messages i can have a buffer overflow and loss data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Having problem with low message rate with BLE Nus Service, help please.</title><link>https://devzone.nordicsemi.com/thread/358872?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 13:03:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c3a5c6b-a891-4ed3-bf41-eada455e0257</guid><dc:creator>Yeyzz</dc:creator><description>&lt;p&gt;Update:&amp;nbsp;I had a significant improvement changing the maximun connection interval to MSEC_TO_UNITS(10, UNIT_1_25_MS)and get an average of 40 messages per second,&amp;nbsp; it seems like the maximun connection interval is the dominant for the peripheral,&amp;nbsp; but i am still not sure if is a good thing having the maximun connection interval this low,&amp;nbsp; i was thinking that the nrf can send multiple messages every interval but it seems it only can&amp;nbsp;send one or less than one.&amp;nbsp;&lt;/p&gt;
&lt;pre class="tw-data-text tw-text-large tw-ta" id="tw-target-text" dir="ltr"&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Having problem with low message rate with BLE Nus Service, help please.</title><link>https://devzone.nordicsemi.com/thread/358861?ContentTypeID=1</link><pubDate>Fri, 18 Mar 2022 12:52:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcb26474-cdf7-4c8d-bea9-8bda34e7b0ac</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Yeyzz,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I assume the function&amp;nbsp;ble_nus_tx_is_ready() will just return the value of&amp;nbsp;tx_char_bussy ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please note that the softdevice have several buffer slots to queue multiple message. So you would need to call&amp;nbsp;send_nus_data() multiple times until you receive NRF_ERROR_RESOURCE meaning the buffer is full.&amp;nbsp;&lt;br /&gt;Similarly, when you receive&amp;nbsp;BLE_NUS_EVT_TX_RDY (BLE_GATTS_EVT_HVN_TX_COMPLETE event) you may want to check how many packets have been sent (check the count variable inside&amp;nbsp;ble_gatts_evt_hvn_tx_complete_t) then you can queue the same number of packets to the softdevice. Or you can just call&amp;nbsp;&lt;span&gt;send_nus_data() multiple times until it&amp;#39;s full again.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If you can capture&lt;a href="https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-Bluetooth-LE"&gt; a sniffer trace&lt;/a&gt; and send to us we would be able to point out what you need to do to improve the throughput.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>