<?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>Increase max packets</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42559/increase-max-packets</link><description>Hi, 
 I&amp;#39;m using BLE on nrf52832 and softdevice s132. It seems that when I send too many packets (around 45), the ble crashes. Is there a way to increase that number or at least make it not crash? 
 Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 Mar 2019 10:03:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42559/increase-max-packets" /><item><title>RE: Increase max packets</title><link>https://devzone.nordicsemi.com/thread/173908?ContentTypeID=1</link><pubDate>Mon, 04 Mar 2019 10:03:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0422ec89-a0f2-4329-9ea1-115cc7833a0c</guid><dc:creator>Alaa</dc:creator><description>&lt;p&gt;Since I&amp;#39;m using another microcontroller (STM32) that communicates with the Nordic MCU, I eventually solved this by disabling the while loop of send-retry in nordic, and moving the retry process to the STM MCU.&lt;/p&gt;
&lt;p&gt;So I disabled the following loop condition:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;while (err_code == NRF_ERROR_RESOURCES);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;that tries to resend a failed message.&lt;/p&gt;
&lt;p&gt;Turns out when the error code is Not Enough Resources (19), the UART is busy, and so I get a &lt;strong&gt;HAL_BUSY&lt;/strong&gt; from &lt;strong&gt;HAL_UART_Transmit_IT()&lt;/strong&gt;. And then I just retry sending the message until it succeeds.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase max packets</title><link>https://devzone.nordicsemi.com/thread/165943?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 11:51:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:505fd02e-cfbc-4cb4-972b-d26b7bf5f023</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Connection interval&lt;/p&gt;
&lt;p&gt;MTU size&lt;/p&gt;
&lt;p&gt;Use the 2Mbps PHY (BLE 5&amp;nbsp;&lt;span&gt;High troughput mode)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="https://www.nordicsemi.com/Products/Low-power-short-range-wireless/Bluetooth-5"&gt;https://www.nordicsemi.com/Products/Low-power-short-range-wireless/Bluetooth-5&lt;/a&gt;&lt;br /&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;But remember that your Central (especially if it&amp;#39;s a phone or tablet) may impose limits ...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase max packets</title><link>https://devzone.nordicsemi.com/thread/165934?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 11:30:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4eca184-e86f-4891-af74-f69b3afa2822</guid><dc:creator>Alaa</dc:creator><description>&lt;p&gt;Can you tell me what parameters to adjust?&lt;/p&gt;
&lt;p&gt;I just tried adding a 500 ms delay after roughly 40 packets, and I&amp;#39;m not getting the error anymore.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase max packets</title><link>https://devzone.nordicsemi.com/thread/165933?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 11:27:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfd9799d-9715-4c08-8e74-b1699e244c8f</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Arbitrary delays are never a good idea.&lt;/p&gt;
&lt;p&gt;Better to look for a specific indication that the link again has capacity.&lt;/p&gt;
&lt;p&gt;If you are constantly hitting this, it indicates that you need to re-evaluate something - either send less data, or&amp;nbsp;adjust the link parameters to increase throughput&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase max packets</title><link>https://devzone.nordicsemi.com/thread/165927?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 11:16:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2f0aac1-cb08-4a6a-bbd5-50dd112f32bc</guid><dc:creator>Alaa</dc:creator><description>&lt;p&gt;Thanks for the response,&lt;/p&gt;
&lt;p&gt;I verified that the error that I&amp;#39;m getting is NRF_ERROR_RESOURCES.&lt;/p&gt;
&lt;p&gt;Regarding the capacity, let&amp;#39;s say maximum packets is 40 of size 20. Does that mean that if I send, say 40 packets of size 20, then wait some time, and then continue sending, it will work successfully? How much should the waiting time be?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase max packets</title><link>https://devzone.nordicsemi.com/thread/165842?ContentTypeID=1</link><pubDate>Tue, 15 Jan 2019 23:41:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4acd0214-7244-487f-bf66-798db23780c0</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;&lt;em&gt;&lt;strong&gt;You&lt;/strong&gt; &lt;/em&gt;need to investigate to see what happens immediately before the crash.&lt;/p&gt;
&lt;p&gt;Maybe you&amp;#39;re getting&amp;nbsp;NRF_ERROR_RESOURCES - that sounds a likely candidate, doesn&amp;#39;t it?&lt;/p&gt;
&lt;p&gt;Instrument your code to see what&amp;#39;s happening.&lt;/p&gt;
[quote userid="67195" url="~/f/nordic-q-a/42559/increase-max-packets/165831"]if I get this error, what can I do?[/quote]
&lt;p&gt;The link has a finite capacity - you can&amp;#39;t just keep chucking data at it over that capacity.&lt;/p&gt;
&lt;p&gt;Only you can decide what&amp;#39;s appropriate for your application in this situation&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;just discard excess data?&lt;/li&gt;
&lt;li&gt;if the data is &amp;quot;bursty&amp;quot;, buffer it somewhere?&lt;/li&gt;
&lt;li&gt;tell the STM32 to stop sending data?&lt;/li&gt;
&lt;li&gt;compress the data?&lt;/li&gt;
&lt;li&gt;decimate the data?&lt;/li&gt;
&lt;li&gt;adjust the link parameters to increase throughput?&lt;/li&gt;
&lt;li&gt;etc, etc, ...&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase max packets</title><link>https://devzone.nordicsemi.com/thread/165831?ContentTypeID=1</link><pubDate>Tue, 15 Jan 2019 19:31:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddc0af43-a136-4695-81a3-e409a7bee6a6</guid><dc:creator>Alaa</dc:creator><description>&lt;p&gt;NUS profile (uart).&lt;/p&gt;
&lt;p&gt;To clarify, the crash happens when I send data from microcontroller STM32 to the nordic nrf52 that&amp;#39;s connected to it via uart, and then send the data to a smartphone by BLE.&lt;/p&gt;
&lt;p&gt;What error should I get? I looked through the error codes (0 to 19) and I can&amp;#39;t find anything related to accepting packets.&lt;/p&gt;
&lt;p&gt;Also, if I get this error, what can I do?&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s some of the code inside&amp;nbsp;&lt;strong&gt;uart_event_handle()&lt;/strong&gt;&amp;nbsp;under the case &lt;strong&gt;APP_UART_DATA_READY&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;do
{
    uint16_t length = (uint16_t)index;
    err_code = ble_nus_string_send(&amp;amp;m_nus, data_array, &amp;amp;length);
    if ( (err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp; (err_code != NRF_ERROR_RESOURCES) )
    {
        APP_ERROR_CHECK(err_code);
    }
} while (err_code == NRF_ERROR_RESOURCES);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Or should I be looking somewhere else?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Increase max packets</title><link>https://devzone.nordicsemi.com/thread/165808?ContentTypeID=1</link><pubDate>Tue, 15 Jan 2019 16:03:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ea02335-e7c2-4eb0-a19d-6bf80d86d2a6</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;What BLE profile are you using - eg, NUS?&lt;/p&gt;
&lt;p&gt;You should get an error status telling you when the SD can&amp;#39;t accept more packets - are you paying attention to that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>