<?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>Reading the RSSI from connected device and from non-connected device by specified MAC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74818/reading-the-rssi-from-connected-device-and-from-non-connected-device-by-specified-mac</link><description>Hello, 
 I am using a central with SDK 14 &amp;amp; nRF52832; my goal is to read the RSSI &amp;amp; MAC from a connected peripheral device. During the BLE_GAP_EVT_RSSI_CHANGED event what I getting is &amp;quot;random beacons nearby&amp;quot; as described here . 
 Questions are: 
 (1)</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 May 2021 13:43:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74818/reading-the-rssi-from-connected-device-and-from-non-connected-device-by-specified-mac" /><item><title>RE: Reading the RSSI from connected device and from non-connected device by specified MAC</title><link>https://devzone.nordicsemi.com/thread/312411?ContentTypeID=1</link><pubDate>Fri, 28 May 2021 13:43:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2d040ae-6756-4f85-b8dd-3a4a1fa59ef5</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. What I meant was that you need to run central and peripheral concurrently on the device. Yes, you can achieve this with SDK14 and S132, If it is a good option or not, it depends on your overall use-case. To implement this see the examples that I referred to in the previous reply.&lt;/p&gt;
&lt;p&gt;2. Again, wheteher it is a right solution depends on your overall&amp;nbsp; use-case. Yes, you can use mesh to do this but&amp;nbsp;you need to migrate to a newer SDK version. It is recommended to use to our latest Mesh SDK as there have been a lot of improvements. The latest Mesh SDK is compatible with nRF5 SDK v17.&lt;/p&gt;
&lt;p&gt;3.1 and 3.2. Yes that is correct.&lt;/p&gt;
&lt;p&gt;3.3. Take a look at &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/40835/query--ble_gap_addr_t" rel="noopener noreferrer" target="_blank"&gt;this&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;3.4. Take a look at &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/68279/how-to-log-channel-information" rel="noopener noreferrer" target="_blank"&gt;this&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;4. Do you mean like time and date? Unfortunatetly, there are no such feature. Perhaps &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.0.0/ble_sdk_app_cts_c.html?cp=8_5_6_4_1_2_7" rel="noopener noreferrer" target="_blank"&gt;this&lt;/a&gt;&amp;nbsp;might help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading the RSSI from connected device and from non-connected device by specified MAC</title><link>https://devzone.nordicsemi.com/thread/310418?ContentTypeID=1</link><pubDate>Wed, 19 May 2021 11:53:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03d17e12-3e23-403a-915d-6fbedf90f22c</guid><dc:creator>kont40</dc:creator><description>&lt;p&gt;Thanks for reply. While I am still thinking and experimenting on the implementation, next questions:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(1) Regarding:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;If you want to get the RSSI from a non-connected device(from advertising report) you need to change to a central role(scanning).&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As I understand, a non-connected peripheral should still be able to read rssi from advertisement reports using timeslot API operating concurrently to the SoftDevice. Is this achievable with SDK14 &amp;amp; S132, and is it a good option at all? If worth to try what are, in principle the basic steps to follow? Also, any examples of how to implement in this case?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(2) Finally, the &amp;quot;simple&amp;quot; goal is to have a set of nRF52832 devices where each device is able to get an rssi of its surrounding devices in the set and report it. This could very much be a mesh network. In this case, questions that arise are:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; (2.1) Could a nRF52 mesh network be the right solution, and if &amp;quot;yes&amp;quot; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(2.2) How to perform a smooth transition &amp;amp; upgrade from what I have now (SDK14 &amp;amp; S132 &amp;amp; multi-role project working just fine)?&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(3) As to:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;3. You can adjust the scan interval to 100ms instead of a timer.&amp;nbsp;After receiving&amp;nbsp;BLE_GAP_EVT_ADV_REPORT event you can filter MAC address by using&amp;nbsp;find_peer_addr() and then use&amp;nbsp;p_ble_evt-&amp;gt;evt.gap_evt.params.rssi_changed.rssi to get the RSSI value(Take a look at the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.0.0/ble_sdk_app_hrc.html?cp=7_5_6_4_1_0_1" rel="noopener noreferrer" target="_blank"&gt;HRS example&lt;/a&gt; regarding the filter part).&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(3.1) If I understand correctly, in this case p_ble_evt-&amp;gt;evt.gap_evt.params.adv_report.rssi should be read. Please, confirm.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(3.2) If I understand properly, in this case &lt;span class="aCOpRe"&gt;&lt;em&gt;sd_ble_gap_rssi_start&lt;/em&gt;&lt;/span&gt; shall not be called, as it is only used in connection. Please, confirm.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(3.3) For the filtering I have set up a white list, and it seems to work fine. However, not clear what is the purpose of addr_id_peer from ble_gap_addr_t struct and I wasn&amp;#39;t able to find a clear description. Could you help clarifying it?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(3.4) When checked p_ble_evt-&amp;gt;evt.gap_evt.params I can&amp;#39;t see any field for &amp;quot;channel index&amp;quot;. Is possible to derive it with SDK14, could you please, also help here?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(4)&amp;nbsp; For every read rssi value within a&amp;nbsp;BLE_GAP_EVT_ADV_REPORT I wish to have a timestamp. Is there any convenient feature provided by the SoftDevice stack that can be used right away? (instead of arranging a timer myself)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&amp;nbsp; for support!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading the RSSI from connected device and from non-connected device by specified MAC</title><link>https://devzone.nordicsemi.com/thread/309299?ContentTypeID=1</link><pubDate>Tue, 11 May 2021 15:08:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9f425f0-57d6-4d40-abb2-ec4d34b3e1cd</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1.1 Yes, that is correct.&lt;/p&gt;
&lt;p&gt;1.2 Yes, the event should only trigger when there is a change in RSSI on the connected device. How do you check this? Are you sure the RSSI is from a non-connected peripheral?&lt;/p&gt;
&lt;p&gt;1.3 sd_ble_gap_rssi_get() is to get the RSSI from your connected device while&amp;nbsp;&lt;span&gt;p_ble_evt-&amp;gt;evt.gap_evt.params.rssi_changed.rssi is used to get RSSI value from advertising reports.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. A way to implement this is to store the connection handles and MAC address upon getting the&amp;nbsp;BLE_GAP_EVT_CONNECTED event. Read out the MAC address using&amp;nbsp;&amp;nbsp;p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. You can adjust the scan interval to 100ms instead of a timer.&amp;nbsp;After receiving&amp;nbsp;BLE_GAP_EVT_ADV_REPORT event you can filter MAC address by using&amp;nbsp;find_peer_addr() and then use&amp;nbsp;p_ble_evt-&amp;gt;evt.gap_evt.params.rssi_changed.rssi to get the RSSI value(Take a look at the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.0.0/ble_sdk_app_hrc.html?cp=7_5_6_4_1_0_1" rel="noopener noreferrer" target="_blank"&gt;HRS example&lt;/a&gt; regarding the filter part).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;4. A peripheral device should be able to read the RSSI value on a connected device, the same way a central device does. If you want to get the RSSI from a non-connected device(from advertising report) you need to change to a central role(scanning). I suggest you take a look at&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.0.0/examples_ble_cen_per.html?cp=7_5_6_4_1_1" rel="noopener noreferrer" target="_blank"&gt;these examples&lt;/a&gt; from the SDK,&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading the RSSI from connected device and from non-connected device by specified MAC</title><link>https://devzone.nordicsemi.com/thread/308798?ContentTypeID=1</link><pubDate>Fri, 07 May 2021 16:31:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:118f838d-6d9a-446f-936c-d9684b0f7e87</guid><dc:creator>kont40</dc:creator><description>&lt;p&gt;Hello Mttrinh,&lt;/p&gt;
&lt;p&gt;Thanks for the fast response!&lt;br /&gt;&lt;br /&gt;I then have additional questions to make situation clear:&lt;/p&gt;
&lt;p&gt;(1)&lt;/p&gt;
&lt;p&gt;1.1.Intuitively, sd_ble_gap_rssi_start(p_gap_evt-&amp;gt;conn_handle, 0, 1); should start RSSI scanning only for the connected device with the specified connection handler (but not get events for RSSI change of non-connected peripheral or other connected peripheral). Is this understanding correct?&lt;/p&gt;
&lt;p&gt;1.2. If so, BLE_GAP_EVT_RSSI_CHANGED should be triggered only by a change in the RSSI of the connected peripheral&amp;nbsp; whose handler is currently serviced. How is then possible to get the RSSI of non-connected peripherals during the BLE_GAP_EVT_RSSI_CHANGED event?&lt;/p&gt;
&lt;p&gt;1.3 Further, what is, in principle, the difference between reading p_ble_evt-&amp;gt;evt.gap_evt.params.rssi_changed.rssi and calling sd_ble_gap_rssi_get(p_gap_evt-&amp;gt;conn_handle, &amp;amp;rssi) ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;(2) In case of multiple connected peripherals we shall know which peripheral&amp;#39;s RSSI was read by the respective connection handle. It would be very helpful if you can point a code example to implement it, i.e. after calling sd_ble_gap_rssi_get() and having the connection handle, how to get the respective MAC of the connected peripheral device whose RSSI was read?&lt;br /&gt;&lt;br /&gt;(3) Please, provide a code example how to implement RSSI scanning of non-connected peripherals at a regular intervals, e.g. every 100 ms. I guess it should apply a timer to call the scanning routine, but I am not clear shall it use&amp;nbsp; p_ble_evt-&amp;gt;evt.gap_evt.params.rssi_changed.rssi &amp;amp; p_ble_evt-&amp;gt;evt.gap_evt.params.connected.peer_addr or rather sd_ble_gap_rssi_get(p_gap_evt-&amp;gt;conn_handle, &amp;amp;rssi)&amp;nbsp; (and how to read the MAC in this case).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;(4) Is it possible for a peripheral device to read rssi of surrounding devices? If yes, could you please, provide a code example. If not - what could be the workaround - e.g. switching a device between central and peripheral roles?&lt;/p&gt;
&lt;p&gt;Thanks much in advance!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading the RSSI from connected device and from non-connected device by specified MAC</title><link>https://devzone.nordicsemi.com/thread/308793?ContentTypeID=1</link><pubDate>Fri, 07 May 2021 16:11:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b2cfb37-6a1c-4bb0-9cbd-b30ed72bd229</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. To get the RSSI of a connected device you can use&amp;nbsp;the functions&lt;span&gt;&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html#gac369253b7f5ce0fc0093a6133faa791f" rel="noopener noreferrer" target="_blank"&gt;sd_ble_gap_rssi_start()&lt;/a&gt;&amp;nbsp;and &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html#ga51f25b5b74290f91aa92cb47dc8d4276" rel="noopener noreferrer" target="_blank"&gt;sd_ble_gap_rssi_get()&lt;/a&gt;&amp;nbsp;to get the RSSI value between&amp;nbsp;the peripheral and central.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. Yes, in ble_evt_handler upon receiving an advertisement report, you can apply a filter for the desired MAC address then read out the RSSI from the report.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>