<?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>Removing bond from device, Windows keeps trying to connectn</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118117/removing-bond-from-device-windows-keeps-trying-to-connectn</link><description>I&amp;#39;m using the BLE mouse example, and the problem I&amp;#39;m having is if I remove the pairing/bonding information from the device, Windows will keep trying to pair with the device: Essentially, what I want is to only have one bond on the device. If a user presses</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Jan 2025 07:44:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118117/removing-bond-from-device-windows-keeps-trying-to-connectn" /><item><title>RE: Removing bond from device, Windows keeps trying to connectn</title><link>https://devzone.nordicsemi.com/thread/519922?ContentTypeID=1</link><pubDate>Fri, 24 Jan 2025 07:44:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20bbf34c-cbdb-4b14-9ace-5a02d4493860</guid><dc:creator>jerome.sc</dc:creator><description>&lt;p&gt;I&amp;#39;ve figured out what the problem was. When turning off the BLE from the PC, I advertise using the accept list&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;adv_param&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;options&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;|=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;BT_LE_ADV_OPT_FILTER_CONN&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;But after pressing the button to clear the bonds I don&amp;#39;t remove &lt;span&gt;BT_LE_ADV_OPT_FILTER_CONN&lt;/span&gt;, but I&amp;#39;ve added the else clause which fixed it.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	if (option != 0)
	{
		adv_param.options |= BT_LE_ADV_OPT_FILTER_CONN;
		printk(&amp;quot;Using filter accept list\n&amp;quot;);
	}
	else
	{
		adv_param.options = (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME),
		printk(&amp;quot;Not using filter accept list\n&amp;quot;);
	}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Out of curiosity, does scanning the packets show these parameters, because I couldn&amp;#39;t see it on wireshark&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing bond from device, Windows keeps trying to connectn</title><link>https://devzone.nordicsemi.com/thread/519918?ContentTypeID=1</link><pubDate>Fri, 24 Jan 2025 07:32:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e26c3279-4842-455e-a720-689695ee62e7</guid><dc:creator>jerome.sc</dc:creator><description>&lt;p&gt;I&amp;#39;ve been changing the code around which is why it wasn&amp;#39;t there, sorry.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve captured packets, but I&amp;#39;m not sure that&amp;#39;s it&amp;#39;s giving useful information&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1737702770685v1.png" /&gt;&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve also seen these packets&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1737703434588v1.png" /&gt;&lt;br /&gt;&lt;br /&gt;Pressing the button to clear the bonds, filter list and change the address looks like this&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;		int err;

		pairing_button = true;

		err = bt_conn_disconnect(conn_mode-&amp;gt;conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN);
		if (err) {
			printk(&amp;quot;Cannot disconnect err= %d \n&amp;quot;, err);
		}
		else
			printk(&amp;quot;Disconnected device\n&amp;quot;);

		err = bt_le_adv_stop();
		if (err) {
			printk(&amp;quot;Cannot stop advertising err= %d \n&amp;quot;, err);
			return;
		}
		else
			printk(&amp;quot;Advertising stopped\n&amp;quot;);
		
		err = bt_unpair(BT_ID_1, NULL);
		if (err) {
			printk(&amp;quot;Cannot unpair for default ID&amp;quot;);
			return err;
		}
		else
			printk(&amp;quot;Unpaired\n&amp;quot;);

		for (size_t i = 1; i &amp;lt; CONFIG_BT_ID_MAX; i++) {
			err = bt_id_reset(i, NULL, NULL);
			if (err &amp;lt; 0) {
				printk(&amp;quot;Cannot reset id %zu (err %d)\n&amp;quot;, i, err);
			}
			else
				printk(&amp;quot;Reset id: %d\n&amp;quot;, i);
		}

		err = bt_le_filter_accept_list_clear();
		if (err) {
			printk(&amp;quot;Cannot clear accept list (err: %d)\n&amp;quot;, err);
		} else {
			printk(&amp;quot;Accept list cleared succesfully\n&amp;quot;);
		}

		k_work_submit(&amp;amp;advertise_acceptlist_work);

		pairing_button = false;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing bond from device, Windows keeps trying to connectn</title><link>https://devzone.nordicsemi.com/thread/519706?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2025 09:35:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:408f23bc-c468-42ca-9d75-53ca58866e27</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There should not be a need to disable and re-enable the Bluetooth stack. When the central is not able to connect, is the advertising connectable? And is the device advertising without a whitelist? Could it be that the whitelist is still populated, perhaps becaue the bond has not been deleted (I don&amp;#39;t see bt_unpair() here anymore, but perhaps that is just that it was not copy pasted in here)? Do you have logs and a sniffer trace that shows what is happening?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing bond from device, Windows keeps trying to connectn</title><link>https://devzone.nordicsemi.com/thread/519498?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 10:26:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62c21be4-9432-4c18-ab76-6f5d1d267054</guid><dc:creator>jerome.sc</dc:creator><description>&lt;p&gt;Hello, thanks for the response.&lt;br /&gt;&lt;br /&gt;Due to the very limited amount of RAM, in the .conf file I&amp;#39;ve set&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_MAX_CONN&lt;/span&gt;&lt;span&gt;=1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_MAX_PAIRED&lt;/span&gt;&lt;span&gt;=1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_HIDS_MAX_CLIENT_COUNT&lt;/span&gt;&lt;span&gt;=1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_BT_ID_MAX&lt;/span&gt;&lt;span&gt;=2&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;So I&amp;#39;ve set the CONFIG_ID_MAX to 2 as I&amp;#39;ve read in one post that you can reset the address of default ID. In main create another ID&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; bt_addr_le_t addr;
size_t id_count;

bt_id_get(&amp;amp;addr, &amp;amp;id_count);
    if (id_count &amp;lt; CONFIG_BT_ID_MAX)
    {
        err = bt_id_create(NULL, NULL);
        if (err &amp;lt; 0) {
            printk(&amp;quot;Creating new ID failed (err %d)\n&amp;quot;, err);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;Everything seems to work, but if there is no connection and the button to clear the filter and reset the ID is pressed, the device will still advertise but nothing can connect to it.&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;		err = bt_le_adv_stop();
		if (err) {
			printk(&amp;quot;Cannot stop advertising err= %d \n&amp;quot;, err);
			return;
		}
		
		err = bt_le_filter_accept_list_clear();
		if (err) {
			printk(&amp;quot;Cannot clear accept list (err: %d)\n&amp;quot;, err);
		} else {
			printk(&amp;quot;Accept list cleared succesfully\n&amp;quot;);
		}

		for (size_t i = 1; i &amp;lt; CONFIG_BT_ID_MAX; i++) {
			err = bt_id_reset(i, NULL, NULL);
			if (err &amp;lt; 0) {
				printk(&amp;quot;Cannot reset id %zu (err %d)\n&amp;quot;, i, err);
			}
			else
				printk(&amp;quot;Reset id: %d\n&amp;quot;, i);
		}

		k_work_submit(&amp;amp;advertise_acceptlist_work);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; If I press the reset button, then it will start working as normal, so I wonder if something is going wrong and&amp;nbsp;bt_enable() needs to be called again.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing bond from device, Windows keeps trying to connectn</title><link>https://devzone.nordicsemi.com/thread/519487?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2025 09:28:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64a0d00c-468d-4acb-807c-4459fb8d9973</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;-12 is&amp;nbsp;ENOMEM, and this is returned from&amp;nbsp;bt_le_adv_start() when there are no more available connections. This typically happens because there is still an active connection(?), or that the connection object has not been freed yet from a disconnect that occured immediately before. See the description of that situation &lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-5-bluetooth-le-security-fundamentals/topic/blefund-lesson-5-exercise-2/"&gt;here&lt;/a&gt;. If this is it, the simplest is to set&amp;nbsp;CONFIG_BT_MAX_CONN in your prj.conf to a higher number.&lt;/p&gt;
&lt;p&gt;PS: You can refer to the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/a5e4efe25d070995701534193bc786779f34d9fd/samples/bluetooth/peripheral_with_multiple_identities"&gt;Bluetooth: Peripheral with multiple identities&lt;/a&gt;&amp;nbsp;sample to see how to configure more identities/addresses.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing bond from device, Windows keeps trying to connectn</title><link>https://devzone.nordicsemi.com/thread/519031?ContentTypeID=1</link><pubDate>Mon, 20 Jan 2025 10:46:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b61dca36-d559-441a-ac8f-d3ad4f848639</guid><dc:creator>jerome.sc</dc:creator><description>&lt;p&gt;Update&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve changed the code to use bt_id_reset and passed in an address, but getting:&lt;br /&gt;&lt;br /&gt;Accept list cleared succesfully&lt;br /&gt;Cannot start open advertising (err: -12)&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;		err = bt_unpair(BT_ID_DEFAULT, NULL);
		if (err) {
			printk(&amp;quot;Cannot unpair for default ID&amp;quot;);
			return err;
		}
		
		int err_code = bt_le_adv_stop();
		if (err_code) {
			printk(&amp;quot;Cannot stop advertising err= %d \n&amp;quot;, err_code);
			return;
		}

		err_code = bt_le_filter_accept_list_clear();
		if (err_code) {
			printk(&amp;quot;Cannot clear accept list (err: %d)\n&amp;quot;, err_code);
		} else {
			printk(&amp;quot;Accept list cleared succesfully\n&amp;quot;);
		}

		bt_addr_le_t addr;
		err = bt_addr_le_from_str(&amp;quot;FF:EE:DD:CC:BB:AA&amp;quot;, &amp;quot;random&amp;quot;, &amp;amp;addr);
		if (err) {
			printk(&amp;quot;Invalid BT address (err %d)\n&amp;quot;, err);
		}

		for (size_t i = 1; i &amp;lt; CONFIG_BT_ID_MAX; i++) {
			err = bt_id_reset(i, &amp;amp;addr, NULL);
			if (err &amp;lt; 0) {
				LOG_ERR(&amp;quot;Cannot reset id %zu (err %d)&amp;quot;, i, err);
				return err;
			}
		}

		err_code = bt_le_adv_start(BT_LE_ADV_CONN_NO_ACCEPT_LIST, ad,
						ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

		if (err_code) {
			printk(&amp;quot;Cannot start open advertising (err: %d)\n&amp;quot;, err_code);
		} else {
			printk(&amp;quot;Advertising in pairing mode started&amp;quot;);
		}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing bond from device, Windows keeps trying to connectn</title><link>https://devzone.nordicsemi.com/thread/519012?ContentTypeID=1</link><pubDate>Mon, 20 Jan 2025 09:46:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19620054-b718-4bb4-a9ab-aa54288a3de5</guid><dc:creator>jerome.sc</dc:creator><description>&lt;p&gt;Ok thanks, I figured it was something to do with changing the device address.&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve merged the filter accept functions from the academy example, so when the mouse HID example runs, it only allows filtered devices to connect. I&amp;#39;ve used a button to call BT unpair, the same as the academy example.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This causes the same problem as before, of Windows keep on trying to connect. This is probably due to me not changing the address.&lt;br /&gt;&lt;br /&gt;My question is, how do I change the address?&lt;br /&gt;&lt;br /&gt;My current implementation is shown below, but I&amp;#39;m getting errors&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;		int err = bt_le_adv_stop();

		if (err) {
			printk(&amp;quot;Cannot stop Bluetooth LE advertising (err: %d)&amp;quot;, err);
			return err;
		}
		
		err = bt_unpair(BT_ID_DEFAULT, NULL);
		if (err) {
			printk(&amp;quot;Cannot unpair for default ID&amp;quot;);
			return err;
		}

		bt_addr_le_t addr;
		int err = bt_addr_le_from_str(&amp;quot;FF:EE:DD:CC:BB:AA&amp;quot;, &amp;quot;random&amp;quot;, &amp;amp;addr);
		if (err) {
			printk(&amp;quot;Invalid BT address (err %d)\n&amp;quot;, err);
		}

		err = bt_id_create(&amp;amp;addr, NULL);
		if (err &amp;lt; 0) {
			printk(&amp;quot;Creating new ID failed (err %d)\n&amp;quot;, err);
		}

		k_work_submit(&amp;amp;advertise_acceptlist_work);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Errors&lt;/p&gt;
&lt;p&gt;Accept list cleared succesfully&lt;br /&gt;Creating new ID failed (err -12)&lt;br /&gt;Cannot start open advertising (err: -12)&lt;br /&gt;I: BAS Notifications disabled&lt;br /&gt;Disconnected from D8:80:83:21:0F:12 (public) (reason 22)&lt;br /&gt;Advertising with no Accept list &lt;br /&gt;Advertising successfully started&lt;br /&gt;Connected D8:80:83:21:0F:12 (public)&lt;br /&gt;Disconnected from D8:80:83:21:0F:12 (public) (reason 19)&lt;br /&gt;Advertising with no Accept list &lt;br /&gt;Advertising successfully started&lt;br /&gt;Connected D8:80:83:21:0F:12 (public)&lt;br /&gt;Disconnected from D8:80:83:21:0F:12 (public) (reason 19)&lt;br /&gt;Advertising with no Accept list &lt;br /&gt;Advertising successfully started&lt;br /&gt;Connected D8:80:83:21:0F:12 (public)&lt;br /&gt;Disconnected from D8:80:83:21:0F:12 (public) (reason 19)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Removing bond from device, Windows keeps trying to connectn</title><link>https://devzone.nordicsemi.com/thread/518856?ContentTypeID=1</link><pubDate>Fri, 17 Jan 2025 13:30:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40c66acc-3117-47c3-920e-8eff93867fed</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There are two separate aspects of this question. First, to remove bonds you use&amp;nbsp;bt_unpair(). If you pass NULL as the second parameters, alls bonds are deleted. You can also delte all identities, in the same way as is done in &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/7787b264984022cda64d9629278942053e6462a5/applications/nrf_desktop/src/modules/factory_reset.c#L37"&gt;bt_fast_pair_factory_reset_user_action_perform()&lt;/a&gt;&amp;nbsp;in the nrf desktop application.&lt;/p&gt;
&lt;p&gt;When it comes to preventing old computers from connecting, there are a few possible approaches, which can be combined. First of all, you want to advertise with filer accept list (whitelisting). This is demonstrated in &lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-5-bluetooth-le-security-fundamentals/topic/blefund-lesson-5-exercise-2/"&gt;this excercise in our BLE dev academy course&lt;/a&gt;. This will not prevent the computer from trying to connect, but will make sure that the bluetooth stack ingores the connection attempts. Secondly, a common approach for HID divces that supprort multiple computers via a button or similar, is to use different Bluetooth address for each device. You can do the same even if you only have a single bond at a time, for instance by changing address every time you delete the bond. This way, the computer will see the mouse as a new device after the address is changed, and not try to connect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>