<?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>SoftDevice configuration for greater throughput using notification and multiple connections</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38682/softdevice-configuration-for-greater-throughput-using-notification-and-multiple-connections</link><description>Hi! 
 We are using the nRF52840 and nRF52832 for a product for which good data throughput over BLE is required. (We have picked the S140 and S132). 
 We send these data using notification only (max 20 byets). (It is a two way data transfer) 
 We try not</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 21 Sep 2018 08:11:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38682/softdevice-configuration-for-greater-throughput-using-notification-and-multiple-connections" /><item><title>RE: SoftDevice configuration for greater throughput using notification and multiple connections</title><link>https://devzone.nordicsemi.com/thread/149768?ContentTypeID=1</link><pubDate>Fri, 21 Sep 2018 08:11:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f0bca7a-56bf-4ffd-81c5-b1bce690f3b8</guid><dc:creator>Saeed Ghasemi</dc:creator><description>&lt;p&gt;Hi Torbj&amp;ouml;rn!&lt;/p&gt;
&lt;p&gt;This is all good news! I&amp;nbsp;got all I was looking for.&lt;/p&gt;
&lt;p&gt;Thank you very much for your time.&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Saeed Ghasemi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice configuration for greater throughput using notification and multiple connections</title><link>https://devzone.nordicsemi.com/thread/149764?ContentTypeID=1</link><pubDate>Fri, 21 Sep 2018 08:01:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9f2bd07-51d4-4894-a9fc-bf4f001400e2</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Saeed&lt;/p&gt;
&lt;p&gt;[quote user="basetutu"][/quote]&lt;/p&gt;
&lt;p&gt;This is very good. But how does it interplay with the connection interval settings.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I mean, if the &lt;span&gt;GAP_EVENT_LENGTH is long compared to the&amp;nbsp;&lt;/span&gt;connection interval.
&lt;ul&gt;
&lt;li&gt;What is the expected outcome?
&lt;ul&gt;
&lt;li&gt;Shortened GAP_EVENT_LENGTH, possibly?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you only have one link this is not a problem. The GAP_EVENT_LENGTH will be capped to the length of the connection interval (CI).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you have multiple links&amp;nbsp;and you want to ensure that all links get a similar throughput you don&amp;#39;t want the GAP_EVENT_LENGTH to be larger than the connection interval divided by the number of links.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As an example, say you have a CI of 10ms and two links you should set the GAP_EVENT_LENGTH to 4, which means each link gets 5ms (4*1.25ms).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;[quote user="basetutu"][/quote]&lt;/p&gt;
&lt;p&gt;And this is the core of my question. I understand from your answer that you have removed the limitation on how many packets we can send to stack by enabling on-the-fly &amp;#39;push to stack&amp;#39; during a connection interval. I would like to extend and control the amount of packets the stack can accept before returning&amp;nbsp;&lt;span&gt;NRF_ERROR_RESOURCES, and thereby not rely on the context switch speed when receiving&amp;nbsp;the BLE_GATTS_EVT_HVN_TX_COMPLETE. We would like to reduce this racing condition and do burst&amp;nbsp;&amp;#39;pushes&amp;#39; to stack if possible.&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;I am looking for the config option that sets the size of the internal stack buffer.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Discussing this with the SoftDevice guys it appears the internal buffer will be sized according to the event length that you set, to ensure that you can preload all the packets for the next connection event. In other words you are not required to upload packets during the event to maximize the throughput.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;[quote user="basetutu"][/quote]&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Assuming that current CI is for peer_1:&amp;nbsp;&lt;/span&gt;I understand this as, the stack is not searching the stack buffer array for more packet destined for peer_1, but transmits the packets in the order as they were pushed to the stack. This makes the stack wait until the CI for peer_2 begins before doing yet another TX if the next packet is for peer_2 while still having packets in queue for peer_1. Correct?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;You suggests that we can optimize this by sending packets&amp;nbsp;belonging to the same peer in a row as a workaround. (So that they are sorted in the stack buffer) ?&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;span&gt;If correctly understood, this seems reasonable.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am not quite sure I understand the question, but each connection will have a separate packet queue/buffer. At what time you upload packets to the buffer for peer_1 and peer_2 doesn&amp;#39;t really matter, as long as you&amp;nbsp;fill each buffer before the corresponding connection event occurs.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Since the connection events for peer_1 and peer_2 will occur in a round robin fashion, your packet upload code will probably do the same.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice configuration for greater throughput using notification and multiple connections</title><link>https://devzone.nordicsemi.com/thread/149624?ContentTypeID=1</link><pubDate>Thu, 20 Sep 2018 11:43:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31dda1c4-4f7d-44b0-a7a7-bfc2b2637576</guid><dc:creator>Saeed Ghasemi</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/ovrebekk"&gt;ovrebekk&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thank you for the quick response. Highly appreciated.&lt;/p&gt;
&lt;p&gt;Regarding the DLE, I totally agree with you and this is considered for the optimization phase. Our issue is that when DLE is enabled in SoftDevice, we have previously had crashes when pairing with Samsung Android 7.0 devices which required us to disable the DLE as a workaround, due to a Samsung issue. I&amp;#39;m not sure if this is true for&amp;nbsp;the latest SoftDevices.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/38682/softdevice-configuration-for-greater-throughput-using-notification-and-multiple-connections/149605"]&lt;p&gt;The only limiting factor now is the event length, set by the&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH define in sdk_config.h, and whatever&amp;nbsp;limit there is in the peer.&amp;nbsp;&lt;/p&gt;&lt;p&gt;If you only send 20 byte packets then an event length of 3 (leading to maximum event duration of 3.75ms) should be sufficient for at least 6 packets in one direction.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is very good. But how does it interplay with the connection interval settings.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I mean, if the &lt;span&gt;GAP_EVENT_LENGTH is long compared to the&amp;nbsp;&lt;/span&gt;connection interval.
&lt;ul&gt;
&lt;li&gt;What is the expected outcome?
&lt;ul&gt;
&lt;li&gt;Shortened GAP_EVENT_LENGTH, possibly?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
[quote userid="2116" url="~/f/nordic-q-a/38682/softdevice-configuration-for-greater-throughput-using-notification-and-multiple-connections/149605"]While we originally had a fixed set of buffers determining the maximum number of packets you are now able to upload data continuously during the connection event,[/quote]
&lt;p&gt;We can&amp;#39;t assume to make it in time and not mis the CI due to context switch, even with highest priority on the thread pushing packets to stack. The idea is to push a predetermined amount of packets to stack and not react &amp;#39;critically&amp;#39; to the ble events and only push in burst mode before the stack buffer is completely transmitted.&lt;/p&gt;
[quote userid="2116" url="~/f/nordic-q-a/38682/softdevice-configuration-for-greater-throughput-using-notification-and-multiple-connections/149605"]The general recommendation for maximizing data throughput is to upload as many packets as possible until the NRF_ERROR_RESOURCES error is returned, wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE event to occur, and then repeat the process.[/quote]
&lt;p&gt;And this is the core of my question. I understand from your answer that you have removed the limitation on how many packets we can send to stack by enabling on-the-fly &amp;#39;push to stack&amp;#39; during a connection interval. I would like to extend and control the amount of packets the stack can accept before returning&amp;nbsp;&lt;span&gt;NRF_ERROR_RESOURCES, and thereby not rely on the context switch speed when receiving&amp;nbsp;the BLE_GATTS_EVT_HVN_TX_COMPLETE. We would like to reduce this racing condition and do burst&amp;nbsp;&amp;#39;pushes&amp;#39; to stack if possible.&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;I am looking for the config option that sets the size of the internal stack buffer.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
[quote userid="2116" url="~/f/nordic-q-a/38682/softdevice-configuration-for-greater-throughput-using-notification-and-multiple-connections/149605"]This doesn&amp;#39;t really change when running multiple links. For example you can start by maxing out the buffers for peer_1, and then start sending packets to peer_2 once the NRF_ERROR_RESOURCES error occurs for peer_1.&amp;nbsp;[/quote]
&lt;p&gt;&lt;span&gt;I think I understand! But to verify:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Assuming that current CI is for peer_1:&amp;nbsp;&lt;/span&gt;I understand this as, the stack is not searching the stack buffer array for more packet destined for peer_1, but transmits the packets in the order as they were pushed to the stack. This makes the stack wait until the CI for peer_2 begins before doing yet another TX if the next packet is for peer_2 while still having packets in queue for peer_1. Correct?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;You suggests that we can optimize this by sending packets&amp;nbsp;belonging to the same peer in a row as a workaround. (So that they are sorted in the stack buffer) ?&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;span&gt;If correctly understood, this seems reasonable.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SoftDevice configuration for greater throughput using notification and multiple connections</title><link>https://devzone.nordicsemi.com/thread/149605?ContentTypeID=1</link><pubDate>Thu, 20 Sep 2018 10:33:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:247f004a-2f0a-4bca-9c99-438613616c81</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;First off I would say that you should expect a big hit to performance if you don&amp;#39;t use DLE. Most modern phones support this, and&amp;nbsp;you might want to do some testing to verify if it&amp;#39;s worth it to lose that speed for a more consistent experience. The SoftDevice should revert to not using DLE if the peer doesn&amp;#39;t support it, and a completely consistent experience won&amp;#39;t happen even if DLE is disabled as some phones will handle more packets than others.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When it comes to the number of packets per CI supported by the SoftDevice this has changed quite a bit in recent versions. While we originally had a fixed set of buffers determining the maximum number of packets you are now able to upload data continuously during the connection event, essentially removing any limit on how many packets you can send. The only limiting factor now is the event length, set by the&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH define in sdk_config.h, and whatever&amp;nbsp;limit there is in the peer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you only send 20 byte packets then an event length of 3 (leading to maximum event duration of 3.75ms) should be sufficient for at least 6 packets in one direction.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The general recommendation for maximizing data throughput is to upload as many packets as possible until the NRF_ERROR_RESOURCES error is returned, wait for the BLE_GATTS_EVT_HVN_TX_COMPLETE event to occur, and then repeat the process.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This doesn&amp;#39;t really change when running multiple links. For example you can start by maxing out the buffers for peer_1, and then start sending packets to peer_2 once the NRF_ERROR_RESOURCES error occurs for peer_1.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>