<?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>cccd enables to report errors</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61764/cccd-enables-to-report-errors</link><description>Hi, I&amp;#39;d like to set up cccd here, but test the error, 
 
 In the routine nRF5_SDK_15.3.0_59ac345 nRF5_SDK_15.3.0_59ac345.0_59ac345.s.ble_peripheral?ble_app_uart/pca10040-s132-arm5_no_packs-ble_app_uart_pca10040_s132.uvprojx How do I make a cccd in ? </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 May 2020 08:49:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61764/cccd-enables-to-report-errors" /><item><title>RE: cccd enables to report errors</title><link>https://devzone.nordicsemi.com/thread/252107?ContentTypeID=1</link><pubDate>Thu, 28 May 2020 08:49:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae15e6f8-6c7c-40a0-b54f-2b63c253396a</guid><dc:creator>Edvin</dc:creator><description>[quote user="peter.min"]Although I know that forced enable CCDCs in ble_peripheral do not meet the Bluetooth specification,&lt;br /&gt;But I still want to force the ability to make a cccd ble_peripheral here.[/quote]
&lt;p&gt;&amp;nbsp;Sorry. It doesn&amp;#39;t work this way. The actual CCCD is stored in the softdevice, and you can&amp;#39;t force it. The one that you try to force is just a copy of that flag which is used for the application layer logic. No way to force it from the peripheral.&lt;/p&gt;
&lt;p&gt;You need to enable notifications from your central application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cccd enables to report errors</title><link>https://devzone.nordicsemi.com/thread/252058?ContentTypeID=1</link><pubDate>Thu, 28 May 2020 01:50:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:594e2023-4745-4463-9bdc-b0c91024c9c5</guid><dc:creator>peter.min</dc:creator><description>&lt;p&gt;1.&lt;span&gt;APP_ERROR_CHECK（err_code）;&amp;nbsp;&lt;/span&gt;&lt;span&gt;err_code = 0x3401（= 13313）The corresponding function is:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, m_conn_handle);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The notification code function is enabled for:&lt;br /&gt;static void on_write (ble_nus_t s p_nus, ble_evt_t const s p_ble_evt)&lt;/p&gt;
&lt;p&gt;The criteria for judging are:&lt;br /&gt;else if (p_evt_write-handle- s-p_nus-rx_handles.value_handle)&lt;br /&gt; (p_nus-data_handler!&lt;/p&gt;
&lt;p&gt;The enable method is:&lt;br /&gt;p_client-is_notification_enabled -true;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3.This event was not handled:&lt;br /&gt;BLE_GATTS_EVT_SYS_ATTR_MISSING&lt;/p&gt;
&lt;p&gt;This event sdk defaults to:&lt;br /&gt; case BLE_GATTS_EVT_SYS_ATTR_MISSING:&lt;br /&gt; No system attributes have had has stored.&lt;br /&gt; err_code s sd_ble_gatts_sys_attr_set (m_conn_handle, NULL, 0, 0);&lt;br /&gt; APP_ERROR_CHECK (err_code);&lt;br /&gt; break;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;4.&lt;/p&gt;
&lt;p&gt;ble_evt_handler as follows&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for handling BLE events.
 *
 * @param[in]   p_ble_evt   Bluetooth stack event.
 * @param[in]   p_context   Unused.
 */
static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    uint32_t err_code;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            NRF_LOG_INFO(&amp;quot;Connected&amp;quot;);
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
            err_code = nrf_ble_qwr_conn_handle_assign(&amp;amp;m_qwr, m_conn_handle);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO(&amp;quot;Disconnected&amp;quot;);
            // LED indication will be changed when advertising starts.
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
            break;

        case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
        {
            NRF_LOG_DEBUG(&amp;quot;PHY update request.&amp;quot;);
            ble_gap_phys_t const phys =
            {
                .rx_phys = BLE_GAP_PHY_AUTO,
                .tx_phys = BLE_GAP_PHY_AUTO,
            };
            err_code = sd_ble_gap_phy_update(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, &amp;amp;phys);
            APP_ERROR_CHECK(err_code);
        } break;

        case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
            // Pairing not supported
            err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GATTS_EVT_SYS_ATTR_MISSING:
            // No system attributes have been stored.
            err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GATTC_EVT_TIMEOUT:
            // Disconnect on GATT Client timeout event.
            err_code = sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gattc_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GATTS_EVT_TIMEOUT:
            // Disconnect on GATT Server timeout event.
            err_code = sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gatts_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
            break;

        default:
            // No implementation needed.
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;5.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;1. In order to enable cccd in nrf52532, I modified the routine:&lt;br /&gt;Project.nRF5_SDK_15.nRF5_SDK_15.0_59ac345?ble_peripheral?ble_app_uart?pca10040?s132-arm5_no_packs ble_app_uart_pca10040_s132.uvprojx&lt;/p&gt;
&lt;p&gt;2. In the ble_app_uart routine I made the following modifications:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/_EE4F39658476FD517065_.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;6.&lt;/p&gt;
&lt;p&gt;Although I know that forced enable CCDCs in ble_peripheral do not meet the Bluetooth specification,&lt;br /&gt;But I still want to force the ability to make a cccd ble_peripheral here.&lt;/p&gt;
&lt;p&gt;My previously modified code does nuns that do not enforce the ability to make CCCD.&lt;/p&gt;
&lt;p&gt;Please help me complete an example that can be forced to enable CCCD.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cccd enables to report errors</title><link>https://devzone.nordicsemi.com/thread/251667?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 09:59:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7388b1f9-b602-4419-9697-3f147de9b226</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;That doesn&amp;#39;t tell me much. What function is this? Does the issue happen if you remove the change in the red box? Are you trying to force the notification to turn on from the peripheral? You can&amp;#39;t do that because of two reasons:&lt;br /&gt;1: It is against the BLE specification.&lt;/p&gt;
&lt;p&gt;2: The softdevice will not allow that.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Edvin Holmseth"]Can you check what function call that is?[/quote]
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Edvin Holmseth"]What does your ble_evt_handler() look like?[/quote]
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Edvin Holmseth"]Do you handle the event:&amp;nbsp;BLE_GATTS_EVT_SYS_ATTR_MISSING? If so, what do you do in that event?[/quote]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cccd enables to report errors</title><link>https://devzone.nordicsemi.com/thread/251602?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 07:05:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a265f184-d4eb-41fe-892e-496cf1bc052d</guid><dc:creator>peter.min</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/edvin-holmseth"&gt;Edvin&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I just modified the code for the red box section.&lt;br /&gt;The other code is the default routine&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards. Peter.Min&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cccd enables to report errors</title><link>https://devzone.nordicsemi.com/thread/251535?ContentTypeID=1</link><pubDate>Mon, 25 May 2020 14:33:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72d2d8ed-3b7c-4c38-ba27-11f209419a39</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The log says that in your main.c file there is an APP_ERROR_CHECK(err_code); with err_code = 0x3401 (=13313).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you check what function call that is? Remember to debug into the functions to see what call inside that function that returned 0x3401.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;0x3401 is&amp;nbsp;BLE_ERROR_GATTS_SYS_ATTR_MISSING (defined in ble_gatts.h).&lt;/p&gt;
&lt;p&gt;This is usually returned if you try to send a notification, but notifications aren&amp;#39;t enabled. Did you enable notifications before calling ble_nus_data_send()?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What does your ble_evt_handler() look like?&lt;/p&gt;
&lt;p&gt;Do you handle the event:&amp;nbsp;BLE_GATTS_EVT_SYS_ATTR_MISSING? If so, what do you do in that event?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>