<?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>Central adds peripheral to the whitelist, but won&amp;#39;t reconnect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24248/central-adds-peripheral-to-the-whitelist-but-won-t-reconnect</link><description>I am developing an application which uses 2 nrf52 running sdk 12.3 and softdevice 132 V3. 
 The central device appears to be saving and whitelisting the two peers, but it won&amp;#39;t connect to them when I actually enable the whitelist - disable the whitelist</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Aug 2017 07:44:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24248/central-adds-peripheral-to-the-whitelist-but-won-t-reconnect" /><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95463?ContentTypeID=1</link><pubDate>Wed, 16 Aug 2017 07:44:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b455b91-907d-4f50-b5bf-91f22d1563f0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Nick: Please check , if both addr_cnt == 0 &amp;amp;&amp;amp; irk_cnt == 0 , whitelist will not be used at least that what in the code you posted. Could you please double check ?&lt;/p&gt;
&lt;p&gt;You can check the IRK on the central side. Try to connect with 2 peripheral, one by one. And see if the IRK matched for each device when you repeat the test.&lt;/p&gt;
&lt;p&gt;Note that you need to make sure the address is resolvable random address, otherwise the IRK is not relevant (if they are static addresses then the address should be used for whitelisting).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95462?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 12:27:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61c34156-f015-401c-9f79-b680e3aa3cea</guid><dc:creator>Nick Bentzen</dc:creator><description>&lt;p&gt;Hi Hung, reconnect() just resets/initializes some non-Bluetooth related stuff, nothing to do with the softdevice or the connection.&lt;/p&gt;
&lt;p&gt;When I have tested my code I erase the bonds on each device using a switch like in the examples, then test with both devices having erased their bonds but erase_bonds = 0.&lt;/p&gt;
&lt;p&gt;If m_whitelist_disabled = false in my central device, but it has no bonding information, it will connect and add the peripheral to peer manager, but when I restart (power cycle) the central device, it will not reconnect to that same peripheral.
Where do I check to see if the IRKs are consistent?  On the peripheral?  On the central?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95461?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2017 07:42:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a897236-ea66-4724-9cff-9a7b1eaf6c3d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Nick,&lt;/p&gt;
&lt;p&gt;Seems that the IRK is exchanged. Could you check if the IRK returned match with each of the central you connect ?&lt;/p&gt;
&lt;p&gt;What is in &amp;quot;reconnect() &amp;quot; ?&lt;/p&gt;
&lt;p&gt;Could you check if erase_bonds=1 when peer_manager_init() is called ? In our example we have a button to erase bond (and therefore whitelist), make sure it&amp;#39;s not pressed by default.&lt;/p&gt;
&lt;p&gt;One thing I don&amp;#39;t understand, in your question you said if you don&amp;#39;t use whitelist, everything works fine. If you use whitelist you can&amp;#39;t scan and connect. But then your whitelist is empty as you mentioned in your comment, so how could it make a different ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95467?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2017 16:22:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df90b8c6-e68c-4f8e-a9f4-4e7c9c0db5f9</guid><dc:creator>Nick Bentzen</dc:creator><description>&lt;p&gt;&lt;a href="https://postimg.org/gallery/20g2c4aem/"&gt;postimg.org/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll work on getting a dev kit set up as a sniffer.&lt;/p&gt;
&lt;p&gt;These are some relevant functions from the peripheral device.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://pastebin.com/CMkmnxnE"&gt;https://pastebin.com/CMkmnxnE&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95466?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2017 15:46:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b77e398d-eed4-436b-abfb-14abb79f4fa0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry Nick. I mean peer_data. You need to step into pdb_write_buf_store() and check what peer_data is extract from the database using write_buffer_record_find(). What inside peer_data can tell if the IRK/address is there.&lt;/p&gt;
&lt;p&gt;Can you capture a sniffer trace ?&lt;/p&gt;
&lt;p&gt;I suspect the peer device may not support bonding, just pairing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95471?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2017 13:59:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40f503c8-5131-4775-8bf3-6e76df7173bf</guid><dc:creator>Nick Bentzen</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure what you mean by that?  I thought peer_id was just an integer, there&amp;#39;s nothing in it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95469?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2017 13:16:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c83eb7c3-ebc7-458a-ba49-a36aca1bb9d1</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Could you check what in the peer_id ? It&amp;#39;s pretty strange to see everything is 8 if it&amp;#39;s not 0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95468?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2017 13:04:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e442b81b-7312-4297-872c-c5a67affda3f</guid><dc:creator>Nick Bentzen</dc:creator><description>&lt;p&gt;static void whitelist_load()
{
ret_code_t   ret;
pm_peer_id_t peers[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
uint32_t     peer_cnt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;memset(peers, PM_PEER_ID_INVALID, sizeof(peers));
peer_cnt = (sizeof(peers) / sizeof(pm_peer_id_t));

// Load all peers from flash and whitelist them.
peer_list_get(peers, &amp;amp;peer_cnt);
m_whitelist_peers = peer_cnt;
ret = pm_whitelist_set(peers, peer_cnt);
APP_ERROR_CHECK(ret);

 //Setup the device identies list.
 //Some SoftDevices do not support this feature.
ret = pm_device_identities_list_set(peers, peer_cnt);
if (ret != NRF_ERROR_NOT_SUPPORTED)
{
    APP_ERROR_CHECK(ret);
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here are the results of putting a breakpoint on pdb_write_buf_store():&lt;/p&gt;
&lt;p&gt;&lt;a href="https://s29.postimg.org/gsoysdb6f/debug.png"&gt;s29.postimg.org/.../debug.png&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95470?ContentTypeID=1</link><pubDate>Mon, 14 Aug 2017 11:24:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71e9f655-30bc-408c-b6d0-01ef064461a9</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;What do you have inside whitelist_load() ?&lt;/p&gt;
&lt;p&gt;Also we need to see if there is a bonding in your connection. Could you capture a sniffer trace ?&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t could you add a break point inside auth_status_success_process() and check if the peer_id is stored (pdb_write_buf_store() called) ?  and what inside peer_id ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95465?ContentTypeID=1</link><pubDate>Fri, 11 Aug 2017 17:49:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:becffabb-15bf-434d-819f-12d7a9260fbe</guid><dc:creator>Nick Bentzen</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;I noticed that when the whitelist loads, the IRK and address are blank.  So peer manager is saving a peer, but not properly recovering its information after a power cycle?&lt;/p&gt;
&lt;p&gt;Also I call sd_ble_gap_connect() just like in the nus_c example.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/question/94884/peer-manager-fail-to-save-a-bonding-data-in-sdk11-and-sdk12/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Could this be related?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central adds peripheral to the whitelist, but won't reconnect</title><link>https://devzone.nordicsemi.com/thread/95464?ContentTypeID=1</link><pubDate>Fri, 11 Aug 2017 15:18:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b76417a-d99d-499c-89dc-fad9b67d7e7b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Nick,&lt;/p&gt;
&lt;p&gt;sd_ble_gap_scan_start() won&amp;#39;t do connection. It only scan for advertising packet. If you want to connect you use sd_ble_gap_connect(). I assume here you don&amp;#39;t receive advertising packet that should have whitelisted address ?&lt;/p&gt;
&lt;p&gt;When you debug, what do you see in the whitelist ? They are IRK or static address ?  Would they match with the IRK/address you get when you bond to the device?&lt;/p&gt;
&lt;p&gt;You may want to capture a &lt;a href="https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF-Sniffer/"&gt;sniffer trace&lt;/a&gt; to see what happens.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>