<?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>NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89888/ncs-nordic-uart-service-bt-rx-hci-timeout</link><description>Hi! I am working on a customer project where up to 20 BLE peripherals are connected to a single central device. The code of the central is based on the Multi-NUS sample from this Nordic-Blog-Post and has been updated to NCS Version v2.0.0. 
 The NUS client</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Aug 2022 14:33:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89888/ncs-nordic-uart-service-bt-rx-hci-timeout" /><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/379752?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2022 14:33:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e2e5d36-1269-4e43-8dd2-2656c073b059</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;I have created a simplified version to reproduce the problem. Here is the link to the private case:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/support/293262"&gt;devzone.nordicsemi.com/.../293262&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/378235?ContentTypeID=1</link><pubDate>Fri, 22 Jul 2022 08:09:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81b614a3-d76e-40f9-a298-0db4e9684ca7</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Please create a new Private case to share the source code. Please send me here the link to the case after you create it.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/378220?ContentTypeID=1</link><pubDate>Fri, 22 Jul 2022 06:51:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a13128ee-552c-4ddd-9727-7596dbd5a1ed</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;Thank you very much!&lt;br /&gt;&lt;br /&gt;I will try to create a simplified version of my code. The&amp;nbsp;code is for a customer project and cannot be published. How should I provide the sample code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/378112?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2022 13:19:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf26726c-0962-41a9-8427-cef31c3d8ff2</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Thomas,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;We will need to wait for patch for those issues I linked to. We will work on it shortly.&amp;nbsp;&lt;br /&gt;If you can provide a simplified version of your code that we can reproduce the issue here it would be great (both central and peripheral code)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/378044?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2022 10:39:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:944676f7-1628-4c03-a738-86a13d19a37e</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;At maximum request rate (without delay between requests) the problem is reproducible even with a connection interval of 75 ms.&lt;br /&gt;&lt;br /&gt;I have tried to increase the &lt;span&gt;CONFIG_BT_L2CAP_TX_BUF_COUNT&amp;nbsp; &lt;/span&gt;to 128, which seems to improve the situation somewhat, but does not solve the problem. I think the problem is more related to the RX buffering since the uplink traffic and payload size from the peripheral to the central is much higher.&lt;br /&gt;&lt;br /&gt;A note on the threading context, the bt_nus_client_send() function is called from a separate thread which has thread priority 7.&lt;br /&gt;&lt;br /&gt;Do you have any further suggestions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/377452?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2022 14:40:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b996b1b7-ed1d-44e7-a946-31ee0337b559</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Here is another related issue:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/34600"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/34600&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Could you try the suggested workaround by increasing&amp;nbsp;&lt;span&gt;CONFIG_BT_L2CAP_TX_BUF_COUNT&amp;nbsp; and&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;CONFIG_BT_L2CAP_TX_BUF_COUNT ? Try, say 128.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Of course the draw back is the RAM consumption.&amp;nbsp;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/377448?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2022 14:14:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a6a3b1b-ce1a-4145-9715-5bc2672e8752</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Thomas,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We are suspecting you are having the same issue as reported here:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/25917#issuecomment-639348125"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/25917#issuecomment-639348125&lt;/a&gt;&lt;br /&gt;I&amp;#39;m checking if there is any workaround.&amp;nbsp;&lt;br /&gt;Could you confirm that at 75ms interval , the problem is not reproducible ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/377372?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2022 09:10:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73dd33f2-6d2f-4906-9d93-a0a79bc8d63f</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;Thank you!&lt;br /&gt;&lt;br /&gt;The CONFIG_ASSERT option is already set in an overlay file for my&amp;nbsp;debug build and the error above is from a&amp;nbsp;debug build.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Optimize for debug
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_DEBUG_THREAD_INFO=y
CONFIG_ASSERT=y

# Enable Thread awareness for Debugging in Segger Ozone
CONFIG_THREAD_ANALYZER=y
CONFIG_THREAD_NAME=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I have tested&amp;nbsp;&lt;span&gt;bt_gatt_write_without_response() and&amp;nbsp;it shows the same behaviour as bt_gatt_write_without_response_cb(). It only works with reduced request rate.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;br /&gt;I have also tested&amp;nbsp;disabling the BT scanner when maximum number of 20 connections are established. And added&amp;nbsp;a log message when the tx_ctx get released in the on_sent_wo_rsp() method. Unfortunately, the app crashes in the same way. Here ist the log output.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1658138987178v1.png" alt=" " /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/377196?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2022 12:25:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9794a2da-ea7b-4369-a2b7-3ee1096e49bd</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Thomas,&amp;nbsp;&lt;br /&gt;I&amp;#39;m checking internally to see if R&amp;amp;D has any advice on this.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Have you checked if you use&amp;nbsp;bt_gatt_write_without_response() do you have any issue ?&amp;nbsp;&lt;br /&gt;I suspecting there is a messing up when the central waiting for the response from each of the peripheral.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Please try with CONFIG_ASSERT=y so we have more log.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/376953?ContentTypeID=1</link><pubDate>Thu, 14 Jul 2022 12:42:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f794e890-bd16-4177-a2bb-b86ffbb02bae</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;Thanks for the quick reply, I have tested your suggestion.&amp;nbsp;&lt;/p&gt;
&lt;p style="font-family:Calibri;font-size:11.0pt;margin:0in;" lang="de"&gt;&lt;br /&gt;I think it is good to describe the problem in more detail. The connected peripherals have a continuous data stream to the centrail, and the error occurs when a user-initiated request is sent from the central to the connected peripherals and they respond. The error occur imedently after the request is sent, I think when the response is received.&lt;/p&gt;
&lt;p style="font-family:Calibri;font-size:11.0pt;margin:0in;" lang="de"&gt;&lt;/p&gt;
&lt;p style="font-family:Calibri;font-size:11.0pt;margin:0in;" lang="de"&gt;To reduce the rate of sending data from each of the peripherals down, I have reduced the request rate by inserting a 200 ms delay between the requests.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;The Firmware runs on two different systems with different configurations. Here are the configuration and test results:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;System 1:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;connection interval 75 ms (min &amp;amp; max)&lt;/li&gt;
&lt;li&gt;packet generation with fixed rate of ~3.5 Hz
&lt;ul&gt;
&lt;li&gt;approx. 220 packets per minute&lt;/li&gt;
&lt;li&gt;approx. 6 kbit/s per connection&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;scan parameters:
&lt;ul&gt;
&lt;li&gt;Intervall: 500 ms&lt;/li&gt;
&lt;li&gt;Window: 40 ms&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Test 1 - Reduced request rate: works with a request delay of 200 ms for 20 connections&lt;/li&gt;
&lt;li&gt;Test 2 - CONFIG_BT_CTLR_RX_BUFFERS=10: does not work&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;System 2:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;connection interval 25 ms (min &amp;amp; max)&lt;/li&gt;
&lt;li&gt;none deterministic packet generation&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;approx. 40 packets per minute&lt;/li&gt;
&lt;li&gt;approx. 0.4 kbit/s per connection&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;scan parameters:
&lt;ul&gt;
&lt;li&gt;Intervall: 250 ms&lt;/li&gt;
&lt;li&gt;Window: 31.25 ms&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Test 1 - Reduced request rate: &lt;span lang="de"&gt; does not work (&lt;/span&gt;request delay of 200 ms)&lt;/li&gt;
&lt;li&gt;Test 2 - CONFIG_BT_CTLR_RX_BUFFERS=10:&lt;span lang="de-AT"&gt;&lt;/span&gt;&lt;span lang="de"&gt; does not work&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span lang="de"&gt;Error occur more often than with system 1&lt;br /&gt;&lt;/span&gt;&lt;span lang="de"&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span lang="de"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="de"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="de"&gt;Or could it somehow be related with the context management in my multi-NUS service implementation. This function is called when a request is sent to the connected devices.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;int multi_nus_t::send_broadcast(uint8_t* buf, size_t len) {
    int err = 0;

    /* How many connections are there in the Connection Context Library */
    const size_t num_nus_conns = bt_conn_ctx_count(&amp;amp;conns_ctx_lib);

    LOG_DBG(&amp;quot;Send Broadcast&amp;quot;);
    for (size_t i = 0; i &amp;lt; num_nus_conns; i++) {
        const struct bt_conn_ctx* ctx = bt_conn_ctx_get_by_id(&amp;amp;conns_ctx_lib, i);

        if (ctx) {
            struct bt_nus_client* nus_client = (bt_nus_client*) ctx-&amp;gt;data;

            if (nus_client) {
                // copy payload so it persists throught the BLE stack
                uint8_t* ble_data = (uint8_t*) k_malloc(len);

                if (ble_data == NULL) {
                    LOG_ERR(&amp;quot;Could not allocate broadcast data connection %d&amp;quot;, i);
                    goto release_ctx;
                }
                memcpy(ble_data, buf, len);

                err = bt_nus_client_send(nus_client, ble_data, len);
                if (err) {
                    LOG_ERR(&amp;quot;Failed to send data over BLE connection %d (err %d)&amp;quot;, i, err);
                    // return the semaphore as sending was not successful
                    k_free(ble_data);
                } else {
                    LOG_INF(&amp;quot;Sent broadcast to connection %d: %d bytes&amp;quot;, i, len);
                    k_msleep(200); // delay to reduce the request rate
                }
            }
            release_ctx:
            bt_conn_ctx_release(&amp;amp;conns_ctx_lib, (void*) ctx-&amp;gt;data);
        }
    }
    return err;
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you have any further suggestions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS Nordic UART service: BT RX HCI timeout</title><link>https://devzone.nordicsemi.com/thread/376779?ContentTypeID=1</link><pubDate>Wed, 13 Jul 2022 12:18:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09869f4a-97b4-40c2-a216-6fa9d4b246b6</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Thomas,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;To isolate the issue if it&amp;#39;s a memory overflow issue or not, could you try to reduce the rate of sending data from each of the peripheral down and check if you can handle above 10&amp;nbsp; connections ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Could you also try to increase&amp;nbsp;CONFIG_BT_CTLR_RX_BUFFERS to 10 for example ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please provide the information on:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;- Connection interval&lt;/p&gt;
&lt;p&gt;- How long it would take for the error to occur ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>