<?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>Extremely Slow BLE Throughput on the nRF52840, using the BMD-340</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66527/extremely-slow-ble-throughput-on-the-nrf52840-using-the-bmd-340</link><description>Hi all, 
 We are using the BMD-340 from uBlox, which runs the nRF52840 SoC. 
 On this BLE Peripheral, we are running the ble peripheral demo project ble_app_uart (pca10056), which has only been lightly modified for our uses. We are using the nRF device</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 01 Oct 2020 10:13:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66527/extremely-slow-ble-throughput-on-the-nrf52840-using-the-bmd-340" /><item><title>RE: Extremely Slow BLE Throughput on the nRF52840, using the BMD-340</title><link>https://devzone.nordicsemi.com/thread/272473?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2020 10:13:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c05d681-972a-4577-892a-48823366758f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The BLE_ERROR_GATTS_SYS_ATTR_MISSING error indicates that the FW app tried to send a notification right after connection before it had been re-enabled by the client. I see now that this is something that can happen with the ble_app_uart example because it doesn&amp;#39;t clear its internal &amp;quot;is_notification_enabled&amp;quot; flag on re-connect like it should. CCCD settings are only supposed to stay valid for the duration of a connection session when not bonded. I.e. notification(s) must always be re-enabled on re-connect.&lt;/p&gt;
&lt;p&gt;That said, it&amp;#39;s perfectly ok to call sd_ble_gatts_sys_attr_set() on connect, this will make it so that you get&amp;nbsp; NRF_ERROR_INVALID_STATE error which is ignored by default, instead of the BLE_ERROR_GATTS_SYS_ATTR_MISSING error you get when sys attributes are not initialized.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m more surprised about the disconnect. The softdevice stack has no problem to keep up with the incoming data so I&amp;#39;m wondering if there is something else that&amp;#39;s crashing in the app. Are you catching all code assertions with with the &lt;span class="item"&gt;&lt;a class="" title="Error module" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_error.html?cp=7_1_3_13"&gt;Error module? &lt;/a&gt;&lt;/span&gt;&lt;span class="item"&gt;As you can see from the link, the default error handling is to try recovering with a system reset. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="item"&gt;Cheers,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="item"&gt;Vidar&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="item"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extremely Slow BLE Throughput on the nRF52840, using the BMD-340</title><link>https://devzone.nordicsemi.com/thread/272376?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2020 16:27:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:334cbdba-80b6-4f69-835a-db27d18c8527</guid><dc:creator>tyrelkostyk</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your prompt and detailed response! It had been one of our main concerns that the ACK&amp;#39;ing of every packet was causing the low throughput - we just didn&amp;#39;t expect it to have such a dramatic impact.&lt;/p&gt;
&lt;p&gt;And yes, we have tried modifying the protocol to be &amp;quot;batch-based&amp;quot; - we tried ACKing only after receiving 4KB worth of payload data (32 packets). This meant our central device would blast out 32 155 byte packets, before the peripheral would respond with its 27 byte ACK. The issue with this was that we saw the BLE Peripheral (the BMD-340 with the nRF52840)&amp;nbsp; simply disconnect and crash... the initial fatal error we were seeing was a disconnect, then a reconnect attempt immediately followed by the&amp;nbsp;BLE_ERROR_GATTS_SYS_ATTR_MISSING. We resolved that by adding in:&lt;/p&gt;
&lt;p&gt;err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;After the&amp;nbsp;BLE_GAP_EVT_CONNECTED case within&amp;nbsp;ble_evt_handler(). Now, this resolved the crashing, however our BLE Peripheral was still sometimes disconnecting and reconnecting, and after the reconnect our&amp;nbsp;central and peripheral couldn&amp;#39;t communicate properly, despite the negotiation seemingly going smoothly. We lowered our batch size to only 10 packets instead of 32, which seemed to mostly resolve the issue - but we were still skeptical, since we lack an understanding of why this change worked, or why it even failed to begin with.&lt;/p&gt;
&lt;p&gt;Since&amp;nbsp;the purpose of&amp;nbsp;the BLE Peripheral in this context is to facilitate the file transfer for a bootloader, reliability was considered of utmost importance, and the strange (and very&amp;nbsp;unreliable) results we were seeing was considered not worth the risk, despite the improved throughput (we were seeing up to ~1.4KB on the Android tablet - didn&amp;#39;t test on the iPad Air 2). Do you have any suggestions or ideas that immediately come to your mind? I can recreate the problem again and give you a more detailed explanation, if that helps. I should also mention that we arbitrarily added a 5-10ms (we experimented) delay between each packet, since we were worried about &amp;quot;flooding&amp;quot; the GATT client with write notifications. But that didn&amp;#39;t seem to have any impact on the behavior.&lt;/p&gt;
&lt;p&gt;Thanks again Vidar! I&amp;#39;ll take a look at the throughput project you sent as well. I hope you have a&amp;nbsp;great rest of your&amp;nbsp;day.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Ty&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Extremely Slow BLE Throughput on the nRF52840, using the BMD-340</title><link>https://devzone.nordicsemi.com/thread/272328?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2020 13:17:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:031ae47b-5610-4c30-b354-a410334210fd</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thanks for your detailed problem description. &amp;nbsp;I actually think the &amp;quot;ACKing&amp;quot; of every 128-byte is what&amp;#39;s causing the main bottleneck - the central&amp;nbsp; will effectively be limited to sending 128 bytes of payload on every other connection event if it has to wait for the target to ACK the packet. First connection event to send the data, then the next to receive the ack, and so on.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t worked with this particular protocol, but is there a way you can increase the required ACK interval? In our DFU transport we usually compute and report the checksum once for every 4096-byte data object. And we are using the GATT write without response procedure for the data transfer (&lt;span class="item"&gt;&lt;a class="" title="GATTC Characteristic Value Write Without Response" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.2.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_3_1_2_2_3_2"&gt;GATTC Characteristic Value Write Without Response&lt;/a&gt;&lt;/span&gt;).&lt;/p&gt;
[quote user=""]For reference, when completing this process over a straight serial UART cable (115200 baud), we see a data rate of ~7.50-8.50KB/s.[/quote]
&lt;p&gt;&amp;nbsp;This is close to the same throughput we get with our BLE DFU implementation. It varies a bit depending on which phone is used.&lt;/p&gt;
&lt;p&gt;Also, I have modified the ble_app_uart example to measure notification throughput which is similiar to write without response except that it&amp;#39;s sent from the GATT server. It can be helpful if you want to play around with different connection paramaters and see what effect it has. All you have to do on the client side is to enable notifications (in nrf connect app or similiar). The nRF5 will log the measured transfer rate over RTT.&lt;/p&gt;
&lt;p&gt;Throughput test example:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf5_5F00_sdk_5F00_17.0.2-_2D00_-ble_5F00_app_5F00_uart_5F00_throughput.zip"&gt;devzone.nordicsemi.com/.../nrf5_5F00_sdk_5F00_17.0.2-_2D00_-ble_5F00_app_5F00_uart_5F00_throughput.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>