<?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>SDK14.1 Multilink with NUS data sent issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32624/sdk14-1-multilink-with-nus-data-sent-issue</link><description>I have refer to this topic for setup multilink with NUS. https://devzone.nordicsemi.com/f/nordic-q-a/18804/mismatch-between-connection-handles-in-ble_nus 
 But, i met a wrong &amp;#39;BLE_GATTC_EVT_HVX&amp;#39; event issue, below is the situation, i test with two peripheral</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Oct 2019 06:53:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32624/sdk14-1-multilink-with-nus-data-sent-issue" /><item><title>RE: SDK14.1 Multilink with NUS data sent issue</title><link>https://devzone.nordicsemi.com/thread/212717?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2019 06:53:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a417e755-99af-4908-b767-1f46438f24d9</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;You are correct. It was also reported in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/51367/ble_nus_c-possible-bug"&gt;this case.&lt;/a&gt;&amp;nbsp;It will be fixed in the next SDK release.&lt;/p&gt;
[quote userid="83797" url="~/f/nordic-q-a/32624/sdk14-1-multilink-with-nus-data-sent-issue/212663"]BTW Is there an official GitHub repository for the SDK to submit pull requests?[/quote]
&lt;p&gt;Unfortunately, no.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK14.1 Multilink with NUS data sent issue</title><link>https://devzone.nordicsemi.com/thread/212663?ContentTypeID=1</link><pubDate>Mon, 30 Sep 2019 15:26:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01b548e2-4a6c-4541-b0b0-c13ae495d1db</guid><dc:creator>Martin</dc:creator><description>&lt;p&gt;I got exactly the same problem with the SDK 15.3.0 and I think I found the root cause.&lt;/p&gt;
&lt;p&gt;It looks like there is a bug within the &lt;em&gt;ble_nus_c.c&lt;/em&gt; at the &lt;em&gt;ble_nus_c_on_ble_evt&lt;/em&gt; function. After a peripheral disconnects, its connection handle gets set to invalid (&lt;em&gt;BLE_CONN_HANDLE_INVALID&lt;/em&gt;) but neither the &lt;em&gt;on_hvx&lt;/em&gt; function nor &lt;em&gt;ble_nus_c_on_ble_evt&lt;/em&gt; itself will discard events for an invalid connection handle. The &lt;em&gt;on_hvx&lt;/em&gt; function only checks the TX characteristic&amp;#39;s handle (&lt;em&gt;p_ble_nus_c-&amp;gt;handles.nus_tx_handle&lt;/em&gt;) for an invalid value.&lt;/p&gt;
&lt;p&gt;As far as I can tell this can be fixed by dropping events for&amp;nbsp;&lt;em&gt;ble_nus_c_t&lt;/em&gt; instances that got an invalid connection handle within the function &lt;em&gt;ble_nus_c_on_ble_evt&lt;/em&gt; by replacing this code...&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    if ( (p_ble_nus_c-&amp;gt;conn_handle != BLE_CONN_HANDLE_INVALID)
       &amp;amp;&amp;amp;(p_ble_nus_c-&amp;gt;conn_handle != p_ble_evt-&amp;gt;evt.gap_evt.conn_handle)
       )
    {
        return;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;... with that code ...&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    if ( (p_ble_nus_c-&amp;gt;conn_handle == BLE_CONN_HANDLE_INVALID)
       ||(p_ble_nus_c-&amp;gt;conn_handle != p_ble_evt-&amp;gt;evt.gap_evt.conn_handle)
       )
    {
        return;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Furthermore I think that the characteristic&amp;#39;s handles should also get invalidated during disconnect to prevent other parts of the code from thinking that a reused &lt;em&gt;&lt;/em&gt; instances got already discovered:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;                p_ble_nus_c-&amp;gt;handles.nus_tx_handle = BLE_GATT_HANDLE_INVALID;
                p_ble_nus_c-&amp;gt;handles.nus_rx_handle = BLE_GATT_HANDLE_INVALID;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I attached the patch that I applied to my instance of then nRF5_SDK_15.3.0_59ac345:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/8203.0001_2D00_Drop_2D00_events_2D00_for_2D00_invalid_2D00_connection_2D00_handles.patch"&gt;devzone.nordicsemi.com/.../8203.0001_2D00_Drop_2D00_events_2D00_for_2D00_invalid_2D00_connection_2D00_handles.patch&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can someone from Nordic check, if this is really a bug within the SDK and if so, that my fix is enough to solve the problem?&lt;/p&gt;
&lt;p&gt;BTW Is there an official GitHub repository for the SDK to submit pull requests?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK14.1 Multilink with NUS data sent issue</title><link>https://devzone.nordicsemi.com/thread/125854?ContentTypeID=1</link><pubDate>Sat, 24 Mar 2018 21:30:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c6df6f4-8254-41df-8464-1d0ea319c299</guid><dc:creator>WET TF</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Where is the&amp;nbsp;example of multilink NUS? Neither ble_app_multilink_central nor ble_app_uart_c fit the bill. The SDK 15.0.0 release notes only say that &amp;quot;multilink support was added&amp;quot; and I see that&amp;nbsp;BLE_NUS_C_ARRAY_DEF was added in NUS&amp;#39; API reference, but I haven&amp;#39;t found the example implementing it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK14.1 Multilink with NUS data sent issue</title><link>https://devzone.nordicsemi.com/thread/125741?ContentTypeID=1</link><pubDate>Fri, 23 Mar 2018 13:40:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7821aaa2-9544-4fb5-ad24-77bbb2bb135e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;SDK 15.0 is now released and can be downloaded from &lt;a href="https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/"&gt;this link&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In SDK 15.0 we have added&amp;nbsp;&lt;span&gt;multilink support for the Nordic UART Service. I recommend taking a look at the new NUS example to see how the multilink support is implemented.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Unfortunately, the NUS multilink support was only added for the server.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you are only sending one packet from the server to the client, only 1 &lt;/span&gt;BLE_GATTC_EVT_HVX&amp;nbsp; should have been generated. Could it be that you are handling the same event twice? Feel free to upload the source code, or provide some debug nrf_logs that shows the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SDK14.1 Multilink with NUS data sent issue</title><link>https://devzone.nordicsemi.com/thread/125623?ContentTypeID=1</link><pubDate>Fri, 23 Mar 2018 00:02:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c49d3db1-02c9-4568-a51c-84dd18d3ddc5</guid><dc:creator>WET TF</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a similar issue. When I turn on the master/central and connect peripherals, I can send/receive strings like normal over NUS. Right now I have the peripherals sending back a &amp;quot;hi&amp;quot; when they receive a string over NUS. This works as expected. When I disconnect (turn off) a number N of peripherals, I start getting the expected &amp;quot;hi&amp;quot; response when sending to any peripheral that&amp;#39;s still connected, but N+1 times. After a little debugging I found that the&amp;nbsp;BLE_NUS_C_EVT_NUS_TX_EVT triggers twice, for the same connection handle. If I connect a new peripheral (even the one that disconnected), I now get one less duplicated response.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m guessing it has something to do with not closing NUS instances, and I didn&amp;#39;t quite understand how to close them when following the rabbit hole of the NUS and GATT event handlers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>