<?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>NUS connection problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68817/nus-connection-problem</link><description>Hi, 
 I&amp;#39;m using nrf52840DK as a central device (sdk16 ble-app-uart-multilink-master) and my peripheral device is bt840 chip(sdk15.2 ble_app_uart_pca10056_s140). 
 My peripheral after connection sleep 10s and connect again. When the first connection i</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Nov 2020 13:28:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68817/nus-connection-problem" /><item><title>RE: NUS connection problem</title><link>https://devzone.nordicsemi.com/thread/282264?ContentTypeID=1</link><pubDate>Fri, 27 Nov 2020 13:28:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38341798-c092-4365-a8e4-27053c9ed145</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="burakcanfazla"]Is it cause of sending data length?[/quote]
&lt;p&gt;&amp;nbsp;&lt;span&gt;NRF_ERROR_INVALID_LENGTH is usually returned when you provide incorrect length of a parameter&amp;nbsp;such as a buffer.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="burakcanfazla"]&lt;p&gt;connection handle is:&lt;/p&gt;
&lt;p&gt;00&amp;gt; &amp;lt;info&amp;gt; app: Disconnected. conn_handle: 0x0, reason: 0x8&lt;/p&gt;[/quote]
&lt;p&gt;&amp;nbsp;You need to debug your code more thoroughly. I can tell based on the error log from your original problem statement that connection handle is invalid when you call&amp;nbsp;&lt;span&gt;ble_nus_c_string_send(). I can also see that you call this function two places in your code. I suggest that you actually check what the connection handle is, and if it has been properly assigned before you call&amp;nbsp;ble_nus_c_string_send().&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jared&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS connection problem</title><link>https://devzone.nordicsemi.com/thread/282202?ContentTypeID=1</link><pubDate>Fri, 27 Nov 2020 07:53:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56a4ffc8-36d7-456d-aa15-3fdbb648a03a</guid><dc:creator>brkcnfzl</dc:creator><description>&lt;p&gt;00&amp;gt; &amp;lt;error&amp;gt; app: Failed sending NUS message. Error 0x9. &lt;br /&gt;00&amp;gt; &amp;lt;error&amp;gt; app: ERROR 9 [NRF_ERROR_INVALID_LENGTH]&lt;/p&gt;
&lt;p&gt;Is it cause of sending data length?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;connection handle is:&lt;/p&gt;
&lt;p&gt;00&amp;gt; &amp;lt;info&amp;gt; app: Disconnected. conn_handle: 0x0, reason: 0x8&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS connection problem</title><link>https://devzone.nordicsemi.com/thread/282198?ContentTypeID=1</link><pubDate>Fri, 27 Nov 2020 07:41:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07bdd1de-31ba-43e7-8b84-89e12ff31400</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As the error message describes it, the central is calling&amp;nbsp;ble_nus_c_string_send() with an invalid connection handle. Set a breakpoint where you call&amp;nbsp;&lt;span&gt;ble_nus_c_string_send() and check what the connection handle is.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jared&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>