RSSI noise floor sampling returns different values when sampled with different intervals on nRF52840

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!

Parents
  • Hi,

     

    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).

    Which channel(s) do you scan and see this behavior? if it is one of the advertising channels, it would be expected that you sample energy in the band.

    Do you have a example of all RSSI outputs?

     

    Kind regards,

    Håkon

  • I scan RF channels 0-36 without advertising channels (= all even frequencies between 2404-2478 excluding 2426).

    Here is an output example of noise floor sampling, table to the left iterates all channels with long time intervals, table to the right sampled only single channel with variating intervals between samples:

  • Hi,

     

    Did you try running it with different delay times between each RSSI readout?

    Yes, but that did not provide any change at my end.

    Running this example on a bl654_dvk gave me constantly quite different outputs when I changed the sleep duration inside rssi_measurer_scan_channel_many_time, which is what I'm hoping to understand (oddly the trend was opposite to the one I get on my FW- e.g. 1000ms delay constantly returned -107 dBm on all channels and no delay at all constantly returned -59- -60). 

    Do you know what factors might be causing it / influencing the readout outputs?

    It is hard to say what can impact on this specific hardware, as I'm unable to reproduce the scenario.

    Could it be logger module? Have you tried storing it to an array, then printing the results after the radio is disabled?

     

    Kind regards,

    Håkon

  • Have you tried storing it to an array, then printing the results after the radio is disabled?

    Yes I did, the output was the same. 

    If it helps to summon any more insights, I also tried to adapt your test to be more similar to the flow in my FW, so I inserted the tasks enabling & disabling calls into the for loop (see snippet below). With even short delays (>= 1ms) outputs varied between -104 or -83 instead of returning constantly -107, but with no delays values showed no change (constantly returned -59- -60).

    Did you try running it with different delay times between each RSSI readout?

    Yes, but that did not provide any change at my end.

    Just to make sure, did you also tried it with no delay at all? On my board there was a significant difference in outputs between this configuration and even the shortest delay of ~30 us.

    Thanks!

  • Hi,

    Dagan Raviv said:
    Just to make sure, did you also tried it with no delay at all?

    I tried varying the k_msleep() (and removing it) in function rssi_measurer_scan_channel_many_times. Here's with no delay when sampling the RSSI:

    Channel 0, RSSI 93
    102 81 96 96 98 96 93 81 72 90 
    Channel 1, RSSI 90
    95 50 50 76 81 96 97 93 96 96 
    Channel 2, RSSI 96
    89 79 46 62 26 28 94 87 95 93 
    Channel 3, RSSI 93
    100 96 97 86 96 93 94 94 93 75 
    Channel 4, RSSI 75
    95 81 97 95 95 97 96 94 97 95 
    Channel 5, RSSI 95
    97 97 96 95 95 98 98 70 95 97 
    Channel 6, RSSI 97
    104 91 96 97 95 94 97 95 96 95 
    Channel 7, RSSI 95
    86 96 81 95 96 97 97 96 96 96 
    Channel 8, RSSI 96
    103 97 96 96 96 94 95 97 93 96 
    Channel 9, RSSI 96
    104 96 97 96 98 95 95 93 97 96 
    Channel 10, RSSI 96
    103 96 96 93 96 93 96 93 98 96 
    Channel 11, RSSI 96
    100 90 91 90 93 91 89 90 88 86 
    Channel 12, RSSI 86
    98 87 83 84 87 87 86 82 89 85 
    Channel 13, RSSI 85
    98 92 92 93 94 88 92 93 95 94 
    Channel 14, RSSI 94
    99 95 94 96 97 95 93 94 98 96 
    Channel 15, RSSI 96
    102 94 95 94 100 97 94 95 96 94 
    Channel 16, RSSI 94
    102 99 98 93 96 97 97 93 96 95 
    Channel 17, RSSI 95
    102 96 95 98 99 98 98 94 97 95 
    Channel 18, RSSI 95
    103 97 97 97 94 94 94 96 93 97 
    Channel 19, RSSI 97
    101 96 96 95 95 93 94 94 98 96 
    Channel 20, RSSI 96
    102 97 98 97 90 100 97 97 96 98 
    Channel 21, RSSI 98
    103 96 97 98 86 95 95 97 98 96 
    Channel 22, RSSI 96
    72 97 97 94 98 97 97 99 99 97 
    Channel 23, RSSI 97
    102 81 99 97 95 97 99 96 57 56 
    Channel 24, RSSI 56
    102 98 96 72 98 96 97 98 97 97 
    Channel 25, RSSI 97
    98 57 56 94 97 93 94 87 78 57 
    Channel 26, RSSI 57
    96 85 98 96 97 99 100 88 96 96 
    Channel 27, RSSI 96
    91 78 95 98 94 96 98 91 91 99 
    Channel 28, RSSI 99
    103 98 96 98 96 99 97 96 71 97 
    Channel 29, RSSI 97
    102 63 99 98 98 96 82 97 97 95 
    Channel 30, RSSI 95
    102 95 96 97 97 81 95 99 97 97 
    Channel 31, RSSI 97
    95 97 96 97 96 98 98 95 95 97 
    Channel 32, RSSI 97
    90 93 58 96 98 99 98 97 98 99 
    Channel 33, RSSI 99
    103 96 71 97 99 96 98 97 95 97 
    Channel 34, RSSI 97
    101 98 93 96 96 97 97 98 96 98 
    Channel 35, RSSI 98
    102 97 94 92 97 98 96 96 96 97 
    Channel 36, RSSI 97
    103 99 96 98 91 99 97 98 96 95 
    Channel 37, RSSI 95
    103 95 93 95 93 95 96 94 96 96 
    Channel 38, RSSI 96
    101 97 89 89 84 86 97 96 97 97 
    Channel 39, RSSI 97
    102 99 98 98 59 94 68 64 98 97 
    Channel 40, RSSI 97
    102 96 97 96 99 99 90 95 95 97 
    Channel 41, RSSI 97
    101 92 75 79 97 99 94 93 97 96 
    Channel 42, RSSI 96
    63 54 97 96 94 98 96 95 94 97 
    Channel 43, RSSI 97
    101 97 96 98 100 96 97 96 93 96 
    Channel 44, RSSI 96
    103 96 97 97 98 97 95 96 90 92 
    Channel 45, RSSI 92
    103 98 98 90 97 81 83 94 97 89 
    Channel 46, RSSI 89
    103 98 96 98 97 96 97 97 98 96 
    Channel 47, RSSI 96
    103 96 96 97 96 97 95 96 56 96 
    Channel 48, RSSI 96
    103 98 95 99 97 90 94 95 95 95 
    Channel 49, RSSI 95
    86 71 67 68 68 72 67 69 97 77 
    Channel 50, RSSI 77
    103 98 95 95 78 69 99 90 98 94 
    Channel 51, RSSI 94
    102 97 96 94 84 96 97 95 97 98 
    Channel 52, RSSI 98
    101 95 97 96 98 97 96 97 97 97 
    Channel 53, RSSI 97
    102 98 96 99 97 94 96 96 94 97 
    Channel 54, RSSI 97
    103 96 97 98 98 100 96 92 96 86 
    Channel 55, RSSI 86
    104 97 97 98 95 94 95 97 96 92 
    Channel 56, RSSI 92
    103 99 98 99 97 96 99 98 98 97 
    Channel 57, RSSI 97
    103 97 97 97 98 96 93 94 93 93 
    Channel 58, RSSI 93
    101 97 96 97 97 97 99 97 97 98 
    Channel 59, RSSI 98
    100 90 92 89 92 91 89 92 93 89 
    Channel 60, RSSI 89
    101 96 98 96 94 96 97 99 97 98 
    Channel 61, RSSI 98
    95 85 86 82 83 83 82 85 83 81 
    Channel 62, RSSI 81
    100 94 98 96 94 93 92 95 96 94 
    Channel 63, RSSI 94
    98 89 90 87 89 89 91 86 88 86 
    Channel 64, RSSI 86
    99 94 93 95 95 94 94 97 93 93 
    Channel 65, RSSI 93
    102 96 90 95 96 94 97 89 89 90 
    Channel 66, RSSI 90
    100 95 91 94 92 92 94 95 98 94 
    Channel 67, RSSI 94
    103 96 96 97 95 99 97 94 95 82 
    Channel 68, RSSI 82
    103 96 98 99 98 98 97 99 97 99 
    Channel 69, RSSI 99
    104 98 97 91 97 96 97 94 97 97 
    Channel 70, RSSI 97
    101 96 97 96 98 97 97 95 100 99 
    Channel 71, RSSI 99
    102 97 97 93 97 96 97 97 96 97 
    Channel 72, RSSI 97
    102 99 100 99 98 98 97 101 98 95 
    Channel 73, RSSI 95
    97 96 99 96 95 97 100 97 99 71 
    Channel 74, RSSI 71
    103 96 98 97 96 96 97 100 95 94 
    Channel 75, RSSI 94
    102 98 99 97 98 97 99 95 97 97 
    Channel 76, RSSI 97
    102 96 97 99 99 97 95 96 98 98 
    Channel 77, RSSI 98
    102 97 98 96 94 95 97 96 98 100 
    Channel 78, RSSI 100
    104 97 99 97 100 96 98 98 99 97 
    Channel 79, RSSI 97
    69 98 97 96 97 99 80 80 89 96 
    Channel 80, RSSI 96
    Min: 100, Max: 56, Avg 94

     

    Did I insert the delay in the correct place compared to where you implement it?

     

    Kind regards,

    Håkon

  • I inserted the tasks enabling & disabling calls into the for loop (see snippet below).

    The code was dropped from this reply for some reason, here is another try:

    uint8_t rssi_measurer_scan_channel_many_times(uint8_t channel_number, uint8_t n)
    {
    	uint8_t sample = 0u;
    
    	for (int i = 0; i < n; i++) 
    	{
    		NRF_RADIO->FREQUENCY  = channel_number;
    		NRF_RADIO->TASKS_RXEN = 1;
    
    		while(NRF_RADIO->EVENTS_READY == 0);
    		NRF_RADIO->EVENTS_READY = 0;
    		NRF_RADIO->TASKS_RSSISTART = 1;
    		while(NRF_RADIO->EVENTS_RSSIEND == 0);
    		NRF_RADIO->EVENTS_RSSIEND = 0;
    		sample = 127 & NRF_RADIO->RSSISAMPLE;
    		
    		printk("%d ", sample);
    		k_msleep(10);
    
    		NRF_RADIO->TASKS_DISABLE = 1;
    		while(NRF_RADIO->EVENTS_DISABLED == 0);
    		NRF_RADIO->EVENTS_DISABLED = 0;
    	}
    	printk("\n");
    
    	return sample;
    }

  • Did I insert the delay in the correct place compared to where you implement it?

    Actually in order to imitate my implementation the delay should be after the TASKS_DISABLE = 1 and the wait for EVENTS_DISABLED. But when I tried it on the test you provided the delay had no effect (output was almost always -55 dB)

Reply Children
No Data
Related