<?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>nRF52832 Peripheral to iOS central that will reconnect after power loss</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51011/nrf52832-peripheral-to-ios-central-that-will-reconnect-after-power-loss</link><description>Hello, 
 
 I am developing a device that will reconnect to an apple iPad if it looses connection and be able to send a couple of bits over ble_UART. 
 
 I have tried merging the ble_app_uart with the ble_app_hids_keyboard examples with some success. It</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 19 Aug 2019 20:20:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51011/nrf52832-peripheral-to-ios-central-that-will-reconnect-after-power-loss" /><item><title>RE: nRF52832 Peripheral to iOS central that will reconnect after power loss</title><link>https://devzone.nordicsemi.com/thread/204864?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2019 20:20:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:557f6039-5ac5-42ed-9ca9-313e7b552e11</guid><dc:creator>Simon</dc:creator><description>[quote user="Nathan G"] If you power cycle the BLE device after the pairing it reconnects automatically to iOS. What functions would I use to enable this feature?[/quote]
&lt;p&gt;The &lt;em&gt;ble_app_hid_keyboard example&lt;/em&gt;&amp;nbsp;is a a peripheral example, which means the&amp;nbsp;iPad/computer is the central and will initiate the connection (see the &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/12708/central-server-master-vs-peripheral-client-slave"&gt;this link&lt;/a&gt;). This means that the iPad will initiate the connection, and there is no function you can add to the ble_app_hids example to enable this.&lt;/p&gt;
&lt;p&gt;The reason the iPad automatically reconnects (I think), is&amp;nbsp;because the devices are bonded, and the iPad has stored the BLE device in a list of bonded devices.&amp;nbsp;When the BLE device advertises, the iPad recognizes it and initiates a connection. In order to enable bonding on the peripheral side, you should set the security parameter&amp;nbsp;&lt;em&gt;sec_param.bond &lt;/em&gt;(which is fed into pm_sec_params_set)&lt;em&gt;&amp;nbsp;&lt;/em&gt;&amp;nbsp;to &lt;em&gt;true.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Nathan G"]I have set the security parameters in the peer_manager_init() the same as the HID example but no joy.[/quote]
&lt;p&gt;You should look at the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v6.1.1%2Fgroup___b_l_e___g_a_p___p_e_r_i_p_h___b_o_n_d_i_n_g___j_w___m_s_c.html"&gt;Message Sequence chart for Bonding:Just Works&lt;/a&gt;&amp;nbsp;(which the hid keyboard example uses, as you can see &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.3.0%2Flib_pm_usage.html"&gt;here&lt;/a&gt;), to see how to set up the example. In this case, all you have to do is to call &lt;em&gt;sd_ble_gap_sec_params_reply()&amp;nbsp;&lt;/em&gt;when receiving BLE_GAP_EVT_SEC_PARAMS_REQUEST (The peer manager library will handle this for you, if you have called &lt;em&gt;pm_sec_params_set()&lt;/em&gt; earlier).&lt;/p&gt;
&lt;p&gt;The ble app uart example I provided uses &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v6.1.1%2Fgroup___b_l_e___g_a_p___p_e_r_i_p_h___b_o_n_d_i_n_g___j_w___m_s_c.html"&gt;Bonding and Passkey Entry&lt;/a&gt;, but I can not think of what else you need to change except for the security parameters. Could you try to comment out the call to&amp;nbsp;&lt;em&gt;sd_ble_opt_set()&lt;/em&gt;? Which is not needed for just works. You should study the ble app hids example more to see what needs to be implemented.&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Could you try to figure out where the application fails? What function specifically and what error it returns. Also, if you are able to catch a sniffer trace of the ble communication, you will be able to see where it fails.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Peripheral to iOS central that will reconnect after power loss</title><link>https://devzone.nordicsemi.com/thread/204555?ContentTypeID=1</link><pubDate>Fri, 16 Aug 2019 15:14:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0cd5e7e-184a-43c3-992b-ecafda028a2c</guid><dc:creator>CanTech1</dc:creator><description>&lt;p&gt;Thank you for the reply Simon.&lt;/p&gt;
&lt;p&gt;The example given in the thread that you referenced is a good starting point. The ble_app_hid_keyboard example prompts you if you would like to pair the device. If you power cycle the BLE device after the pairing it reconnects automatically to iOS. What functions would I use to enable this feature?&lt;/p&gt;
&lt;p&gt;I have set the security parameters in the peer_manager_init() the same as the HID example but no joy. I notice that the HID uses a whitelist, is this a necessary part of the equation?&lt;/p&gt;
&lt;p&gt;Best,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Peripheral to iOS central that will reconnect after power loss</title><link>https://devzone.nordicsemi.com/thread/204280?ContentTypeID=1</link><pubDate>Thu, 15 Aug 2019 11:18:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6de76d7-0d3b-4b2d-a54f-6c81788a5dec</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Check out &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/44658/communication-problems-between-ble_peripheral-and-ble_central-in-nrf52-project"&gt;this thread&lt;/a&gt; where I have provided code for respectively ble_app_uart and ble_app_uart_c that implements Legacy&amp;nbsp;&lt;span&gt;bonding using a static key. It is written for SDK 15.x.0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can build upon this code if you want to use other bonding methods,&amp;nbsp;e.g. Legacy just works, LESC OOB or LESC Numeric comparison etc...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>