Hello,
I'm working with nRF52840 (Laird BL653 DVK & dongle), using NCS 1.9.1.
I'm trying to get reliable RSSI "noise floor" sampling on a single RF channel or sweeping multiple channels, using these commands:
uint8_t RssiAnalyzer::RssiMeasurerScanChannel(uint8_t channel) { uint8_t sample; NRF_RADIO->FREQUENCY = channel; NRF_RADIO->TASKS_RXEN = 1; while(!NRF_RADIO->EVENTS_READY); NRF_RADIO->EVENTS_READY = 0; NRF_RADIO->TASKS_RSSISTART = 1; while(!NRF_RADIO->EVENTS_RSSIEND); NRF_RADIO->EVENTS_RSSIEND = 0; sample = 0x7F & NRF_RADIO->RSSISAMPLE; NRF_RADIO->TASKS_DISABLE = 1; while(!NRF_RADIO->EVENTS_DISABLED); NRF_RADIO->EVENTS_DISABLED = 0; return sample; }
Taken from https://github.com/NordicSemiconductor/pc-nrfconnect-rssi/tree/main with the following configuration:
void RssiAnalyzer::Init() { NRF_RADIO->POWER = 1; NRF_RADIO->SHORTS = RADIO_SHORTS_READY_START_Msk | RADIO_SHORTS_END_DISABLE_Msk; NVIC_EnableIRQ(RADIO_IRQn); NRF_CLOCK->TASKS_HFCLKSTART = 1; while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0); }
Also from the same source.
The configuration sequence is being executed only once on FW startup, while the sampling sequence is called multiple times during FW operation, with each time executing the sequence at least twice for each channel, with channel being any even number from 4 to 78 representing channel frequency. From the multiple sampling results only the minimal value is returned, giving the "noisiest" RSSI sample in -dBm.
I noticed that when the RSSI sampling is called multiple times with no time intervals between calls the minimal results are constantly very low (typically ~-105 dBm), while when sampled with intervals between calls (still each time calling the sequence twice but with variating periods between every calls-pair) the results increase until reaching a maximal value (which is similar to the result of only 2 samples alone with no iteration, typically ~-60 dBm).
These results are significantly different from each other, so I'm trying to understand this behavior and figure out if this is the proper way to get RSSI samples (perhaps enabling NRF_RADIO->TASKS_RXEN so frequently is causing the issue and should only be done once per every sampling sequence?).
Also, I noticed that when performing sweep scan on all channels I get about the same results on all of them, but when using the RSSI Viewer app (nRF Connect for Desktop v4.3.0) simultaneously I see a very different pattern.
Any assistance here would be much appreciated. Thanks in advance!