<?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>Why do I need to enqueue three notifications to achieve optimal throughput?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93972/why-do-i-need-to-enqueue-three-notifications-to-achieve-optimal-throughput</link><description>In my application, we regularly transmit a stream of notifications from a Peripheral Server to a Central Client. The general strategy for this is to enqueue a packet, and then wait for a BLE_GATTS_EVT_HVN_TX_COMPLETE to enqueue another one. I have noticed</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Nov 2022 12:44:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93972/why-do-i-need-to-enqueue-three-notifications-to-achieve-optimal-throughput" /><item><title>RE: Why do I need to enqueue three notifications to achieve optimal throughput?</title><link>https://devzone.nordicsemi.com/thread/396206?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2022 12:44:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef0b96f7-e4c0-4971-a30c-896289c62a3c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In bluetooth you can send an arbitrary number of&amp;nbsp;notifications in the same connection event, as long as there is enough remaining time, and the&amp;nbsp;GATT server has more data to send. A key here though is that the serve must already have buffered the next packet so that it can set the more data flag in the current packet, indicating that there is more data to send. So you must have queued at least on extra packet. If not, the connection event will end after the current packet.&lt;/p&gt;
&lt;p&gt;This leads to a few important points:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You need to queue data a decent time in advance. If you queue only 2, you need to be sure to queue a new backed before the stack starts processing the second packet, and this can be tight.&lt;/li&gt;
&lt;li&gt;The throughput you loose by not queuing enough packets depends on the length of the connection event, as you will effectively loose the rest of the event. If the connection event (and connection interval) was very long, you could see an even&amp;nbsp;greater reduction in throughput than what you have seen.&lt;/li&gt;
&lt;/ul&gt;
[quote user=""]1.&amp;nbsp;Why am I allowed to enqueue three packets at all?[/quote]
&lt;p&gt;This is related to the buffer available in the SoftDevice. A long time ago the SoftDevice had a bandwidth configuration, which effectively adjusted the number of buffers (and thus RAM usage) in the SoftDevice. This has changed and with recent SoftDevices the memory usage and buffers are selected based on the event length configuration.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>