<?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>Reconnect to bonded BLE peer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/103670/reconnect-to-bonded-ble-peer</link><description>Hi, 
 I&amp;#39;m using S132 with nRF5_SDK_17.1.0_ddde560 on PCA10040 DK. My board is BLE peripheral and my smartphone is BLE central. Here is how I want the application to work: The board advertises publicly. The smartphone pairs and bonds. From now on, the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 Sep 2023 09:58:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/103670/reconnect-to-bonded-ble-peer" /><item><title>RE: Reconnect to bonded BLE peer</title><link>https://devzone.nordicsemi.com/thread/448104?ContentTypeID=1</link><pubDate>Thu, 28 Sep 2023 09:58:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7693447e-977d-4c9f-a2b0-afed4c1688ed</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Sorry for these long delays Xander,&amp;nbsp;&lt;/p&gt;
[quote user="Xander To"]Is there any example on using the&amp;nbsp;&lt;span&gt;softdevice advertising API you mentioned?&lt;/span&gt;[/quote]
&lt;p&gt;There are a lot of examples that we have that use softdevice API directly. For example a quick search in the sdk shows this&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/pastedimage1695894883513v2.png" alt=" " /&gt;&lt;/p&gt;
[quote user="Xander To"]If I remove a device form bonded list,&amp;nbsp;is the device also removed from whitelist? I don&amp;#39;t know why but if I call pm_peers_delete() after setup BLE and start advertising (not connected), the app will crash. [/quote]
&lt;p&gt;No, whitelisting and bonding are two different things. Can you please be more specific on what you mean by app crash? Do you have error numbers, logs or the context in which the app crashes?&lt;/p&gt;
[quote user="Xander To"]&amp;nbsp;Also, is the bonded peer info is stored even in event of power loss?[/quote]
&lt;p&gt;Yes, this is saved persistently in the flash by the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Flib_pm_functionality.html&amp;amp;cp=9_1_3_2_7_1_1&amp;amp;anchor=lib_pm_functionality_peers"&gt;peer manager&lt;/a&gt; using &amp;nbsp;FDS, please look into&amp;nbsp;components\ble\peer_manager\peer_data_storage.c for how this is done.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnect to bonded BLE peer</title><link>https://devzone.nordicsemi.com/thread/447287?ContentTypeID=1</link><pubDate>Fri, 22 Sep 2023 17:41:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cf0aaf4-df77-4026-a038-aef2fa6ee431</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;Please let me know your thought.&amp;nbsp;&lt;span style="font-family:inherit;"&gt;I&amp;#39;m still looking forward to it. Thank you.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;Best regards&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnect to bonded BLE peer</title><link>https://devzone.nordicsemi.com/thread/446332?ContentTypeID=1</link><pubDate>Fri, 15 Sep 2023 15:08:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82b0a704-a0f3-457f-a736-6543eb2c0cc0</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Apologies for the delays, I did not manage to look into your query today. I will respond to you after the weekend.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnect to bonded BLE peer</title><link>https://devzone.nordicsemi.com/thread/445705?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2023 20:29:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f9035b4-45f5-4216-87df-5aa4433c6074</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/103670/reconnect-to-bonded-ble-peer/445632"]If you want to have full control on the advertising, then do no use Advertising module and&amp;nbsp;use softdevice advertising APi directly like&amp;nbsp;sd_ble_gap_adv_set_configure and&amp;nbsp;sd_ble_gap_adv_start.[/quote]
&lt;p&gt;Is there any example on using the&amp;nbsp;&lt;span&gt;softdevice advertising API you mentioned?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you please explain what extended advertising does in&amp;nbsp;&lt;/span&gt;ble_adv_extended_enabled&lt;span&gt;?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If I remove a device form bonded list,&amp;nbsp;is the device also removed from whitelist? I don&amp;#39;t know why but if I call pm_peers_delete() after setup BLE and start advertising (not connected), the app will crash. It doesn&amp;#39;t crash at the pm_peers_delete function.&amp;nbsp;The way it crashes is that the Advertising module triggers event&amp;nbsp;&lt;/span&gt;BLE_ADV_EVT_PEER_ADDR_REQUEST once,&amp;nbsp; then enter Fast advertising, then trigger &lt;span&gt;BLE_ADV_EVT_PEER_ADDR_REQUEST the &lt;strong&gt;second&lt;/strong&gt; &lt;strong&gt;time immediately&lt;/strong&gt;,&amp;nbsp;&lt;/span&gt;which cause crash on the second triggering. Normally,&amp;nbsp;BLE_ADV_EVT_PEER_ADDR_REQUEST event is trigger once and enter Fast advertising. I configure Fast advertising interval to be 5 minutes so it cannot be due to timeout of Fast advertising and move to Idle state.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;Also, is the bonded peer info is stored even in event of power loss?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Finally, this is weird but after I added these line&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;pm_handler_on_pm_evt(p_evt);
pm_handler_disconnect_on_sec_failure(p_evt);
pm_handler_flash_clean(p_evt);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; at the beginning of function&amp;nbsp;&lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;pm_evt_handler&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;pm_evt_t&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;const&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;p_evt&lt;/span&gt;&lt;span&gt;), I no longer receive any Peer Manager Event such as&amp;nbsp;&lt;/span&gt;PM_EVT_BONDED_PEER_CONNECTED or&amp;nbsp;PM_EVT_CONN_SEC_SUCCEEDED. The reason I added these lines because I&amp;#39;m trying to clear the bonded history so I can test the directed advertising with peer_id but&amp;nbsp;doing pm_peers_delete() crash the app as I mentioned earlier so I just tried anything I found on the forum.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Xander&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnect to bonded BLE peer</title><link>https://devzone.nordicsemi.com/thread/445632?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2023 12:38:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:740dd0d4-17cf-4af3-a0e3-da5d29fcefa4</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user=""]Firstly, to limit only 1 device can bond, should I set&amp;nbsp;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;SEC_PARAM_BOND&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;There is no way we can force limitation on the number of bonds as of now without modifying peer manager source files. You probably have to remember in the application in a static variable or similar that the device is bonded to one device.&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;span&gt;. Is it&amp;nbsp;&lt;/span&gt;&lt;span&gt;ble_advertising_start&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;m_advertising,&lt;/span&gt;BLE_ADV_EVT_DIRECTED&lt;span&gt;)&lt;/span&gt;[/quote]
&lt;p&gt;Yes, you only send directed advertising to the bonded device so that no other legit scanner picks up your advertising packet.&lt;/p&gt;
[quote user=""]I set&amp;nbsp;&lt;span&gt;BLE_ADV_MODE_DIRECTED_HIGH_DUTY&amp;nbsp; mode for advertise, but somehow the board enter &amp;quot;High Duty Directed advertising&amp;quot; and then switch to &amp;quot;Fast advertising with whitelist&amp;quot; rightaway and this happens even with first time flash the board and after connect and disconnect BLE?&lt;/span&gt;&amp;nbsp;I[/quote]
&lt;p&gt;That is because you might be using &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Flib_ble_advertising.html"&gt;BLE Advertising module&lt;/a&gt;&amp;nbsp;that has a default params change based on the state of your connection and time. If you want to have full control on the advertising, then do no use Advertising module and&amp;nbsp;use softdevice advertising APi directly like&amp;nbsp;sd_ble_gap_adv_set_configure and&amp;nbsp;sd_ble_gap_adv_start.&lt;/p&gt;
[quote user=""]Finally, how to remove a device from bonded list? Is it&amp;nbsp;pm_peer_delete()?&amp;nbsp;[/quote]
&lt;p&gt;Correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>