<?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>Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18132/reconnecting-in-central-mode</link><description>I am developing an application on nRF52 wich simultaneously acts as a central and peripheral and I am using the Peer Manager to manage bonding. The central needs to stay connected with a few already bonded peripherals which can occasionally get out or</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Dec 2016 14:36:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18132/reconnecting-in-central-mode" /><item><title>RE: Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/thread/69958?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2016 14:36:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b8a8899-c0c5-4112-834a-46b6f9d3d930</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi GT,&lt;/p&gt;
&lt;p&gt;You only use whitelist when doing sd_ble_gap_connect() if you don&amp;#39;t plan to connect to a particular device but to connect to any of the device inside the whitelist. So who ever advertising first (or get the adv packet be received first) will be connected.&lt;/p&gt;
&lt;p&gt;In your case, maybe you don&amp;#39;t need to use whitelist in this case ?&lt;/p&gt;
&lt;p&gt;If you want I can try to create an example with whitelist and sd_ble_gap_connect(). Pretty short on time now to create the example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/thread/69959?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2016 12:04:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:721128ae-a65d-4e7f-b2a5-9ededfd71566</guid><dc:creator>GT</dc:creator><description>&lt;p&gt;In the main() I have a call to whitelist_load() beofre start_scan(). In this function, there is a call to pm_whitelist_set(). The two functions whitelist_load() and peer_list_get() are copied from the ble_app_hrs_c example project. I do not call sd_ble_gap_whitelist_set() before calling sd_ble_gap_connect(). Should I do that considering  the pm_whitelist_set()?
The project that I am working on is an nRF52 with S132 V3 acting as a central which keeps a connection to up to 8 peripherals, and in parallel acts as a peripheral to a smartphone. Therefore, I thought that using a white list to handle all 9 connections would be &amp;quot;the smart&amp;quot; way to go.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/thread/69957?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2016 11:38:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:511099fa-9cd0-403e-8509-9dba49323232</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi GT,&lt;/p&gt;
&lt;p&gt;Have you made sure you called sd_ble_gap_whitelist_set() prior to that call to connect ? ( I assume you called that for the scanning prior) , what do you have in that call ?&lt;/p&gt;
&lt;p&gt;Btw, if you aiming at connection to a specific address, then I don&amp;#39;t really see the point of using whitelist here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/thread/69955?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2016 08:35:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ed585ba-f25b-479b-b52c-1c8e6d91994a</guid><dc:creator>GT</dc:creator><description>&lt;p&gt;The values are:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;addr.addr_id_peer = 0
addr.addr_type = 1
addr -&amp;gt; conatins the expected address of the device
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The scan_params:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;m_scan_params.active = 0
m_scan_params.use_white_list = 1
m_scan_params.adv_dir_report = 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;m_scan_params intervals and window have the expected value. The same goes to the m_connection_param.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/thread/69956?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 08:45:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a25e38f-f6c7-467e-9030-766bd41aa595</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I mean in the &amp;quot;addr&amp;quot; argument, do you set .addr_id_peer = 1 ? Do you have an address inside &amp;quot;addr&amp;quot; ?&lt;/p&gt;
&lt;p&gt;From what you described, there must be smth wrong with the whitelist you provided.
Could you provide the copy of data in side your m_scan_params? You can add a breakpoint and find the value in the watchlist.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/thread/69954?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 15:31:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:766e276a-cf9b-473f-99c5-8b7919182e8a</guid><dc:creator>GT</dc:creator><description>&lt;p&gt;Could you be more specific on this:
&amp;quot;Note that if you set the bit in addr_id_peer in p_peer_addr, the address have to be added to the device identity list.&amp;quot;&lt;/p&gt;
&lt;p&gt;The code that I am working with looks exactly like the example given in the ble_app_hrs_c project. The application that I am developing requires maintaining a connection with multiple peripherals, therefore I was trying to avoid keeping track on peripheral&amp;#39;s addresses in the application code.&lt;/p&gt;
&lt;p&gt;I am not sure if this brings any value to the discussion, but if I disable the whitelist right before I request a connection, the connection goes fine. Like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;m_scan_params.use_whitelist = 0;
err_code = sd_ble_gap_connect(&amp;amp;addr, &amp;amp;m_scan_params, &amp;amp;m_connection_param);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The values of the parameter passed to the sd_ble_gap_connect() are as expected when checked with a debugger.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/thread/69953?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 14:25:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62b74126-032f-465b-a2fb-c9bcb0fd5a10</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@GT: Are you sure you used the same whitelist param for scanning and connecting ?&lt;/p&gt;
&lt;p&gt;Note that if you set the bit in addr_id_peer in p_peer_addr, the address have to be added to the device identity list.&lt;/p&gt;
&lt;p&gt;If you simply want to connect to a particular address, you don&amp;#39;t have to use whitelist, simply use the address so the device will only connect to that address.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t  think whitelist has any problem with BLE_GAP_ADDR_TYPE_RANDOM_STATIC&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/thread/69952?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 13:18:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cb7143e-41af-4b47-9387-6f6db02d6de0</guid><dc:creator>GT</dc:creator><description>&lt;p&gt;Hello Hung,
Thanks for the useful information! I managed to implement whitelisting for the central and now the application receives only advertising packages from whitelisted devices. However, another problem just showed up - sd_ble_gap_connect() returns NRF_ERROR_INVALID_PARAM when the whitelist is enabled. If the whitelist is disabled, the central can connect and communicate with a peripheral. Another nNF51 device is used as a peripheral and it uses BLE_GAP_ADDR_TYPE_RANDOM_STATIC which I believe is causing this behavior. However, the peripherals are using the DEVICEADDR[0] and DEVICEADDR[1] to set the address on power up.&lt;/p&gt;
&lt;p&gt;Does the whitelisting supports with BLE_GAP_ADDR_TYPE_RANDOM_STATIC or it requires BLE_GAP_ADDR_TYPE_PUBLIC or BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reconnecting in central mode</title><link>https://devzone.nordicsemi.com/thread/69951?ContentTypeID=1</link><pubDate>Mon, 05 Dec 2016 09:51:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fefee1a-a89e-44f4-b805-8b22d723b0e2</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi GT,&lt;/p&gt;
&lt;p&gt;Yes, you can manually check the address of the advertiser when you receive advertising and compare to the list of device connected/paired.&lt;/p&gt;
&lt;p&gt;But the esier way is to let the radio filter out advertising packets for you automatically. You can do that by providing a whitelist to the softdevice when doing scanning. The list of paired device can be acquired by calling pm_whitelist_get(). You will have address and IRK of the devices paired, and you can do selective scanning based on this list.&lt;/p&gt;
&lt;p&gt;Please have a look at the scan_start() function in main.c in ble_app_hrs_c project in our SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>