<?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>Connect a peripheral always with the same central when an event is produced</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69875/connect-a-peripheral-always-with-the-same-central-when-an-event-is-produced</link><description>Hi, 
 I am developing an application that needs to activate a relay on a central device when an event occurs on the peripheral device. The peripheral will always connect to the same central device. I need direct communication because there will be more</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Dec 2020 08:06:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69875/connect-a-peripheral-always-with-the-same-central-when-an-event-is-produced" /><item><title>RE: Connect a peripheral always with the same central when an event is produced</title><link>https://devzone.nordicsemi.com/thread/286927?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 08:06:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12377b95-8f8d-4f61-b104-5eb4e2b2b4fb</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1) Our examples already uses a random address by default, and this address is unique to each device (&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/ficr.html?cp=4_2_0_12_0_13#register.DEVICEADDR-0"&gt;DEVICEADDR&lt;/a&gt;&lt;/span&gt;).&amp;nbsp; But you can also change to a different address through the &lt;span&gt;&lt;a title="sd_ble_gap_addr_set" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.2.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html?cp=4_7_3_1_2_1_3_1#gaef69dc212534adf4b78d211edce2267b"&gt;sd_ble_gap_addr_set&lt;/a&gt;&lt;/span&gt;() call once the Softdevice is enabled.&lt;/p&gt;
&lt;p&gt;2) You need to pair/bond with the peripheral. The peer manager will then store the ID information to flash.&lt;/p&gt;
&lt;p&gt;You can use our nRF connect app on Android or iOS to test with if your central doesn&amp;#39;t support bonding yet.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connect a peripheral always with the same central when an event is produced</title><link>https://devzone.nordicsemi.com/thread/286884?ContentTypeID=1</link><pubDate>Tue, 29 Dec 2020 18:35:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f101ed0-cf1d-4e02-8588-9835c2c5d872</guid><dc:creator>Juan</dc:creator><description>&lt;pre class="tw-data-text tw-text-large XcVN5d tw-ta" dir="ltr"&gt;&lt;span lang="en"&gt;
Hi,&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="tw-data-text tw-text-large XcVN5d tw-ta" id="tw-target-text" dir="ltr"&gt;&lt;span lang="en"&gt;For the same project, I need to know where I can find information about the following:&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="tw-data-text tw-text-large XcVN5d tw-ta" id="tw-target-text" dir="ltr"&gt;&lt;span lang="en"&gt;1) How to generate a random ID in the central when powering up for the first time
2) How to store in the peripheral the ID received from the central in the first connection&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="tw-data-text tw-text-large XcVN5d tw-ta" dir="ltr"&gt;&lt;span lang="en"&gt;In the example &amp;quot;ble_app_hids_keyboard&amp;quot; it is not clear how to save in the peripheral the ID received from the central.&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="tw-data-text tw-text-large XcVN5d tw-ta" id="tw-target-text" dir="ltr"&gt;&lt;span lang="en"&gt;I have tried to advertise the central in direct mode and it automatically switches to fast mode because it does not find any stored ID&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="tw-data-text tw-text-large XcVN5d tw-ta" id="tw-target-text" dir="ltr"&gt;&lt;span lang="en"&gt;&lt;br /&gt;Best regards&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="tw-data-text tw-text-large XcVN5d tw-ta" id="tw-target-text" dir="ltr"&gt;&lt;span lang="es"&gt;Juan&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connect a peripheral always with the same central when an event is produced</title><link>https://devzone.nordicsemi.com/thread/286832?ContentTypeID=1</link><pubDate>Tue, 29 Dec 2020 12:26:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48924754-e5fd-426b-b266-7c97bc0dced4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Whitelisting is not required, but it does enable filtering of connection requests at the HW level, which means that connection requests coming from &amp;quot;unknown&amp;quot; devices will get ignored automatically. The other alternative is to implement a custom filtering mechanism at the application-level from the BLE_GAP_EVT_CONNECTED event to see if a known device has connected, and if not, immediately terminate the connection.&lt;/p&gt;
&lt;p&gt;The address information needed to populate the whitelist is exchanged during the bonding procedure, and this information is stored persistently in internal flash by the Peer manager module.&lt;/p&gt;
&lt;p&gt;It sounds like you can re-use most of the existing whitelist handling in the keyboard example for this. In this example you press button 2 to start advertising without whitelist (when you want to allow a new device to connect).&lt;/p&gt;
[quote user=""]In this case, i&lt;span lang="en"&gt;s it necessary to use an external E2PROM to save the ID or is it saved directly to the internal flash?&lt;/span&gt;[/quote]
&lt;p&gt;&amp;nbsp;The information is stored in internal flash, and preserved across reboots. The Peer manager module manages the flash storage for you.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>