<?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>Getting error code 4 while trying to initialize device information services repeatedly from main</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63734/getting-error-code-4-while-trying-to-initialize-device-information-services-repeatedly-from-main</link><description>Hi 
 I am working on the application in which I wanted to initialize and uninitialize different services. I am using device information services to read manufacturer data from connected devices. 
 below is my code snippet for initialization and initialization</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Jul 2020 09:12:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63734/getting-error-code-4-while-trying-to-initialize-device-information-services-repeatedly-from-main" /><item><title>RE: Getting error code 4 while trying to initialize device information services repeatedly from main</title><link>https://devzone.nordicsemi.com/thread/260076?ContentTypeID=1</link><pubDate>Wed, 15 Jul 2020 09:12:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c88e635-94f2-4b37-ae28-8c75d3261cb4</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Amit,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you explain why you want to call&amp;nbsp;&lt;span&gt;ble_dis_init() 4th time ?&amp;nbsp;&lt;br /&gt;The way our softdevice designed, it&amp;#39;s only possible to add service/characteristic, but not to remove them.&amp;nbsp;&lt;br /&gt;You can also think of having the characteristic reside in the user memory instead of stack memory (is_value_user=1)&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting error code 4 while trying to initialize device information services repeatedly from main</title><link>https://devzone.nordicsemi.com/thread/260055?ContentTypeID=1</link><pubDate>Wed, 15 Jul 2020 08:17:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3737fdc-c882-446a-87e8-540eff6709d0</guid><dc:creator>Amit Kanade</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Actually i am also getting the same problem and as you suggested increase the NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE so i increase it from 1408 to 1600( in bytes ).&lt;/p&gt;
&lt;p&gt;After changing the&amp;nbsp;NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE still it gives error code 4 but this time it goes in error when i try to call &amp;quot;ble_dis_init&amp;quot; function 4th time.&lt;/p&gt;
&lt;p&gt;i investigate the error and find that it gives the error in &amp;quot;&lt;strong&gt;char_add&lt;/strong&gt;&amp;quot; function&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Add characteristics&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (p_dis_init-&amp;gt;manufact_name_str.length &amp;gt; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; err_code = char_add(BLE_UUID_MANUFACTURER_NAME_STRING_CHAR,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_dis_init-&amp;gt;manufact_name_str.p_str,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_dis_init-&amp;gt;manufact_name_str.length,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_dis_init-&amp;gt;dis_char_rd_sec,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;manufact_name_handles);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (err_code != NRF_SUCCESS)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return err_code;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;so according to me when we are repeatedly calling the dis service init, attributes are created in database and when it reaches maximum&amp;nbsp; attribute tab size which we are giving by NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE macro, code gives NO_MEMORY ERROR&lt;/p&gt;
&lt;p&gt;is there any way to delete the attribute which is created in database at the time of dis service initialization, so we will delete that at the time of uninit of dis service. &amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Getting error code 4 while trying to initialize device information services repeatedly from main</title><link>https://devzone.nordicsemi.com/thread/259927?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 13:46:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e96686f-0e47-4bde-9e46-362193b0bc85</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi KRA,&lt;/p&gt;
&lt;p&gt;Error 4 means&amp;nbsp;NRF_ERROR_NO_MEM most likely thrown by&amp;nbsp;sd_ble_gatts_service_add() inside ble_dis_init() in ble_dis.c&lt;br /&gt;You would need to increase the&amp;nbsp;NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE since you have added more service into the softdevice&amp;#39;s attribute table.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>