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

Related