Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Reading the RSSISAMPLE register is very time-consuming using the ESB in nRF52833 (approximately 400-500ms each time).

When I used the code to get the RSSI values for different channels, I found that it was very time-consuming, about 400-500ms, and most of the time was spent waiting (NRF_RADIO->EVENTS_RSSIEND = 1. May I ask why this is? Is there a way to optimize it?

static uint8_t esb_get_rf_channel_rssi(uint8_t ch)
{
    nrf_esb_set_rf_channel(ch);
    nrf_esb_start_rx();
    nrf_delay_us(150);
    NRF_RADIO->EVENTS_RSSIEND = 0;
    while(NRF_RADIO->EVENTS_RSSIEND == 0);
    NRF_RADIO->TASKS_RSSISTART = 0;
    uint8_t rssi_reading = NRF_RADIO->RSSISAMPLE;
    nrf_esb_stop_rx();
    return rssi_reading;
}

  • Hi!

    langzou said:
    Why is it still time-consuming when I use the code you provided

    What time are you measuring with the code I provided? If you run it on top of ESB, then I guess you have configured the radio to a specific addresses, etc, and only receive packets from specific devices. So the time it takes to get the RSSI measurement will depend on how often these devices transmit.

    langzou said:
    Additionally, the RSSI obtained through the method you provided differs greatly from the RSSI after an actual connection is established

    You are only interesting the RSSI for the device you are connected to?

    langzou said:
    I noticed that you did not stop RX before setting the Frequency, and you did not restart RX after setting it.

    The RX is started in the beginning of rssi_measurer_scan_channel(). At the end of that function, the RX is disabled.

    langzou said:
    Is it that the RX reception during broadcasting is measuring the RSSI of the noise in the environment?

    It's measuring RSSI of noise in the environment.

  • Hi!

    There are some questions. Before connection, does the RSSI scanned on different channels by RX represent the noise level on different channels? Assuming these pre-connection RSSI values on different channels are used as the basis for connection channels, should the channel corresponding to the maximum or minimum RSSI be chosen?

  • ESB does not implement this functionality, you have to implement that yourself. i.e. it will not out-of-the-box select the channel with lowest noise level. You can change the channel using the function esb_set_rf_channel(), by default it will just stay on 1 single channel. 

Related