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:

Reply Children
  • Hi,

     

    I am not sure what you mean by "interval" here, but I tried to replicate something similar, by taking 'n' amount of samples and printing them per channel.

    Here's a quick test from my side:

    rssi.zip

     

    I just used 100 ms as a delay between each RSSI readout.

    Here's a print out after sampling 80 channels, ie. 2400 - 2480 MHz:

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

    On channel 52 for instance, you can see one sample that went quite high, -54 dBm. That is likely "something" (I'm guessing wi-fi from my phone) that was picked up.

     

    Kind regards,

    Håkon

  • Hi,

    Thanks for the example!

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

    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?

  • 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

Related