<?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_nus_data_send error</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65706/ble_nus_data_send-error</link><description>Hi, 
 Recently, I&amp;#39;ve found a reset issue with my device by ble_nus_data_send error when ble is working. 
 But the error code is 0x3401(Please, refer the picture). What does that mean? Is there any other header with the definitions than nrf_error.h? 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Sep 2020 12:14:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65706/ble_nus_data_send-error" /><item><title>RE: ble_nus_data_send error</title><link>https://devzone.nordicsemi.com/thread/268966?ContentTypeID=1</link><pubDate>Thu, 10 Sep 2020 12:14:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8013144-2834-4e7e-8ae4-a1512dc12e39</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="eleven-x_devteam"]But You mean putting&amp;nbsp;sd_ble_gatts_sys_attr_set in the&amp;nbsp; BLE_GAP_EVT_CONNECTED case of ble evt handler like the code below?[/quote]
&lt;p&gt;Yes. This is just to set it as early as possible.&lt;/p&gt;
[quote user="eleven-x_devteam"]&lt;span&gt;I found these 2 posts below about the errors and I filtered out the errors so that the device will not be reset by app error check and&amp;nbsp;&lt;/span&gt;&lt;span&gt;it seems the issues were fixed. Does it also make sense?&lt;/span&gt;[/quote]
&lt;p&gt;I am not sure how &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/52433/stopping-ble_conn_params-c-s-timers-while-supporting-concurrent-connections/211500#211500"&gt;this&lt;/a&gt;&amp;nbsp;is relevant, but &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/50227/ble-uart-issue/200615#200615"&gt;this&lt;/a&gt;&amp;nbsp;post provided a viable solution, as long as you are happy with the&amp;nbsp;ble_nus_data_send() call failing silently and you set the system attributes later. The key is that this will fail until the system attributes is set, and you can handle it in several different ways.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_data_send error</title><link>https://devzone.nordicsemi.com/thread/268788?ContentTypeID=1</link><pubDate>Wed, 09 Sep 2020 14:29:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:147a8160-5d41-4f58-80bd-e849c07d9b9d</guid><dc:creator>eleven-x_devteam</dc:creator><description>&lt;p&gt;Thank you for your answer.&lt;/p&gt;
&lt;p&gt;I have already the code in&amp;nbsp;the&amp;nbsp;&lt;span&gt;BLE_GATTS_EVT_SYS_ATTR_MISSING case of&amp;nbsp;&lt;/span&gt;ble evt handler.&lt;/p&gt;
&lt;p&gt;But You mean putting&amp;nbsp;sd_ble_gatts_sys_attr_set in the&amp;nbsp; BLE_GAP_EVT_CONNECTED case of ble evt handler like the code below?&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;static&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;ble_evt_handler&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;ble_evt_t&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;const&lt;/span&gt;&lt;span&gt;*&amp;nbsp;&lt;/span&gt;&lt;span&gt;p_ble_evt&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt;*&amp;nbsp;&lt;/span&gt;&lt;span&gt;p_context&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;uint32_t&lt;/span&gt;&lt;span&gt;&amp;nbsp;err_code;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;switch&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;p_ble_evt&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;header&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;evt_id&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;case&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;BLE_GAP_EVT_CONNECTED&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;m_conn_handle&lt;/span&gt;&lt;span&gt;&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;p_ble_evt&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;evt&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;gap_evt&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;conn_handle&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;err_code&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;nrf_ble_qwr_conn_handle_assign&lt;/span&gt;&lt;span&gt;(&amp;amp;&lt;/span&gt;&lt;span&gt;m_qwr&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;m_conn_handle&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;APP_ERROR_CHECK&lt;/span&gt;&lt;span&gt;(err_code);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;err_code&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;sd_ble_gatts_sys_attr_set&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;m_conn_handle&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;NULL&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;APP_ERROR_CHECK&lt;/span&gt;&lt;span&gt;(err_code);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;break&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This issue happens just sometimes with ble connecting &amp;amp; disconnecting with other scheduled jobs.&lt;/p&gt;
&lt;p&gt;Also, there is another reset with&amp;nbsp;&lt;span&gt;sd_ble_gap_conn_param_update returning NRF_ERROR_INVALID_STATE in the same test condition.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I found these 2 posts below about the errors and I filtered out the errors so that the device will not be reset by app error check and&amp;nbsp;&lt;/span&gt;&lt;span&gt;it seems the issues were fixed. Does it also make sense?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a class="sc-btewqU bZmMRh" title="https://devzone.nordicsemi.com/f/nordic-q-a/50227/ble-uart-issue/200615#200615" href="https://devzone.nordicsemi.com/f/nordic-q-a/50227/ble-uart-issue/200615#200615"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/50227/ble-uart-issue/200615#200615&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;a class="sc-btewqU bZmMRh" title="https://devzone.nordicsemi.com/f/nordic-q-a/52433/stopping-ble_conn_params-c-s-timers-while-supporting-concurrent-connections/211500#211500" href="https://devzone.nordicsemi.com/f/nordic-q-a/52433/stopping-ble_conn_params-c-s-timers-while-supporting-concurrent-connections/211500#211500"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/52433/stopping-ble_conn_params-c-s-timers-while-supporting-concurrent-connections/211500#211500&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_data_send error</title><link>https://devzone.nordicsemi.com/thread/268786?ContentTypeID=1</link><pubDate>Wed, 09 Sep 2020 14:24:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:199f2653-aeac-4579-ab3e-eced219c4553</guid><dc:creator>eleven-x_devteam</dc:creator><description>&lt;p&gt;Thank you for your answer!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_data_send error</title><link>https://devzone.nordicsemi.com/thread/268754?ContentTypeID=1</link><pubDate>Wed, 09 Sep 2020 12:45:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ac48759-8588-4947-8ff3-2fe58c35b63e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As allready mentioned, the error code&amp;nbsp;is&amp;nbsp;BLE_ERROR_GATTS_SYS_ATTR_MISSING. You can probably fix the issue by calling this before (for instance when handling the connected event):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ble_nus_data_send error</title><link>https://devzone.nordicsemi.com/thread/268599?ContentTypeID=1</link><pubDate>Tue, 08 Sep 2020 18:36:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:202fbe65-288d-49b7-b483-79dafe91bdd6</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;It&amp;#39;s here, in ble_gatts.h, 0x3401:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define BLE_ERROR_GATTS_SYS_ATTR_MISSING    (NRF_GATTS_ERR_BASE + 0x001) /**&amp;lt; System Attributes missing. */

* @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Maybe there is a full decoded list in the docs, but usually I scroll back through the nested definitions; not so helpful but maybe a starting point&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>