<?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 UART issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50227/ble-uart-issue</link><description>I run SDK 15.3 &amp;quot;examples \ ble_peripheral \ ble_app_uart&amp;quot; in 52-DK . and send UART data to nrf Connect in my Phone, i found if i close the ble connect while TX Characteristic is open, and then reconnect ble connect and not open TX Characteristic, then</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 25 Jul 2019 21:18:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50227/ble-uart-issue" /><item><title>RE: BLE UART issue</title><link>https://devzone.nordicsemi.com/thread/200615?ContentTypeID=1</link><pubDate>Thu, 25 Jul 2019 21:18:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf9489be-6eb8-4c87-9341-151b10f63393</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;It seems like a bug to me.&lt;/p&gt;
&lt;p&gt;The error 0x3401 is&amp;nbsp;BLE_ERROR_GATTS_SYS_ATTR_MISSING, which means that the ble stack does not know the state of the CCCD, and if notifications are enabled or not.&lt;/p&gt;
&lt;p&gt;When executing the steps you explained, you end up with a server device not knowing the state of the CCCD, and calling&amp;nbsp;&lt;em&gt;sd_ble_gatts_sys_attr_set()&amp;nbsp;&lt;/em&gt;gives you&amp;nbsp;BLE_ERROR_GATTS_SYS_ATTR_MISSING (&lt;span&gt;0x3401&lt;/span&gt;). This should be handled by calling&amp;nbsp;sd_ble_gatts_sys_attr_set() in response.&lt;/p&gt;
&lt;p&gt;However, I solved it by simply adding&amp;nbsp;BLE_ERROR_GATTS_SYS_ATTR_MISSING as one of the errors to skip after &lt;em&gt;ble_nus_data_send(). &lt;/em&gt;I think this is a valid solution, then nothing will happen on the 52-DK when trying to send data, and when notifications are enabled on the phone, it will work.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;.
.
.
err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, m_conn_handle);
    if ((err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
        (err_code != NRF_ERROR_RESOURCES) &amp;amp;&amp;amp;
        (err_code != NRF_ERROR_NOT_FOUND) &amp;amp;&amp;amp;
        (err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING)) //Added this
    {
        APP_ERROR_CHECK(err_code);
    }
.
.
.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>