<?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 and Peripheral Role Switching and Nearby Device Discovery in nRF52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115740/central-and-peripheral-role-switching-and-nearby-device-discovery-in-nrf52832</link><description>Hi, 
 I am currently working on a project using the nRF52832 controller as a gateway device and the nRF52810 controller as a timer indication device. 
 I have successfully integrated the Timer and SAADC peripherals into the ble_app_uart/pca10040e/s112</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Nov 2024 11:39:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115740/central-and-peripheral-role-switching-and-nearby-device-discovery-in-nrf52832" /><item><title>RE: Central and Peripheral Role Switching and Nearby Device Discovery in nRF52832</title><link>https://devzone.nordicsemi.com/thread/508794?ContentTypeID=1</link><pubDate>Fri, 01 Nov 2024 11:39:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6300f9c0-fcbc-429b-a4d0-0defa1be4898</guid><dc:creator>siltvm</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt;&amp;nbsp;thanks for the information&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central and Peripheral Role Switching and Nearby Device Discovery in nRF52832</title><link>https://devzone.nordicsemi.com/thread/508408?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2024 15:44:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:657d7fd8-019d-4a50-b10d-c2a8e33551a4</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;br /&gt;The sample already does that, please take a look and study the example.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central and Peripheral Role Switching and Nearby Device Discovery in nRF52832</title><link>https://devzone.nordicsemi.com/thread/508330?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2024 11:38:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ae9c4f4-9fdf-4c44-9adf-0ac25c0ceab0</guid><dc:creator>siltvm</dc:creator><description>&lt;p&gt;hi ,&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I changed the path as per your suggestion, so the error is resolved, and I am able to build the code. I just have a question on how to implement multirole meaning central and peripheral at the same time&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central and Peripheral Role Switching and Nearby Device Discovery in nRF52832</title><link>https://devzone.nordicsemi.com/thread/508303?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2024 08:52:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be80aae0-2451-4e2c-a5f8-a72b884b0912</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Siltvm,&amp;nbsp;&lt;br /&gt;It seems that the path is too long. Please try to copy the SDK to a folder near C:\ . You can rename the SDK folder from nRF5_SDK_17.0.2_dd674de to for example SDK1702. Windows only allow max length of the path to 250 characters.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t see a problem with your set-up. Note that the gateway doesn&amp;#39;t have to connect to all the watches at the same time. It can connect, read data and disconnect to connect to more device. This way even if you have more than 20 watches you still can get data from all of them. Of course if you have less than 20, you can just keep connections and don&amp;#39;t have to do connect-disconnect.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If you keep the connection, avoid using too short connection interval. Try 100ms and higher.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central and Peripheral Role Switching and Nearby Device Discovery in nRF52832</title><link>https://devzone.nordicsemi.com/thread/508281?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2024 06:52:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8808e738-6be0-445d-b92f-22311ed59760</guid><dc:creator>siltvm</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt;&amp;nbsp;, I see the example project &lt;code&gt;ble_app_hrs_rscs_relay&lt;/code&gt; available in the BLE central and peripheral SDK directory, but when I try to build the code, an error occurs initially. I am attaching a screenshot for better understanding&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/7762.ipmsgclip_5F00_s_5F00_1730175370_5F00_0.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Central and Peripheral Role Switching and Nearby Device Discovery in nRF52832</title><link>https://devzone.nordicsemi.com/thread/508278?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2024 06:47:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ad18199-ff3d-4c62-b856-e457b5321e1d</guid><dc:creator>siltvm</dc:creator><description>&lt;p&gt;&amp;nbsp;hi&amp;nbsp; ,&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry for the late response; we had a holiday for the past few days.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll describe more about my application.&lt;/p&gt;
&lt;p&gt;We have an nRF52832 gateway device and an nRF52810 timer indication device (we call it as &amp;quot;watches&amp;quot;).&lt;/p&gt;
&lt;p&gt;The firmware for the watch is almost complete, using the &lt;code&gt;ble_app_uart/pca10040e/s112&lt;/code&gt; example project available in the &lt;code&gt;ble_peripheral&lt;/code&gt; example project directory.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;The functionality of the watch is as follows:&lt;/span&gt; &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;The watch advertises its name and MAC ID, allowing us to connect to it via BLE using the nRF Connect Android application available on the Play Store. We can send and receive data using the Nordic UART service. I have also integrated timer and SAADC peripherals into &lt;code&gt;ble_app_uart&lt;/code&gt; for timer indications and battery percentage observations, which are working fine.&lt;/p&gt;
&lt;p&gt;Later, we decided to add a gateway device to manage communication between the nRF Connect app and the watch.&lt;/p&gt;
&lt;h3&gt;Project Requirements:&lt;/h3&gt;
&lt;p&gt;We need the gateway device to act as both a central and peripheral. Initially, the gateway device advertises as a peripheral, allowing it to connect via BLE using the nRF Connect app. Once the connection is successful, the gateway acts as a central, scanning for available nearby watches. It then sends the available devices&amp;#39; MAC IDs and advertised names to the app. The app will then send a command containing the MAC ID and BLE name of the desired watch to connect with the gateway device. The gateway then acts as a central to connect with the specified watch and&amp;nbsp;The gateway device should provide the capability to send and receive commands between the app and watches.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;Number of Timer Indicators(watches):&lt;/h3&gt;
&lt;p&gt;We haven&amp;rsquo;t set a limit on the number of watches that can connect to the gateway device at a time. It may be fewer than 20 .&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;Distribution Distance Between Watch and Gateway:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The distance between the watch and gateway device is approximately &amp;le; 100 meters.&lt;/li&gt;
&lt;li&gt;The distance between the gateway and nRF Connect app is also &amp;le; 100 meters.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The purpose of implementing a gateway device between the watch and the nRF Connect app is to extend the communication range.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h3&gt;Mesh Network Consideration:&lt;/h3&gt;
&lt;p&gt;The watch is powered by a 135 mAh battery, whereas the gateway is USB-powered. This may present some challenges.&lt;/p&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: Central and Peripheral Role Switching and Nearby Device Discovery in nRF52832</title><link>https://devzone.nordicsemi.com/thread/507566?ContentTypeID=1</link><pubDate>Wed, 23 Oct 2024 11:39:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:994c7c11-f9cd-46e5-889c-5e1f34241bac</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Stilvm,&amp;nbsp;&lt;br /&gt;Could you describe a little bit more on your application ? How many time indicators you have ? What&amp;#39;s the distribution in distance between them and the gateway ?&amp;nbsp;&lt;br /&gt;If all is in the range of one single gateway you may not need multiple gateway. Also you may think of having a mesh network if the device is not running on a battery.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regarding your questions:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Is there any available example project that can demonstrate how a device can act as both a Central and a Peripheral?&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;yes, please take a look at the examples in&amp;nbsp;\examples\ble_central_and_peripheral\experimental , maybe the best fit would be the&amp;nbsp;\&lt;a href="https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/ble_sdk_app_rscs_relay.html"&gt;ble_app_hrs_rscs_relay&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How can the role switching between Central and Peripheral be implemented in the nRF52832? &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can switch between roles or you can have both roles at the same time with no problem. The stack can handle multiple connections at the same time regardless if it&amp;#39;s central role or peripheral role&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Is there an option to retrieve a list of nearby advertised BLE devices?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can&amp;nbsp;listen to the&amp;nbsp;BLE_GAP_EVT_ADV_REPORT when scanning and can parse the advertising packets to get the name, address. Please take a look at the&amp;nbsp;\examples\ble_central\experimental\ble_app_hrs_nfc_c , in&amp;nbsp;ble_m.c you can find how the advertising packets are parsed in on_adv_report():&amp;nbsp;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1729683591411v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>