dbOffset values in fftviewer to compute dBFS

Hello.

I’m looking into LimeSuite source code on github.
In file \src\fftviewer_wxgui\fftviewer_frFFTviewer.cpp
there are some statements that compute the signal power in dBFS to be presented in the GUI plugin’s window.

This is the section of code I’m interested in:

void fftviewer_frFFTviewer::OnUpdatePlots(wxThreadEvent& event)
{
double dbOffset = lmsIndex == 2 ? 93.319 : 69.2369;
if (mStreamRunning.load() == false)
return;

const int fftSize = streamData.fftBins[0].size();

float chPwr[2] = { 0, 0 };
double cFreq[2] = { 0, 0 };
txtCenterOffset1->GetValue().ToDouble(&cFreq[0]);
txtCenterOffset2->GetValue().ToDouble(&cFreq[1]);
double bw[2] = {1, 1};
txtBW1->GetValue().ToDouble(&bw[0]);
txtBW2->GetValue().ToDouble(&bw[1]);

for (int c = 0; c<2; ++c)
{
    float f0 = (cFreq[c] - bw[c]/2) * 1e6;
    float fn = (cFreq[c] + bw[c]/2) * 1e6;
    float sum = 0;
    int bins = 0;
    for (int i = 0; i<fftSize; ++i)
        if (f0 <= fftFreqAxis[i] && fftFreqAxis[i] <= fn)
        {
            sum += streamData.fftBins[0][i];
            ++bins;
        }
    chPwr[c] = sum;
}

float pwr1 = (chPwr[0] != 0 ? (10 * log10(chPwr[0])) - dbOffset : -300);
lblPower1->SetLabel(wxString::Format("%.3f", pwr1));
float pwr2 = (chPwr[1] != 0 ? (10 * log10(chPwr[1])) - dbOffset : -300);
lblPower2->SetLabel(wxString::Format("%.3f", pwr2));
lbldBc->SetLabel(wxString::Format("%.3f", pwr2-pwr1));

I see that the power is computed using 10 * log10( channelPower )) - dbOffset
where channelPower is the sum of the fft bins
and dbOffset can be either 93.319 or 69.2369

4 questions:
Could you please clarify what are those 2 decimal values for dbOffset?
Are them calibration offsets? if so are them valid for any purchased board? Why 2 values?

thank you,
mario

Tagging @IgnasJ.

Hi,
The values are to bring the maximum to 0. Two values are for 12-bit and 16-bit as they have different maximum values. Sample format is selectable.

Thank you @IgnasJ
Is it possible to use this plugin as a measurement tool?
Example: should I place a noise source with fixed attenuator at the LNAL input of LimeSDR, could I measure the noise power over the tuned frequency and bandwidth?
Can I convert the dBFS output to dBm?

thank you,
mario

Hello Mario,

Yes it is possible to use FFT viewer to measure signal to noise ratio. The FFT viewer provides bandwidth and offset to integrate noise power over a particular bandwidth - this feature can easily be used to measure noise at ADC input.

Measuring absolute noise power is a little more difficult as it needs some sort of reference to measure absolute gain and added noise from the receiver (e.g. Y factor method with Noise Diode source with known ENR). Once gain and noise figure have been measured over a particular frequency range, input noise power can then be measured and corrected for receiver noise figure.

Please be aware when measuring noise with a strong CW signal present (approx -25dB), there is a risk the noise power measurement accuracy will be reduced by the phase noise profile of the synthesizer.

For a dBm <-> dBFS conversion you would need to know the 0 dBFS peak voltage value, which in this case is equal to 0.8 V.

Regards,
Karolis

@IgnasJ Why is the data format dependent on the stream type (SISO,MIMO)? Looking at the Initialize function, for the case of a LimeSDR USB or LimeSDR Mini device, it appears that the number of channels would always be <=2, thus the lmsIndex would always be <=1 and hence the format always be LMS_FMT_I12. Thanks.

Data format does not depend on SISO/MIMO mode. FFTviewer in LimeSuite uses 12-bit format by default. You can modify it to use 16-bit format if you want, but LMS7 chip gives only 12 bits anyway. The only exception in LimeSuite is made for external 14-bit ADC/DAC.

Thanks. The code is difficult to understand and uses indirect and conditional logic to determine the format. I wouldn’t call the use of 12-bit format default, per se, but I see that that is the net result.

lmsIndex = cmbStreamType->GetSelection()/2;

There are no code comments in StreamingLoop nor elsewhere.
Is the “external 14-bit ADC/DAC” device to which you refer an internal testing device, something coming down the pike, or just a concept?

Hello @Karolis
Thank you for your kind answer and sorry for my late reply.
I would like to measure thermal noise produced by a 47 ohm metal film resistor connected in place of the antenna.
I already soldered to a coax and placed the resistor inside an epoxy layer to isolate from water…

Do you think the LimeSDR is sensitive enough to measure such noise ? Probably setting LNA/TIA/PGA in a proper way?

I also have a diode based noise source but I’m waiting for resistors to build an RF attenuator to arrive in the mail…
In the mean time I would like to measure hot and cold noise placing the resistor at 0 and 100 °C …
I’m expecting the following values:

Kind regards,
Mario