<?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 service characteristic not initialized</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110186/custom-service-characteristic-not-initialized</link><description>Hi, 
 I have created a custom service correctly and now I want to add a characteristic to it that has notifications enabled so that I can be notified in value changes. For some after service is created without errors, the characteristic is not created</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 15 Apr 2024 10:33:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110186/custom-service-characteristic-not-initialized" /><item><title>RE: Custom service characteristic not initialized</title><link>https://devzone.nordicsemi.com/thread/478710?ContentTypeID=1</link><pubDate>Mon, 15 Apr 2024 10:33:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b6ea1c6-b5eb-428a-aec6-d0e574d7c5cc</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;I think I fixed it...&lt;/p&gt;
&lt;p&gt;I changed the attr_char_value.max_len from&amp;nbsp; BLE_GATTS_VAR_ATTR_LEN_MAX&amp;nbsp; to sizeof(uint8_t) and it worked.&lt;/p&gt;
&lt;p&gt;Actually it works with values up to 510 and then it produces the same error 12&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom service characteristic not initialized</title><link>https://devzone.nordicsemi.com/thread/478701?ContentTypeID=1</link><pubDate>Mon, 15 Apr 2024 09:42:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fed92af-0929-4320-9f71-6f9ab34c3cc4</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;Hi, I set the vloc as follow and now I get an Error 12.&lt;/p&gt;
&lt;p&gt;Then, I increased NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE &lt;br /&gt;from 1408 to 1600 with the corresponding changes in &lt;br /&gt;RAM_START and SIZE but the same error occurred.&lt;br /&gt;&lt;br /&gt;Then, I increased attr_char_value.init_len to a larger number (i.e. 10) but the same happened &lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ble_gatts_char_md_t char_md;
memset(&amp;amp;char_md, 0, sizeof(char_md));
char_md.char_props.notify = 1;  // Enable notifications
char_md.char_props.read = 1;

ble_gatts_attr_md_t attr_md;
memset(&amp;amp;attr_md, 0, sizeof(attr_md));

attr_md.vloc = BLE_GATTS_VLOC_STACK;
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&amp;amp;attr_md.write_perm);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom service characteristic not initialized</title><link>https://devzone.nordicsemi.com/thread/478682?ContentTypeID=1</link><pubDate>Mon, 15 Apr 2024 08:59:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74196ac6-62d7-403a-ae91-7d1452c79db8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Return value 7 is&amp;nbsp;NRF_ERROR_INVALID_PARAM. One thing I notice is that you have not set attr_md VLOCK, so that needs to be set. As you use a value on the stack, you need to set this to&amp;nbsp;BLE_GATTS_VLOC_STACK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>