<?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>Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66788/issue-on-writing-custom-characteristics</link><description>Hi, I have very STRANG issues. I am adding custom Characteristics to custom Services. I have added 10 custom Characteristics with the same config 8 of them are working perfectly fine but 2 of them are causing issues. I am also attaching my project. I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Oct 2020 06:11:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66788/issue-on-writing-custom-characteristics" /><item><title>RE: Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/thread/273904?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 06:11:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f48dcc8e-adce-425d-a948-0b483b9d8724</guid><dc:creator>Muqarrab</dc:creator><description>&lt;p&gt;Thanks, problem solved but I don&amp;#39;t know-how.&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f913.svg" title="Nerd"&gt;&amp;#x1f913;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/thread/273757?ContentTypeID=1</link><pubDate>Thu, 08 Oct 2020 12:55:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7697ff3d-33b1-4f68-a744-4be9dac13665</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Yes. I used nRF Connect for Desktop and I can see 0x24 on the characteristic no 4:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/7115.pastedimage1602161567786v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The only thing I changed was to add the line:&lt;/p&gt;
&lt;p&gt;uint32_t ble_cus_init(ble_cus_t * p_cus, const ble_cus_init_t * p_cus_init);&lt;/p&gt;
&lt;p&gt;to ble_cus.h, because the compiler was complaining that this function was first declared in main.c. I also removed that line from ble_cus.c.&lt;/p&gt;
&lt;p&gt;That is the proper way to add functions in C programming. Try to do that, and rebuild your project from scratch:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/1212.pastedimage1602161687769v2.png" alt=" " /&gt;&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: Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/thread/273414?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 09:22:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bd52bc7-4522-422e-a6fa-0677829698b0</guid><dc:creator>Muqarrab</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/66788/issue-on-writing-custom-characteristics/273404#273404"]Are you sure this happens in the project that you sent to me? Can you please try to unzip it in an unmodified SDK? Try to download the SDK again, and unzip it. Don&amp;#39;t change anything outside the project folder that you attached here. Does the issues still occur?[/quote]
&lt;p&gt;I have followed the steps but still getting the same issue.&lt;br /&gt;Are you able to read value &amp;quot;&lt;strong&gt;0x24&lt;/strong&gt;&amp;quot; on characteristics no 4 when you write any value on&amp;nbsp;&lt;span&gt;characteristics no 4&lt;/span&gt;&lt;br /&gt;from nRF App?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/thread/273404?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 09:00:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c58c554-a1d6-48f2-a57e-037f2a554bb8</guid><dc:creator>Edvin</dc:creator><description>[quote user="muqarrab_rahman"]I don&amp;#39;t know how to debug next. Can you please guide?&lt;br /&gt;I have also attached my project can you please check for once.[/quote]
&lt;p&gt;&amp;nbsp;I have tried your project, and I don&amp;#39;t get any of the errors that you get.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Go to the definition of&amp;nbsp;nrf_ble_qwr_conn_handle_assign() and set a breakpoint inside it. When the breakpoint hits, check that the p_qwr pointer is not NULL, and check the value of p_qwr-&amp;gt;initialized. What is that value?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="muqarrab_rahman"]I am getting the following issue.[/quote]
&lt;p&gt;&amp;nbsp;Are you sure this happens in the project that you sent to me? Can you please try to unzip it in an unmodified SDK? Try to download the SDK again, and unzip it. Don&amp;#39;t change anything outside the project folder that you attached here. Does the issues still occur?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/thread/273388?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 08:28:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8d4a8a0-c86a-4cf7-9a3b-2da040e7d574</guid><dc:creator>Muqarrab</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/66788/issue-on-writing-custom-characteristics/273379#273379"]So what does sd_ble_gatts_value_set() return before it prints &amp;quot;Point 1&amp;quot;?[/quote]
&lt;p&gt;I am getting the following issue.&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1602059241143v1.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/66788/issue-on-writing-custom-characteristics/273379#273379"]&amp;nbsp;So why does nrf_ble_qwr_conn_handle_assign() return 8? What check or what function inside nrf_ble_qwr_conn_handle_assign() causes it to return 8? Please try to debug this.[/quote]
&lt;p&gt;I don&amp;#39;t know how to debug next. Can you please guide?&lt;br /&gt;I have also attached my project can you please check for once.&lt;br /&gt;Thanks!&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/thread/273387?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 08:27:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a0e66ca-429f-4421-a83a-c3d5c04761e4</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I looked a bit deeper into your project.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Inside&amp;nbsp;ble_cus_custom_value_update(), you are trying to send notifications on each of the characteristics. But none of your characteristics supports notifications. Also, your on_write() function never checks the return value of ble_cus_custom_value_update(). It always returns the value for sd_ble_gatts_hvx(), but I don&amp;#39;t think you have picked it up. The return value reflects that notifications are not supported.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/thread/273379?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 07:59:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c2346e6-49d4-4ea1-adf0-2bd24f26461b</guid><dc:creator>Edvin</dc:creator><description>[quote user="muqarrab_rahman"]I have debugged code and I have set different printouts and its printing &amp;quot;&lt;strong&gt;Point 1&lt;/strong&gt;&amp;quot; of the following code.[/quote]
&lt;p&gt;&amp;nbsp;So what does sd_ble_gatts_value_set() return before it prints &amp;quot;Point 1&amp;quot;?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="muqarrab_rahman"]I am adding it in the same way as adding others&amp;#39; characteristics.[/quote]
&lt;p&gt;&amp;nbsp;So why does nrf_ble_qwr_conn_handle_assign() return 8? What check or what function inside nrf_ble_qwr_conn_handle_assign() causes it to return 8? Please try to debug this.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/thread/273351?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 05:42:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:563a60e1-eead-4d3e-a6f1-1cade182bd2b</guid><dc:creator>Muqarrab</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/66788/issue-on-writing-custom-characteristics/273295#273295"]What happens when you &amp;quot;write from device side on characteristic no 4&amp;quot;? Can you describe the issue?[/quote]
&lt;p&gt;I have debugged code and I have set different printouts and its printing &amp;quot;&lt;strong&gt;Point 1&lt;/strong&gt;&amp;quot; of the following code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;      case 4:

      // Update database.
      err_code = sd_ble_gatts_value_set(p_cus-&amp;gt;conn_handle,
                                        p_cus-&amp;gt;custom_value_handles_4.value_handle,
                                        &amp;amp;gatts_value);

      if (err_code != NRF_SUCCESS)
      {
          NRF_LOG_INFO(&amp;quot;Point 1&amp;quot;);
          return err_code;
      }
      // Send value if connected and notifying.
      if ((p_cus-&amp;gt;conn_handle != BLE_CONN_HANDLE_INVALID)) 
      {
          NRF_LOG_INFO(&amp;quot;Point 2&amp;quot;);
          ble_gatts_hvx_params_t hvx_params;

          memset(&amp;amp;hvx_params, 0, sizeof(hvx_params));

          hvx_params.handle = p_cus-&amp;gt;custom_value_handles_4.value_handle;
          hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
          hvx_params.offset = gatts_value.offset;
          hvx_params.p_len  = &amp;amp;gatts_value.len;
          hvx_params.p_data = gatts_value.p_value;

          err_code = sd_ble_gatts_hvx(p_cus-&amp;gt;conn_handle, &amp;amp;hvx_params);
          NRF_LOG_INFO(&amp;quot;Point 3&amp;quot;);

      }
      else
      {
          NRF_LOG_INFO(&amp;quot;Point 4&amp;quot;);
          err_code = NRF_ERROR_INVALID_STATE;
       }
      break;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/66788/issue-on-writing-custom-characteristics/273295#273295"]&amp;nbsp;Where exactly did&amp;nbsp; you add this, and what does it return? Did you add it inside the nrf_ble_qwr_conn_handle_assign()?[/quote]
&lt;p&gt;I am adding it in the same way as adding others&amp;#39; characteristics.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t ble_cus_init(ble_cus_t * p_cus, const ble_cus_init_t * p_cus_init)
{
    if (p_cus == NULL || p_cus_init == NULL)
    {
        return NRF_ERROR_NULL;
    }

    uint32_t   err_code;
    ble_uuid_t ble_uuid;

    // Initialize service structure
    p_cus-&amp;gt;conn_handle               = BLE_CONN_HANDLE_INVALID;

    // Add Custom Service UUID
    ble_uuid128_t base_uuid = {CUSTOM_SERVICE_UUID_BASE};
    err_code =  sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;p_cus-&amp;gt;uuid_type);
    VERIFY_SUCCESS(err_code);
    
    ble_uuid.type = p_cus-&amp;gt;uuid_type;
    ble_uuid.uuid = CUSTOM_SERVICE_UUID;

    // Add the Custom Service
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &amp;amp;ble_uuid, &amp;amp;p_cus-&amp;gt;service_handle);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }

    // Add Custom value characteristic
    err_code = custom_value_char_add_1(p_cus, p_cus_init);// This line is not strictly needed, but if you plan to do more, don&amp;#39;t return this value
    APP_ERROR_CHECK(err_code);
    err_code = custom_value_char_add_2(p_cus, p_cus_init);
    APP_ERROR_CHECK(err_code);  
    err_code = custom_value_char_add_3(p_cus, p_cus_init);
    APP_ERROR_CHECK(err_code);  
    err_code = custom_value_char_add_4(p_cus, p_cus_init);
    APP_ERROR_CHECK(err_code);  
    err_code = custom_value_char_add_5(p_cus, p_cus_init);
    APP_ERROR_CHECK(err_code);  
    err_code = custom_value_char_add_6(p_cus, p_cus_init);
    APP_ERROR_CHECK(err_code);  
    err_code = custom_value_char_add_7(p_cus, p_cus_init);
    APP_ERROR_CHECK(err_code);  
    err_code = custom_value_char_add_8(p_cus, p_cus_init);
    APP_ERROR_CHECK(err_code);  
    err_code = custom_value_char_add_9(p_cus, p_cus_init);
    APP_ERROR_CHECK(err_code);  
    err_code = custom_value_char_add_10(p_cus, p_cus_init);
    APP_ERROR_CHECK(err_code); 
  
    return err_code;
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue on writing custom Characteristics</title><link>https://devzone.nordicsemi.com/thread/273295?ContentTypeID=1</link><pubDate>Tue, 06 Oct 2020 14:56:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2974785e-b853-4b45-a724-ca5b8f75ad67</guid><dc:creator>Edvin</dc:creator><description>[quote user=""]&lt;p&gt;&lt;strong&gt;1-Issue with Custom&amp;nbsp;&lt;/strong&gt;&lt;span&gt;&lt;strong&gt;Characteristics no 4:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have successfully re&lt;/span&gt;&lt;span&gt;ad/write on others 9&amp;nbsp;Characterist&lt;/span&gt;ics&amp;nbsp;but unable to write from device side on&amp;nbsp;Characteristics&amp;nbsp;no 4. (I am writing in &lt;strong&gt;on_write function&lt;/strong&gt; you can check in&amp;nbsp;&lt;strong&gt;ble_cus.c&lt;/strong&gt;)&lt;/p&gt;[/quote]
&lt;p&gt;&amp;nbsp;What happens when you &amp;quot;write from device side on characteristic no 4&amp;quot;? Can you describe the issue?&lt;/p&gt;
&lt;p&gt;By the way, you should check the return values on:&lt;/p&gt;
&lt;p&gt;err_code = sd_ble_gatts_hvx(p_cus-&amp;gt;conn_handle, &amp;amp;hvx_params);&lt;br /&gt; NRF_LOG_INFO(&amp;quot;Feedback On X&amp;quot;);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;strong&gt;2-Issue with Custom&amp;nbsp;&lt;/strong&gt;&lt;span&gt;&lt;strong&gt;Characteristics no 5:&lt;br /&gt;&lt;/strong&gt;When I add this I got following issue.&lt;/span&gt;[/quote]
&lt;p&gt;&amp;nbsp;Where exactly did&amp;nbsp; you add this, and what does it return? Did you add it inside the nrf_ble_qwr_conn_handle_assign()?&lt;/p&gt;
&lt;p&gt;Have you tried looking into nrf_ble_qwr_conn_handle_assign()? Try to debug and see why it returns 8.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>