<?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>How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71069/how-to-enable-indication-and-get-cccd-value-to-check</link><description>Hi All, 
 I want to use DFU to update the firmware from master to peripheral over BLE , both master and peripheral are nrf52840. My purpose is that the master sends a command to make the peripheral enter bootloader.Therefore I need enable indication and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 05 Feb 2021 02:49:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71069/how-to-enable-indication-and-get-cccd-value-to-check" /><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/293012?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2021 02:49:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d010318e-a24e-49dc-8a2f-5b242e205259</guid><dc:creator>lolifrog</dc:creator><description>&lt;p&gt;&lt;span&gt;Hello Edvin,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your patient replies this week, I&amp;nbsp;figured out&amp;nbsp; why &lt;span&gt;BLE_GATTS_EVT_HVC event was not generated&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Because t&lt;span&gt;he peripheral&amp;nbsp;is responding to the Enter Bootloader request with a handle value indication which should be confirmed by the master. This confirmation will generate the&amp;nbsp;BLE_GATTS_EVT_HVC event.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I add the code to send a Handle Value Confirmation to the GATT Server&amp;nbsp;in the master side before on_hvx():&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ble_hrs_c_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context)
{
    ble_hrs_c_t * p_ble_hrs_c = (ble_hrs_c_t *)p_context;

    if ((p_ble_hrs_c == NULL) || (p_ble_evt == NULL))
    {
        return;
    }

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GATTC_EVT_HVX:
			//Send a Handle Value Confirmation to the GATT Server
			sd_ble_gattc_hv_confirm(p_ble_evt-&amp;gt;evt.common_evt.conn_handle,p_ble_evt-&amp;gt;evt.gattc_evt.params.hvx.handle);
            on_hvx(p_ble_hrs_c, p_ble_evt);
            break;

        case BLE_GAP_EVT_DISCONNECTED:
            on_disconnected(p_ble_hrs_c, p_ble_evt);
            break;

        default:
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Reference：&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/52470/create-ble_dfu_c---triggering-enter-bootloader-doesn-t-work/211297#211297" rel="noopener noreferrer" target="_blank"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/52470/create-ble_dfu_c---triggering-enter-bootloader-doesn-t-work/211297#211297&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/22743/no-ble_gatts_evt_hvc-event-generating-when-using-s140-for-bluetooth-5" rel="noopener noreferrer" target="_blank"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/22743/no-ble_gatts_evt_hvc-event-generating-when-using-s140-for-bluetooth-5&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Steven&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/292863?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 10:17:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81d2d19f-8854-4f97-8927-be2149e0211c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I have not tried to write to this application from an application running on the nRF (only with a phone or nRF Connect for Desktop). Can you please zip the project folder and upload it here, so that I can have a look at what you are doing? It is very hard to say whats wrong based on this discussion only.&lt;/p&gt;
&lt;p&gt;If you do upload the zipped project folder, please specify what SDK version and IDE you are using.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/292840?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 09:10:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd0f6257-6dae-40f8-bb97-ef6990262df8</guid><dc:creator>lolifrog</dc:creator><description>&lt;p&gt;&lt;span&gt;Hello Edvin,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I tried to debug the&amp;nbsp;&lt;span&gt;peripheral and found that BLE_GATTS_EVT_HVC event was not generated in&amp;nbsp;ble_dfu_buttonless_on_ble_evt().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In &amp;quot;nrf_connect&amp;quot; app, if I enable indications and write 0x01 to the characteristic(Buttonless DFU without bonds:0x03),&amp;nbsp;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST and&amp;nbsp;BLE_GATTS_EVT_HVC will&amp;nbsp;be generated.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The result is that I can only recieve {0x20,0x01,0x01}&amp;nbsp; when writing 0x01 to the characteristic(Buttonless DFU without bonds:0x03) and the&amp;nbsp;peripheral&amp;nbsp;can not enter bootloarder.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I wonder if I need to do something else after writing 0x01 to the characteristc?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Steven&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/292523?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2021 15:07:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13b0aad0-c529-4d83-9acd-093d80f9cbe2</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;It looks like you are reading the CCCD of the characteristic, which is 0x0200 (indication enabled). Try reading the value handle instead.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="lolifrog"]Bluetooth master connects to the&amp;nbsp;peripheral&amp;nbsp;periodically(if I don&amp;#39;t write a byte to the characteristic, the master&amp;nbsp;will not be disconnected). Logs are below:[/quote]
&lt;p&gt;&amp;nbsp;It is expected that they will disconnect. When you write 0x01 to the buttonless DFU characteristic, the device should reboot in bootloader mode.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It looks, based on your log message &amp;quot;Request to enter bootloader mode failed asynchroneously&amp;quot; that it failed to do so. Have you tried to debug to figure out why the BLE_DFU_EVT_BOOTLOADER_ENTER_FAILED event was generated?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/292413?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2021 09:41:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09d6bfe4-f2e5-4616-aae7-60fb4eef4dcd</guid><dc:creator>lolifrog</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/71069/how-to-enable-indication-and-get-cccd-value-to-check/292289#292289"]Yes. Does it return NRF_SUCCESS (0x00)? And do you see the callback later?[/quote]
&lt;p&gt;Yes, the return is NRF_SUCCESS(0x00). I read the value of cccd(0x0002) as you said.&lt;/p&gt;
&lt;p&gt;However,I met another question:&lt;/p&gt;
&lt;p&gt;I failed to write 0x01 to the characteristic based on&amp;nbsp;&lt;span&gt;ble_nus_c_string_send() because the peripheral didn&amp;#39;t have any&amp;nbsp;logs.But&amp;nbsp;&lt;/span&gt;&lt;span&gt;I can read the characteristic&amp;nbsp;(Buttonless DFU without bonds:0x03) :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;BLE_GATTC_EVT_READ_RSP,len:3
value[0]:20
value[1]:1
value[2]:1&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;and I change the array from {0x01} to {0x04} ,&amp;nbsp;&lt;span&gt;the&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;peripheral &lt;span style="color:#000000;"&gt;has logs&lt;/span&gt; as below:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;error&amp;gt; app : Request to send a response to client failed.
&amp;lt;error&amp;gt; app : Request to enter bootloader mode failed asynchroneously.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I can also read the characteristic&amp;nbsp;(Buttonless DFU without bonds:0x03) :&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;BLE_GATTC_EVT_READ_RSP,len:3
value[0]:20
value[1]:4
value[2]:2&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Bluetooth master connects to the&amp;nbsp;peripheral&amp;nbsp;periodically(if I don&amp;#39;t write a byte to the characteristic, the master&amp;nbsp;will not be disconnected). Logs are below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Disconnected. conn_handle: 0x0, reason: 0x13&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#000000;"&gt;When reconnected and written 0x04(if the written byte is 0x01,there is no logs below) ,the&amp;nbsp;peripheral&amp;nbsp;show logs:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Request to enter bootloader mode failed asynchroneously&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#ff0000;"&gt;I wonder where is wrong?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;More details:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;write characteristic:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t ble_dfu_c_string_send(ble_hrs_c_t * p_ble_dfu_c, uint8_t * p_string, uint16_t length)
{

    VERIFY_PARAM_NOT_NULL(p_ble_dfu_c);
    nrf_ble_gq_req_t write_req;
    memset(&amp;amp;write_req, 0, sizeof(nrf_ble_gq_req_t));
    if (length &amp;gt; NRF_SDH_BLE_GATT_MAX_MTU_SIZE - 3)
    {
        NRF_LOG_WARNING(&amp;quot;Content too long.&amp;quot;);
        return NRF_ERROR_INVALID_PARAM;
    }
    if (p_ble_dfu_c-&amp;gt;conn_handle == BLE_CONN_HANDLE_INVALID)
    {
        NRF_LOG_WARNING(&amp;quot;Connection handle invalid.&amp;quot;);
        return NRF_ERROR_INVALID_STATE;
    }
 
    write_req.type                        = NRF_BLE_GQ_REQ_GATTC_WRITE;
    write_req.error_handler.cb            = gatt_error_handler;
    write_req.error_handler.p_ctx         = p_ble_dfu_c;
    write_req.params.gattc_write.handle   = p_ble_dfu_c-&amp;gt;peer_hrs_db.hrm_handle;
    write_req.params.gattc_write.len      = length;
    write_req.params.gattc_write.offset   = 0;
    write_req.params.gattc_write.p_value  = p_string;
    write_req.params.gattc_write.write_op = BLE_GATT_OP_WRITE_CMD;
	NRF_LOG_INFO(&amp;quot;ble_dfu_c_string_send write.handle:%x&amp;quot;,p_ble_dfu_c-&amp;gt;peer_hrs_db.hrm_handle);
    return nrf_ble_gq_item_add(p_ble_dfu_c-&amp;gt;p_gatt_queue, &amp;amp;write_req, p_ble_dfu_c-&amp;gt;conn_handle);
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;read characteristic:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t ble_dfu_ch_read(ble_hrs_c_t * p_ble_dfu_c,uint16_t chara_handle)
{
    VERIFY_PARAM_NOT_NULL(p_ble_dfu_c);

    nrf_ble_gq_req_t read_req;

    memset(&amp;amp;read_req, 0, sizeof(nrf_ble_gq_req_t));

    if (p_ble_dfu_c-&amp;gt;conn_handle == BLE_CONN_HANDLE_INVALID)
    {
        NRF_LOG_INFO(&amp;quot;Connection handle invalid.&amp;quot;);
        return NRF_ERROR_INVALID_STATE;
    }
	NRF_LOG_INFO(&amp;quot;In ch_read.handle:%x.&amp;quot;,chara_handle);
    read_req.type                        = NRF_BLE_GQ_REQ_GATTC_READ;
    read_req.error_handler.cb            = gatt_error_handler;
    read_req.error_handler.p_ctx         = p_ble_dfu_c;
    read_req.params.gattc_read.handle   = chara_handle;
    read_req.params.gattc_read.offset   = 0;
    return nrf_ble_gq_item_add(p_ble_dfu_c-&amp;gt;p_gatt_queue, &amp;amp;read_req, p_ble_dfu_c-&amp;gt;conn_handle);
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;main&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//uint8_t arr={0x01}, and can be changed by uart
err_code = ble_dfu_c_string_send(&amp;amp;m_hrs_c, arr, 1);
APP_ERROR_CHECK(err_code);
err_code = ble_dfu_ch_read(&amp;amp;m_hrs_c,m_hrs_c.peer_hrs_db.hrm_handle);
APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Steven&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/292289?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2021 14:46:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6eb081ce-2700-44d0-8314-3a977b3f4f95</guid><dc:creator>Edvin</dc:creator><description>[quote user="lolifrog"]Is that right?[/quote]
&lt;p&gt;&amp;nbsp;Yes. Does it return NRF_SUCCESS (0x00)? And do you see the callback later?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="lolifrog"]2.If I want to write 0x01 to the &lt;span&gt;characteristic&lt;/span&gt;&lt;span&gt;(Buttonless DFU without bonds:0x03)&amp;nbsp;,where can I get examples.&lt;/span&gt;[/quote]
&lt;p&gt;&amp;nbsp;Look at how the ble_app_uart_c writes to a characteristic using ble_nus_c_string_send().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/292234?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2021 13:08:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2250e02-010a-41f1-8fde-d74e70a8bb7b</guid><dc:creator>lolifrog</dc:creator><description>&lt;p&gt;Hi Edvin&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for your reply.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I still have two questions.&lt;/span&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/71069/how-to-enable-indication-and-get-cccd-value-to-check/292200#292200"]Try to copy the ble_hrs_c_hrm_norif_enable() function and change it from notification to indication, as I described in the previous reply.[/quote]
&lt;p&gt;1. To enable indications, the changes in&amp;nbsp;cccd_configure() are:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;1. cccd_val = enable ? BLE_GATT_HVX_INDICATION : 0;

// use my cccd handle
2.hrs_c_req.params.gattc_write.handle = p_ble_hrs_c-&amp;gt;peer_hrs_db.hrm_cccd_handle;

// use my connection handle
3. return nrf_ble_gq_item_add(p_ble_hrs_c-&amp;gt;p_gatt_queue, &amp;amp;hrs_c_req, p_ble_hrs_c-&amp;gt;conn_handle);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is that right?&lt;/p&gt;
&lt;p&gt;2.If I want to write 0x01 to the &lt;span&gt;characteristic&lt;/span&gt;&lt;span&gt;(Buttonless DFU without bonds:0x03)&amp;nbsp;,where can I get examples.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Steven&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/292200?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2021 12:02:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c48c943-3325-4667-9297-ec4191dae424</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Try to copy the ble_hrs_c_hrm_norif_enable() function and change it from notification to indication, as I described in the previous reply.&lt;/p&gt;
&lt;p&gt;If you want to test whether indications are already enabled, please try to read the characteristic description. The HRS example doesn&amp;#39;t do this, and I don&amp;#39;t think we have any central examples that does this, really. (Probably because it is easier to just enable the indication/notification again, which I recommend).&lt;/p&gt;
&lt;p&gt;What you need to do to read is to use the implementation from cccd_configure() in ble_hrs_c.c and change NRF_BLE_GQ_REQ_GATTC_WRITE to NRF_BLE_GX_REQ_GATTC_READ, and change all instances of:&lt;/p&gt;
&lt;p&gt;hrs_c_req.params.gattc_write. ...&lt;/p&gt;
&lt;p&gt;with&amp;nbsp;&lt;/p&gt;
&lt;p&gt;hrs_c_req.params.gattc_read. ...&lt;/p&gt;
&lt;p&gt;This will probably generate an event at a later point in time in your ble_evt_handler:&lt;/p&gt;
&lt;p&gt;case BLE_GATTC_EVT_READ_RSP:&lt;/p&gt;
&lt;p&gt;Look at the p_ble_evt-&amp;gt;evt.gattc_evt.params.read_rsp struct (ble_gattc_evt_read_rsp_t) to implement this handler.&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><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/292037?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2021 15:58:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2cbc2db3-a846-4be0-9bfb-03fbc95d1542</guid><dc:creator>lolifrog</dc:creator><description>&lt;p&gt;Hi Edvin&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for your quick reply.&lt;/span&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/71069/how-to-enable-indication-and-get-cccd-value-to-check/291999#291999"]but your snippets looks like they are using the bl_app_hrs_c (which is a central) service.[/quote]
&lt;p&gt;I just use the example of bl_app_hrs_c and changed UUIDs&amp;nbsp;because I didn&amp;#39;t find any example of DFU&amp;nbsp; in master(based on nrf52840).&amp;nbsp;&lt;span&gt;My purpose is that the master sends a command to&amp;nbsp;make the&amp;nbsp;&lt;/span&gt;&lt;span&gt;peripheral&amp;nbsp;&lt;/span&gt;&lt;span&gt;enter bootloader. I would rewrite the codes when I understand more.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;&lt;span&gt;peripheral&amp;nbsp;has bootloader(based on Buttonless Secure DFU Service) and I can use &amp;quot;nRF connect&amp;quot; to enter&amp;nbsp;bootloader of peripheral&amp;nbsp;(enable indication and write 0x01).My ultimate goal is to enable the master to control the&amp;nbsp; peripheral&amp;nbsp;upgrade just like &amp;quot;nrf connect&amp;quot;.&lt;/span&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/71069/how-to-enable-indication-and-get-cccd-value-to-check/291999#291999"]&lt;p&gt;Are you trying to enable indications from a central, or are you trying to check whether a central have enabled indications?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And is there a particular reason why you are using indications and not notifications?&lt;/p&gt;[/quote]
&lt;p&gt;Yes, I am trying to enable indications from a central, but I don&amp;#39;t know if it works. Therefore I&amp;nbsp;try to&amp;nbsp;&lt;span&gt;confirm it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I refer to the infomation(&lt;span&gt;Subscribe for indications and w&lt;/span&gt;rite 0x01 into the characteristic)&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.0.0%2Fservice_dfu.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/71069/how-to-enable-indication-and-get-cccd-value-to-check/291999#291999"]If you want to use indications instead of notifications, please change BLE_GATT_HVX_NOTIFICATION to BLE_GATT_HVX_INDICATION, but please check whether the peripheral supports indications at all before you do so.[/quote]
&lt;p&gt;I think &lt;span&gt;the peripheral supports indications because I&amp;nbsp;&lt;/span&gt;can use &amp;quot;nrf connect&amp;quot; to enable indications and enter bootloader.&lt;/p&gt;
&lt;p&gt;All in all, I have found the service(0xfe59) and its&amp;nbsp;&lt;span&gt;characteristic(Buttonless DFU without bonds:0x03) but&lt;/span&gt;&amp;nbsp;failed to write 0x01 to&amp;nbsp;&lt;span&gt;the peripheral. Therefore,I tried to check whether indications aren&amp;#39;t enable or failed to write 0x01 into the characteristic.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Steven&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable indication and get CCCD value to check</title><link>https://devzone.nordicsemi.com/thread/291999?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2021 13:12:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:789b3aef-9211-4bc9-9a8c-4431b8dfee19</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I am not sure I understand you. In your screenshot, you have highlighted the buttonless DFU service, but your snippets looks like they are using the bl_app_hrs_c (which is a central) service.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Are you trying to enable indications from a central, or are you trying to check whether a central have enabled indications?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And is there a particular reason why you are using indications and not notifications?&lt;/p&gt;
&lt;p&gt;the sd_ble_gatts_value_get() is a gatt server call, which is intended for the peripheral to check the value of the characteristic. You can&amp;#39;t use this on the central.&lt;/p&gt;
&lt;p&gt;If you want to check how to enable notifications, please check the unmodified ble_app_hrs_c (download and unzip a new SDK if you have changed a lot in the service&amp;#39;s files).&lt;/p&gt;
&lt;p&gt;Look at how it uses&amp;nbsp;ble_hrs_c_hrm_notif_enable(). It uses cccd_configure from ble_hrs_c.c. Please note the line:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint16_t         cccd_val = enable ? BLE_GATT_HVX_NOTIFICATION : 0;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you want to use indications instead of notifications, please change BLE_GATT_HVX_NOTIFICATION to BLE_GATT_HVX_INDICATION, but please check whether the peripheral supports indications at all before you do so. The ble_app_hrs example does not support indications by default (and if you change it, it no longer complies with the HRS service, which is determined by Bluetooth).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>