This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Reading the RSSI from connected device and from non-connected device by specified MAC

Hello,

I am using a central with SDK 14 & nRF52832; my goal is to read the RSSI & MAC from a connected peripheral device. During the BLE_GAP_EVT_RSSI_CHANGED event what I getting is "random beacons nearby" as described here .


Questions are:

(1) Having the described setup, what would be the correct steps to only get the RSSI of the connected peripheral?

(2) With the given setup, what would be the correct steps to get the RSSI of a device that isn't connected? Should I simply perform filtering by desired MAC with the setup I already have?

Thanks in advance

Parents
  • Hi,

    1. To get the RSSI of a connected device you can use the functions sd_ble_gap_rssi_start() and sd_ble_gap_rssi_get() to get the RSSI value between the peripheral and central. 

    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.

  • Hi,

    1.1 Yes, that is correct.

    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?

    1.3 sd_ble_gap_rssi_get() is to get the RSSI from your connected device while p_ble_evt->evt.gap_evt.params.rssi_changed.rssi is used to get RSSI value from advertising reports.

    2. A way to implement this is to store the connection handles and MAC address upon getting the BLE_GAP_EVT_CONNECTED event. Read out the MAC address using  p_ble_evt->evt.gap_evt.params.connected.peer_addr.

    3. You can adjust the scan interval to 100ms instead of a timer. After receiving BLE_GAP_EVT_ADV_REPORT event you can filter MAC address by using find_peer_addr() and then use p_ble_evt->evt.gap_evt.params.rssi_changed.rssi to get the RSSI value(Take a look at the HRS example regarding the filter part).

    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 these examples from the SDK,

  • Thanks for reply. While I am still thinking and experimenting on the implementation, next questions:

    (1) Regarding:

    "If you want to get the RSSI from a non-connected device(from advertising report) you need to change to a central role(scanning)."

    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 & 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?

    (2) Finally, the "simple" 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:

    (2.1) Could a nRF52 mesh network be the right solution, and if "yes"

    (2.2) How to perform a smooth transition & upgrade from what I have now (SDK14 & S132 & multi-role project working just fine)? 

    (3) As to:

    "3. You can adjust the scan interval to 100ms instead of a timer. After receiving BLE_GAP_EVT_ADV_REPORT event you can filter MAC address by using find_peer_addr() and then use p_ble_evt->evt.gap_evt.params.rssi_changed.rssi to get the RSSI value(Take a look at the HRS example regarding the filter part)."

    (3.1) If I understand correctly, in this case p_ble_evt->evt.gap_evt.params.adv_report.rssi should be read. Please, confirm.

    (3.2) If I understand properly, in this case sd_ble_gap_rssi_start shall not be called, as it is only used in connection. Please, confirm.

    (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't able to find a clear description. Could you help clarifying it?

    (3.4) When checked p_ble_evt->evt.gap_evt.params I can't see any field for "channel index". Is possible to derive it with SDK14, could you please, also help here?

    (4)  For every read rssi value within a 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)

    Thanks  for support!

  • Hi,

    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.

    2. Again, wheteher it is a right solution depends on your overall  use-case. Yes, you can use mesh to do this but 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.

    3.1 and 3.2. Yes that is correct.

    3.3. Take a look at this.

    3.4. Take a look at this.

    4. Do you mean like time and date? Unfortunatetly, there are no such feature. Perhaps this might help.

Reply
  • Hi,

    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.

    2. Again, wheteher it is a right solution depends on your overall  use-case. Yes, you can use mesh to do this but 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.

    3.1 and 3.2. Yes that is correct.

    3.3. Take a look at this.

    3.4. Take a look at this.

    4. Do you mean like time and date? Unfortunatetly, there are no such feature. Perhaps this might help.

Children
No Data
Related