<?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>err_code = device_instance_free(index); doesn&amp;#39;t work</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21991/err_code-device_instance_free-index-doesn-t-work</link><description>I use SDK9 s130 nRF51 in central mode. When I save 2 devices in my central, all ok.
In a 
 m_peer_table[index].id_bitmap
 
 i see that value 0xFF changed to 0XFC 
 But when I want to delete one of this bounded devices, I call function 
 device_instance_free</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 15 May 2017 13:46:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21991/err_code-device_instance_free-index-doesn-t-work" /><item><title>RE: err_code = device_instance_free(index); doesn't work</title><link>https://devzone.nordicsemi.com/thread/86291?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 13:46:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82062d69-28d6-4b29-8f61-daf07ca40a09</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Mikhail,&lt;/p&gt;
&lt;p&gt;Please be noted that after you call dm_device_delete_all() it won&amp;#39;t delete the bonded information immediately but only queue the process so the softdevice will schedule and delete it later.
You would need to wait for DM_EVT_SERVICE_CONTEXT_DELETED event in the device manager event handler to know that it&amp;#39;s deleted.&lt;/p&gt;
&lt;p&gt;Also please make sure you check the return code for dm_device_delete_all) if it returns NRF_SUCCESS or not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = device_instance_free(index); doesn't work</title><link>https://devzone.nordicsemi.com/thread/86290?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 07:38:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:decdb155-c363-4c1b-98b4-3e416c7152e9</guid><dc:creator>Mikhail</dc:creator><description>&lt;p&gt;void ble_reinit()
{&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;		softdevice_handler_sd_disable();

	char device_name[2 * MAX_STRING_SIZE];
	memset (device_name, 0, 2 * MAX_STRING_SIZE);
	strncat(device_name, /*(const char*)*/hex.name, hex.name_lenght);
	strncat(device_name, /*(const char*)*/hex.serial_number, hex.serial_number_lenght);
		
	ble_stack_init();
	ble_gap_params_init(device_name, (uint8_t *)pass.passkey, get_tx_power());			
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = device_instance_free(index); doesn't work</title><link>https://devzone.nordicsemi.com/thread/86289?ContentTypeID=1</link><pubDate>Mon, 15 May 2017 07:32:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86dc0238-d9ce-4978-bf61-ac7654316e1f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Mikhail: What do you have in ble_reinit() ?
Please try to step into dm_device_delete_all() and see if there is any error returned.&lt;/p&gt;
&lt;p&gt;Have you tried &lt;a href="https://github.com/NordicSemiconductor/nRF51-ble-peripheral-bond-handling"&gt;this example&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = device_instance_free(index); doesn't work</title><link>https://devzone.nordicsemi.com/thread/86287?ContentTypeID=1</link><pubDate>Fri, 12 May 2017 14:25:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1573228f-66f0-4042-88fc-4aa030e39942</guid><dc:creator>Mikhail</dc:creator><description>&lt;p&gt;Hello!
Yes, I tryed call&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;dm_device_delete_all(&amp;amp; m_dm_app_id);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I watching if first I call&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ble_reinit();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;than I call&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;dm_device_delete_all(&amp;amp; m_dm_app_id);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;at this case all deleted correct. If I just call&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;dm_device_delete_all(&amp;amp; m_dm_app_id);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;without&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; ble_reinit();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in this case no success, like I discribe in 1-st post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: err_code = device_instance_free(index); doesn't work</title><link>https://devzone.nordicsemi.com/thread/86288?ContentTypeID=1</link><pubDate>Fri, 12 May 2017 14:12:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b8e1ed1-d36b-4a06-a71d-7f1a76fddde0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Mikhail,&lt;/p&gt;
&lt;p&gt;Have you tried to call dm_device_delete() ?&lt;/p&gt;
&lt;p&gt;Could you check if the device re-connect and pair again?
There must be something else write to the id_bitmap. You can try putting an UART/RTT log on each place that modify the id_bitmap in the code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>