<?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>Custom Notification Characteristic Not Updating</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94008/custom-notification-characteristic-not-updating</link><description>I&amp;#39;m new to nRF have done the &amp;quot;nRF Connect SDK Fundamentals&amp;quot;, course and have create a custom characteristic to read and write but I cannot get notification to work. 
 I&amp;#39;m using nRF Connect SDK (vsCode) and nRFConnect to view the BLE output on my iPhone</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Nov 2022 19:16:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94008/custom-notification-characteristic-not-updating" /><item><title>RE: Custom Notification Characteristic Not Updating</title><link>https://devzone.nordicsemi.com/thread/396753?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2022 19:16:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ddf04e3-5ac3-40ed-bf9d-f36032c266dd</guid><dc:creator>paulcardno</dc:creator><description>&lt;p&gt;thanks Hung&lt;br /&gt;Much appreciate the feedback and you comment about the characteristic declare and value did highlight some learning that I needed to do, so was well worth hearing. And the other comments and links where very help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Notification Characteristic Not Updating</title><link>https://devzone.nordicsemi.com/thread/396569?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2022 08:38:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e63826b-901a-417a-aa0e-ea8544cd50b0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Paul,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I think it&amp;#39;s my mistake. Either handle, characteristic declare or characteristic value would work. So in your case&amp;nbsp;&lt;span&gt;adc_svc.attrs[1] and&amp;nbsp;adc_svc.attrs[2] would work.&amp;nbsp;&lt;br /&gt;I was having the impression that&amp;nbsp;adc_svc.attrs[1] doesn&amp;#39;t work but it was because the length was 21 at that point. It was not because of&amp;nbsp;adc_svc.attrs[1].&amp;nbsp;&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: Custom Notification Characteristic Not Updating</title><link>https://devzone.nordicsemi.com/thread/396494?ContentTypeID=1</link><pubDate>Sat, 19 Nov 2022 03:04:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:faaca0bd-faf8-454f-b3b2-8148bfb2e797</guid><dc:creator>paulcardno</dc:creator><description>&lt;p&gt;Hi Hung&lt;/p&gt;
&lt;p&gt;Thanks you very much for this information. I was missing a couple of knowledge points and I have studied these, so thanks for this. Much appreciated.&lt;/p&gt;
&lt;p&gt;with the characteristic declaration versus characteristic value&lt;/p&gt;
&lt;p&gt;I tried&lt;/p&gt;
&lt;p&gt;rc = bt_gatt_notify(NULL, &amp;amp;adc_svc.attrs[2], &amp;amp;level, sizeof(level));&lt;/p&gt;
&lt;p&gt;which worked but I also tried&lt;/p&gt;
&lt;p&gt;rc = bt_gatt_notify(NULL, &amp;amp;adc_svc.attrs[1], &amp;amp;level, sizeof(level));&lt;/p&gt;
&lt;p&gt;and this worked also (checked that the firmware was updated by changing the service UUID).&lt;/p&gt;
&lt;p&gt;I assume this is what you are referring to. Or am a I missing something here. &lt;/p&gt;
&lt;p&gt;I also read your blog (thanks for the link), you say &amp;quot;For example in the following service, the&amp;nbsp;characteristic value of&amp;nbsp;BT_UUID_MY_SERVICE_TX and&amp;nbsp;BT_UUID_MY_SERVICE_TEMPERATURE are attrs[3] and attrs[6] respectively.&amp;quot;&lt;/p&gt;
&lt;p&gt;and then you say &amp;quot;...in the above example we have the ATT table for the service as follows:&amp;quot;&lt;/p&gt;
&lt;p&gt;with &amp;quot;&lt;/p&gt;
&lt;table style="margin-left:auto;margin-right:auto;"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;span&gt;TX Char value&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;So in my mind it looks like the first sentence should be attrs[4] for service_TX, am I missing something here also?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom Notification Characteristic Not Updating</title><link>https://devzone.nordicsemi.com/thread/396401?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2022 12:26:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a2cd7f2-6d58-47b4-a03c-a8bd01ad5ce8</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Paul,&amp;nbsp;&lt;br /&gt;From what I can see in the code is that you have a characteristic with notification permission. But you haven&amp;#39;t defined a CCCD characteristic so that the client can enable notification for the characteristic above it.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If you have a look at the NUS&amp;nbsp;service (\nrf\subsys\bluetooth\services\nus.c) in peripheral_uart &amp;nbsp;sample you can find this:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1668773343597v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also there were two more issue with&amp;nbsp;notify_adc(), first is that you are sending to attribute handle&amp;nbsp;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;adc_svc&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;attrs&lt;/span&gt;&lt;span&gt;[1&lt;/span&gt;&lt;span&gt;] which is the declaration of the characteristic, not the value. And secondly, you are trying to send 21 bytes when the maximum is 20 bytes (if you don&amp;#39;t use data length extension, max data length is 23 bytes and with 3 bytes overhead you have 20 bytes left )&lt;br /&gt;This would work:&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void notify_adc(void){
	printk(&amp;quot;notify adc2 &amp;quot;);
	static uint8_t level[20] = { &amp;#39;a&amp;#39;, &amp;#39;b&amp;#39;, &amp;#39;a&amp;#39;, &amp;#39;a&amp;#39;, &amp;#39;8&amp;#39;, &amp;#39;a&amp;#39;, &amp;#39;a&amp;#39;, &amp;#39;a&amp;#39;};

	int rc;
	rc = bt_gatt_notify(NULL, &amp;amp;adc_svc.attrs[2], &amp;amp;level, sizeof(level));

	return rc == -ENOTCONN ? 0 : rc;
}&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;With this in the declaration:&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;BT_GATT_SERVICE_DEFINE(adc_svc,
	BT_GATT_PRIMARY_SERVICE(&amp;amp;notification_uuid),
	BT_GATT_CHARACTERISTIC(&amp;amp;adc_notify_uuid.uuid, BT_GATT_CHRC_NOTIFY,
				BT_GATT_PERM_NONE, NULL, NULL, NULL),
	BT_GATT_CCC(NULL,     BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),

);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I would suggest to have a look at my blog &lt;a href="https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/building-a-ble-application-on-ncs-comparing-and-contrasting-to-softdevice-based-ble-applications#mcetoc_1elnnim8t3"&gt;here&lt;/a&gt;. In the blog I explained why you should use correct attribute handle.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>