I've taken some time to update the spectral investigation software (Si)
application to allow better control over sweep rate, resolution and
noise floor. For reference, the first hardware configuration used is a simple one stage
IF conversion. It uses a BREC A-B
stack. That diagram is shown below.

This provides basic narrow band spectrum analyzer or tracking generator capability. Adding additional down conversion stages and filtering does not change the fundamental structure of the software or approach.

### Spectral Estimation Overview

The Si application is designed like the rest of the BREC
software. That is to say it is based
around a multithreaded user space application with user space device interfacing
software in a single process. As much
processing as the BeagleBoneBlack (BBB) will support is placed in the
application. The basic interface to the
core application (embedded within the WbSvr) is an ascii text command line
interface via a TCP socket (i.e. you telnet into the process). This allows a simple
development and testing model. All GUI
functionality is factored to a java application on the PC based on swing.

### Frequency Scanning

The Si application frequency scanning approach is outlined
in the following diagram.

At the beginning of each loop pass, the configured
parameters are re-evaluated. If changes
are necessary they are applied and the remainder of the frequency step
invalidated. Changes here include
reconfiguring the IF gain, frequency scan limits, FFT size and other key
hardware and software processing parameters.
Samples are collected at the current frequency step. This is done up front to allow the overlap in
time of processing samples while the samples for the next frequency step are
being collected (allows faster sweeps).
The next frequency step is calculated as the current frequency plus the
currently measured frequency range. No
gaps in coverage are allowed. Once the
next frequency is calculated it is applied to the local oscillators and
tracking generator(if enabled). Once the
LO is set and locked the sample queue is flushed and new samples for the next
frequency begin accumulating. At this
point the samples collected earlier can be processed via FFTs to produce a
spectral estimate around the original frequency center. The spectral estimate can then be adjusted
for gain calibration and sent to the graphical application across the network
for display.

### Measurement Bandwidth

For each frequency at which the spectrum is measured, there
is only 500kHz of available information based on the 1MSPS sampling rate. An under-sampling/aliasing approach is taken
so the samples are centered about 10.5MHz to 11.0MHz. Not all of the 500kHz is useable for spectrum
evaluation for three reasons: IF filter bandwidth, DC bias, and out of band
aliasing. The 10.7MHz ceramic filter has a 3dB bandwidth of 330kHz centered at
roughly 10.75MHz. If we are willing to deal with
some reduction in response we can use more than the 3dB filter limit. The ADC samples are not zero biased in
sampling or software (this avoids the need for per unit offset calibration as
the mid-point is set by a resistor divider reference and subject to component
variance). This offset produces non-zero
response in the FFT in the lower frequency bin(s). The out of band aliasing consideration is
illustrated in the following figure.

In this diagram we have an input signal in dark blue and the
IF filter response in light blue. It has a non-zero response beyond the
aliasing limits. The attenuated
frequency component of the input beyond 11.0MHz will alias back down as the red
frequency response. By using less of the
sampling bandwidth for measurement we avoid such aliased components of the
input. The further away from the
aliasing edges we go the more the aliased responses are attenuated.

### Estimate Spectrum

Once a set of samples is collected the spectrum can be
estimated. There are multiple techniques
available, however, the simplest from a conceptual and implementation perspective
is the FFT.

Given a set of samples, N of these are taken where N is the
FFT size and have a window applied to them.
A discrete Fourier transform works on a periodic input sequence. If the beginning samples do not “meet” the
end samples, the periodic version of the signal has a discontinuity. This
results in broadening of the spectrum. The
function of the window is to taper the beginning and ending of the time series
to zero so that the periodic version of the samples has no such
discontinuities. If we have more samples
than consumed by a single FFT, we can slide down the sample sequence and take
another FFT (with windowing) and add this to our first estimate. This results in averaging of the
results. Since the averaging is done
with the raw FFT output (not just magnitude) better noise attenuation can be
obtained (i.e. coherent averaging). Once
the FFT estimate is produced, the frequency bins for final use are selected. This is based on the measurement bandwidth
selected (MBW). As the input signal has
a DC bias we do not want to use the lower bins.
To avoid out of band aliasing we do not want to use all of the bins at
either end. We select a specific number
of bins about the center of the FFT results.
This involves selecting a fraction of the N/2 available samples centered
at N/4 (recall an N point FFT produces N outputs, however, half of them are the
mirror image or negative frequencies in the case of a real valued input). The full N/2 set represents Fs/2 where Fs is
the sampling frequency and in our case 1MHz.
The number of bins selected is MBW(kHz)/500kHz or the fraction of the
available bandwidth. Once the frequency
bins to be use are selected, the bins are converted to a magnitude squared
result representing the power in a frequency bin (i.e. M2=I^2 + Q^2 where I and
Q are the real and complex FFT values).
There is no need to apply a square root as this can be done in the
logarithmic output by multiplying by 10 rather than 20. The mag squared results have to be adjusted
for averaging, FFT normalization, windowing and converted to a logarithmic
scale. It is during this normalization
that we also optionally sum bins. This
summing is an integration whereby power from some number of frequency bins is
combined yielding fewer bins but with more power in each.

## No comments:

## Post a Comment

Note: Only a member of this blog may post a comment.