<?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>ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27927/ble_app_uart-multilink_central-with-a-peripheral</link><description>Hi team 
 I have a problem that bothers me for days. 
 I try to run demo ble_app_uart_c with 
 NRF_SDH_BLE_CENTRAL_LINK_COUNT=8 and NRF_SDH_BLE_PERIPHERAL_LINK_COUNT=1.
 
 first,I use APP nRF toolbox scan and connect first board witch running this</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Apr 2018 09:14:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27927/ble_app_uart-multilink_central-with-a-peripheral" /><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/129297?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 09:14:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21819c40-6e17-4ca9-a257-01d6a638abe5</guid><dc:creator>Enzo</dc:creator><description>&lt;p&gt;Thank you for your reply.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/128884?ContentTypeID=1</link><pubDate>Thu, 19 Apr 2018 05:42:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47f258ba-b8be-4e86-85c0-84845af4da57</guid><dc:creator>Homer Lu</dc:creator><description>&lt;div&gt;I am using SDK v14.2&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;// m_nus register a event handler ble_nus_on_ble_evt() by using marco&amp;nbsp;&amp;nbsp;BLE_NUS_DEF&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;BLE_NUS_DEF(m_nus);&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;// All event will be handled by&amp;nbsp;&lt;span&gt;ble_nus_on_ble_evt(),&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#ff0000;"&gt;NOT&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&amp;nbsp;only NUS related events&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;// If BLE_GAP_EVT_CONNECTED event comes,&lt;/div&gt;
&lt;div&gt;//&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;ble_nus_on_ble_evt() calls&amp;nbsp;on_connect() then set&amp;nbsp;p_nus-&amp;gt;conn_handle to p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;b&gt;// (ble_nus.c LN63)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;// That means&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;b&gt;&amp;quot;Any new connection will set m_nus.conn_handle to be the new connect handle&amp;quot;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;// to resolve this issue, i use following code&lt;/div&gt;
&lt;div&gt;// but this work only if you have only 1 peripheral&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;static ble_nus_t m_nus;&lt;br /&gt;static void &lt;strong&gt;wrapper_ble_nus_on_ble_evt&lt;/strong&gt;(ble_evt_t const * p_ble_evt, void * p_context)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; uint16_t conn_handle;&lt;br /&gt;&amp;nbsp; &amp;nbsp; uint16_t role;&lt;br /&gt;&amp;nbsp; &amp;nbsp; ble_nus_t * p_nus = (ble_nus_t *)p_context;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; if ((p_nus == NULL) || (p_ble_evt == NULL)) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;&lt;br /&gt;&amp;nbsp; &amp;nbsp; role = ble_conn_state_role(conn_handle);&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; if (role == BLE_GAP_ROLE_PERIPH) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;strong&gt;ble_nus_on_ble_evt&lt;/strong&gt;(p_ble_evt, p_context);&lt;br /&gt;&amp;nbsp; &amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;NRF_SDH_BLE_OBSERVER(m_nus_obs, BLE_NUS_BLE_OBSERVER_PRIO, &lt;strong&gt;wrapper_ble_nus_on_ble_evt&lt;/strong&gt;, &amp;amp;m_nus);&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110222?ContentTypeID=1</link><pubDate>Fri, 08 Dec 2017 02:16:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50190932-f29b-4f36-adf7-e9e368be6855</guid><dc:creator>Enzo</dc:creator><description>&lt;p&gt;Thanks Petter.&lt;br /&gt;
Now i get it.&lt;br /&gt;
You really help me a lot.  I dont think i can fix this issue without your help.I don&amp;#39;t know much about BLE,there is a lot need to learn.  Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110221?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 15:51:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:413b5991-f044-458d-94cd-f0e4a75df6fd</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;It seems you are using the incorrect connection handle when you call sd_ble_gatts_hvx() after the second board have connected. You are using the connection handle of the connection to the second board. This is because of the handling of BLE_GAP_EVT_CONNECTED in ble_nus_on_ble_evt(). Here on_connect() is called and the incorrect connection handle is set. When you disconnect and connect again the correct connection handle is set.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110220?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 11:49:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45b29d41-4f01-4507-ad74-65585733e274</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Next time I would appreciate if you would just upload the complete project. However, I got it to compile, and it seems to be running. How do I reproduce?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110219?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 16:49:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b75de682-3096-44a5-870b-08b11971963b</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I see. Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110218?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 15:55:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa4523b7-cd83-4330-8501-ce1553487022</guid><dc:creator>Enzo</dc:creator><description>&lt;p&gt;not sd_ble_gatts_hvx.it&amp;#39;s function  ble_nus_string_send check parameter  m_nus  and return NRF_ERROR_INVALID_STATE&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110217?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 15:47:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cabac23-8915-4102-972c-c0b369a8f3c0</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Are you saying sd_ble_gatts_hvx() returns NRF_ERROR_INVALID_STATE after you are disconnected? That is expected. Let me know. I&amp;#39;ll test your project first thing tomorrow.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110215?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 13:41:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61c688c9-7a4f-45ae-a8ca-436544b8b9a7</guid><dc:creator>Enzo</dc:creator><description>&lt;p&gt;I&amp;#39;m sure ble_nus_string_send()return error 13313.i will try it tomorrow about nRF Toolbox.and i&amp;#39;ll get NRF_ERROR_INVALID_STATE when a peripheral only board disconnected,then the first board connected with nRF toolbox send data to nRF toolbox by ble_nus_string_send().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110214?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 13:21:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11d73766-c060-462a-b22d-4f34aa9aee6b</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Just to confirm, sd_ble_gatts_hvx() inside ble_nus_string_send() returns 0x3401 (BLE_ERROR_GATTS_SYS_ATTR_MISSING)? Have you checked the parameters given to sd_ble_gatts_hvx() before and after you disconnect and reconnect the nRF Toolbox?&lt;/p&gt;
&lt;p&gt;NRF_ERROR_INVALID_STATE ? Which function return this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110216?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 07:17:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac9b42bb-e1a0-4c51-b6dc-d35dff04fb51</guid><dc:creator>Enzo</dc:creator><description>&lt;p&gt;thank you Petter.I&amp;#39;ve upload the code file that I&amp;#39;ve changed.&lt;a href="https://github.com/ccchengjinwang/code/tree/master/ble_app_uart_multi_c"&gt;this&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;and I found that first board will get NRF_ERROR_INVALID_STATE if the second board disconnected.that&amp;#39;s all i get&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110212?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 14:59:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e71fddc-0990-4213-a65d-3dad807fc760</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Just to confirm, sd_ble_gatts_hvx() inside ble_nus_string_send() returns 0x3401 (BLE_ERROR_GATTS_SYS_ATTR_MISSING)? Have you checked the parameters given to sd_ble_gatts_hvx() before and after you disconnect and reconnect the nRF Toolbox? Would it be possible for you to share you complete project so I can try to reproduce here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_app_uart multilink_central with a peripheral</title><link>https://devzone.nordicsemi.com/thread/110213?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 06:43:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2fd9f12-8f16-481d-b2f9-c0e4599fcc60</guid><dc:creator>Enzo</dc:creator><description>&lt;p&gt;&lt;strong&gt;not cool&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>