<?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>HID Keyboard Example - how to create new bond without deleting old bond</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73538/hid-keyboard-example---how-to-create-new-bond-without-deleting-old-bond</link><description>I&amp;#39;m learning whitelisting with the HID Keyboard Example nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_hids_keyboard\ 
 Question - is there a way to create a new bond without deleting an old one? 
 Using the vanilla example, if I bond it to my</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Apr 2021 06:11:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73538/hid-keyboard-example---how-to-create-new-bond-without-deleting-old-bond" /><item><title>RE: HID Keyboard Example - how to create new bond without deleting old bond</title><link>https://devzone.nordicsemi.com/thread/305205?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 06:11:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a0077da-7b1b-4708-9667-3c336371368b</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Reply in this case&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/support-private/support/267828"&gt;https://devzone.nordicsemi.com/support-private/support/267828&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID Keyboard Example - how to create new bond without deleting old bond</title><link>https://devzone.nordicsemi.com/thread/303604?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 19:57:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e135a2f-eddc-4c43-9a7a-e501304e3e34</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;I will look into that case and reply later.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID Keyboard Example - how to create new bond without deleting old bond</title><link>https://devzone.nordicsemi.com/thread/303600?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 18:47:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30a9baf0-f174-4134-9608-ca13e9a83d79</guid><dc:creator>benmack</dc:creator><description>&lt;p&gt;Thanks Amanda&lt;/p&gt;
&lt;p&gt;It was indeed a problem of duplicate entries. Adding code to the &lt;span&gt;PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event handler sorted it. Part of my confusion is that I have whitelists at both ends, to ensure I only ever have a 1:1 bonded connection.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;However I have now broken it again.... I modified the code to use NUS services in place of the HRS&amp;amp;BAS&amp;amp;DIS services of the HRS example, and now I cannot establish a bonded connection at all. The pm_evt_handler just doesn&amp;#39;t get called at all. Any clues on how to diagnose this? &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It was working fine with the HRS services, and I made no changes to the peer manager init, advertising etc., just to the services. The central now connects to the periph with no pm events, and no bonding. I clearly don&amp;#39;t understand how to force only bonded connections, any pointers welcome. I had added code to PM_EVT_CONN_SEC_FAILED to disconnect unbonded connections, but of course if pm_evt_handler is not even called this doesn&amp;#39;t help...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I guess this thread is morphing into my other query &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/73528/peer-manager-bonding---no-pm-events-when-connecting" rel="noopener noreferrer" target="_blank"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/73528/peer-manager-bonding---no-pm-events-when-connecting&lt;/a&gt; but I had no replies to that&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks, any help much appreciated&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID Keyboard Example - how to create new bond without deleting old bond</title><link>https://devzone.nordicsemi.com/thread/303516?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 12:49:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:382f0e83-7929-44d2-81a9-bf972c68b7e0</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;(updated)&lt;/p&gt;
&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
[quote user="benmack"]The central node reports &amp;quot;&amp;lt;info&amp;gt; peer_manager_handler: Connection security failed: role: Central, conn_handle: 0x0, procedure: Encryption, error: 4352&amp;quot;[/quote]
&lt;p&gt;Could you try to debug and find out which function returns the error code?&lt;/p&gt;
[quote user="benmack"]Any clues as to why the original bonded connection is saved fine (and whitelist advertising works for it), but the &amp;quot;repaired&amp;quot; connection is not saved?[/quote]
&lt;p&gt;&lt;span&gt;Tthe PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event handler code in pm_evt_handler() might need to be modified to the first check for the device on the list and keep the existing entry, only adding a new one if it does not already exist.&amp;nbsp;Check out&amp;nbsp;another post&amp;nbsp;&lt;a title="Here" href="https://devzone.nordicsemi.com/f/nordic-q-a/36137/return-error-by-pm_device_identities_list_set"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/36137/return-error-by-pm_device_identities_list_set&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="benmack"]I must admit I&amp;#39;m struggling to debug peer manager stuff - are there any tricks I&amp;#39;m missing?[/quote]
&lt;p&gt;You could enable&amp;nbsp;PM_LOG_ENABLED 1 and modify&amp;nbsp;PM_LOG_LEVEL to&amp;nbsp;Debug (4) in the sdk_config.h, and&amp;nbsp;build the project with Debug mode in Segger.&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID Keyboard Example - how to create new bond without deleting old bond</title><link>https://devzone.nordicsemi.com/thread/303425?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 09:56:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e233858-69ef-43a8-8742-152003730935</guid><dc:creator>benmack</dc:creator><description>&lt;p&gt;Ah, doesn&amp;#39;t work, this &amp;quot;allow_repairing&amp;quot; allows the new bonded connection to be established, but if I then restart the nodes they fail to connect.&lt;/p&gt;
&lt;p&gt;To help debug I&amp;#39;ve copied this whitelist advertising stuff to the hrs example so I can debug both ends. The central node reports &amp;quot;&amp;lt;info&amp;gt; peer_manager_handler: Connection security failed: role: Central, conn_handle: 0x0, procedure: Encryption, error: 4352&amp;quot;&lt;/p&gt;
&lt;p&gt;From what I can tell, the new bonded connection is not saved to flash (after repair). Any clues as to why the original bonded connection is saved fine (and whitelist advertising works for it), but the &amp;quot;repaired&amp;quot; connection is not saved?&lt;/p&gt;
&lt;p&gt;I must admit I&amp;#39;m struggling to debug peer manager stuff - are there any tricks I&amp;#39;m missing? I&amp;#39;m mainly relying on debug logging (using RTT NRF_LOG stuff) and breakpoints in pm_evt_handler()&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HID Keyboard Example - how to create new bond without deleting old bond</title><link>https://devzone.nordicsemi.com/thread/302891?ContentTypeID=1</link><pubDate>Fri, 02 Apr 2021 12:37:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdfe54e1-5575-4a8a-a73f-6f985ba74ceb</guid><dc:creator>benmack</dc:creator><description>&lt;p&gt;Please ignore, I&amp;#39;ve just found the answer here&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/51274/bonding-doesn-t-work-after-deleting-bond-info-on-nrf-connect" rel="noopener noreferrer" target="_blank"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/51274/bonding-doesn-t-work-after-deleting-bond-info-on-nrf-connect&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What I had missed is that the peer manager recognises the pairing request as from an already bonded peer (i.e. same laptop), so rejects it (to avoid attacks that update bonding info). Solution is to to enable allow_repairing. I just added following to pm_evt_handler()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        case PM_EVT_CONN_SEC_CONFIG_REQ:
            pm_conn_sec_config_t conn_sec_config = {.allow_repairing = true};
            pm_conn_sec_config_reply(p_evt-&amp;gt;conn_handle, &amp;amp;conn_sec_config);
            break;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For my application I&amp;#39;ll maybe just do that once it has been put back in pairing mode (i.e. I keep the old bond, but accept new ones)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>