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

How to measure RSSI with NRF51822?

Hello!

I would like to measure RSSI for different channels so as to decide which channel is the least noisy one (and more particularly, which ones are already used). I cannot make it work, so I am asking you for help.

My code:

for(i=0; i<20; ++i) 
{
	NRF_RADIO->FREQUENCY = i;
	NRF_RADIO->EVENTS_READY = 0U;
	NRF_RADIO->TASKS_RXEN = 1U;
	while(NRF_RADIO->EVENTS_READY == 0U);
	NRF_RADIO->EVENTS_END = 0U;
	
	NRF_RADIO->TASKS_START = 1U;
	
	NRF_RADIO->EVENTS_RSSIEND = 0U;
	NRF_RADIO->TASKS_RSSISTART = 1U;
	while(NRF_RADIO->EVENTS_RSSIEND == 0U);
	
	rssi[i] = NRF_RADIO->RSSISAMPLE;
	
	NRF_RADIO->EVENTS_DISABLED = 0U;    
	NRF_RADIO->TASKS_DISABLE   = 1U;  // Disable the radio.

	while(NRF_RADIO->EVENTS_DISABLED == 0U)
	{
			// Do nothing.
	}
}

With this code, even if a module is continuously emitting signal, rssi is 90 (0x5A) for every channel. Am I missing something? Isn't it possible to measure RSSI without receiving any packet?

Best regards, Nicolas

Parents Reply Children
  • I am sorry for misreading your question. Most likely, the RSSI of 90 is correct (actual value -90 dBm). However, note that the RSSI is only valid from -50 to -80 dBm with the resolution and accuracy given in the PS.

    If you check the array, there will most likely be one or two samples that differ from the 0x5A value, especially if you change the RF channel in between every 20 samples.

Related