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

How to get RSSI asynchronously & independent of any connection or events.

Hello,

I have an application in which I need to get RSSI before, during and after any BLE connection has been made.  The RSSI measurements are being used to quantify the co-channel interference generated by a WIFI radio.  I need to make this measurement independent of BLE connection state.  For example, I am not interested in the RSSI while the last packet was received.

In my application, I need to measure RSSI, then control a 3rd-party "custom" RF frontend based on the measurement, then repeat.  It is important that I can make these measurements asynchronously and independently of a BLE connection.

The problem I am seeing is when I call the get_rssi() function below.  The system hangs or prints "<error> app: Fatal error" to the serial console.

uint8_t get_rssi(void)
{
    NRF_RADIO->EVENTS_RSSIEND = 0;
    NRF_RADIO->TASKS_RSSISTART = 1;
    while (NRF_RADIO->EVENTS_RSSIEND == 0);
    uint8_t rssi = NRF_RADIO->RSSISAMPLE;
    return rssi;
}

It would seem that the Line "NRF_RADIO->TASKS_RSSISTART = 1;" is the problem.  If I omit this line, then RSSI measurements are stale (do not updated frequently enough).

Till now, my work has been on top of the "ble_app_att_mtu_throughput" example using S140 SoftDevice.  I am using the "nRF5 v16.0.0" SDK.

My hardware is the pca10056 nRF52840 evaluation board and a custom platform.  I see the same issue on both platforms.

My Questions are:

(1) Can I use the RSSI registers directly while using a SoftDevice?

(2) Is there an API method to get instantaneous RSSI?

Thanks

Parents
  • Hello,

    What Turbo is saying is correct, you may not access the SoftDevice's registers directly.
    However, you may use the SoftDevice's API to get the RSSI value, please see the sd_ble_gap_rssi_get function from the S140 v7.0.1 API reference.

    instantaneous

    Could you elaborate what you mean by instantaneous here? The SoftDevice will not prioritize the rssi_get function call from the application over internal function calls.
    So, depending on what the SoftDevice is doing at the time of the rssi_get call, it might not return "instantaneous" per say.

    Please do not hesitate to let me know if this was not what you were asking about.

    Best regards,
    Karl

Reply
  • Hello,

    What Turbo is saying is correct, you may not access the SoftDevice's registers directly.
    However, you may use the SoftDevice's API to get the RSSI value, please see the sd_ble_gap_rssi_get function from the S140 v7.0.1 API reference.

    instantaneous

    Could you elaborate what you mean by instantaneous here? The SoftDevice will not prioritize the rssi_get function call from the application over internal function calls.
    So, depending on what the SoftDevice is doing at the time of the rssi_get call, it might not return "instantaneous" per say.

    Please do not hesitate to let me know if this was not what you were asking about.

    Best regards,
    Karl

Children
  • Hi Karl,

    What I meant by instantaneous was: irrespective of if a packet is being received or not, what is the value of the filtered RSSI measurement right now.

    The nRF52840 product specification says: 

    "Sampling of the received signal strength is started by using the RSSISTART task. The sample can be read from the RSSISAMPLE register."

    How can I initiate the RSSISTART task on demand?

    I am not interested in taking over the entire radio or interfereing with the BLE operation.  Nor am I interested in changed the receive frequency.  I really just want to know the RSSI sampled by the receiver right now.

    Thank you!

    -Christian

  • Hello Christian,

    Between what you are saying in this comment, and you reply to Turbos comment, I am not exactly sure what you are looking for.
    By using radio timeslots you will indeed take control over the radio peripheral for some time, which I understand is not your intention.

    christianhahn said:
    What I meant by instantaneous was: irrespective of if a packet is being received or not, what is the value of the filtered RSSI measurement right now.

    The RSSI value is tied to a connection event - you may not sample the RSSI value independently of receiving packets. The sd_ble_gap_rssi_get function returns the RSSI value for the latest connection event.

    christianhahn said:
    I am not interested in taking over the entire radio or interfereing with the BLE operation.  Nor am I interested in changed the receive frequency.  I really just want to know the RSSI sampled by the receiver right now.

    If you would not like to control the radio directly, or have anything to do with the BLE operation, I would again recommend that you first call sd_ble_gap_rssi_start, and then use the previously mentioned sd_ble_gap_rssi_get function to report the RSSI value for the latest connection event. Alternatively, you could use the BLE_GAP_EVT_RSSI_CHANGED event if you are only interested in the RSSI value when it changes significantly.

    christianhahn said:
    How can I initiate the RSSISTART task on demand?

    If you would like the SoftDevice to stop reporting RSSI at any time, you can use the sd_ble_gap_rssi_stop function to do this.

    Please let me know if anything still should be unclear.

    Best regards,
    Karl

Related