Friday, April 18, 2014

Si Updates (Background)

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.

Output Spectrum

Once the spectrum estimate at a given frequency and in dB is obtained the last step is to send the final outputs.  There is one small computation necessary beyond just sending the results – converting to an absolute value.  The FFT based output took care of normalizing and accounting for processing gains, however, the inputs were fundamentally 16 bit unsigned integers.  These came directly from the ADC and reflect 12 valid bits centered within the 16 available.  Hence, they are normalized to a 16 bit full scale value (logarithmically).  Several calibration factors regarding the gain in the analog processing chain must be applied.  Fundamentally, the ADC is converting an analog signal from 0 to 3.3V into a number from 0 to 2^12-1 (and doing it linearly we hope).  The power at this point is difficult to calculate as the input impedance of the ADC while sampling is not easy to precisely characterize.  However, we do know that the input to the first amplifier is terminated in 50 ohms (impedance matched at 300 through the ceramic filter and firmly terminated resistively at the first opamp input).  Suffice it to say that if we apply an offset to the normalized FFT outputs (in dB) we can convert from full scale 16bit logarithmic to volts at the ADC back to milliwatts at the first amplifier input.  Since this portion of the signal chain is narrow band these factors are constant and a function of the amplifiers settings.  We can then apply the additional gains at the amplifiers and mixers to get from the power level at the IF to the power level at the RF input.  This last set of gains is broadband and not constant over the frequency range (unlike the narrow band IF case).  Measured tables are used to apply these calibration factors.  What is ultimately sent to the graphical user display is an x,y pair representing the frequency and power level in dBm at that frequency.

Saturday, April 12, 2014

Filter response with separate B/C boards.

The Si software was updated to program the C board aux output via the network while using a single stage down conversion with a B board, and an A board to scan the power (block diagram in this post is still valid, but with A and B on one BBB and C on a separate BBB).  The last cavity filter constructed was then scanned to produce the figure below.  The vertical scale is in dB (but to convert to an absolute dBm takes some calibration and calculations that I haven't incorporated into the software yet).
The gold line is the filter response.  The filter is removed to leave an open input and output producing the lower green line.  The C aux output is fed directly into the B RF input to produce the upper blue and green lines.  Here the baseline response (with nothing connected to the B RF input port) is nice and flat as opposed to the lobing behavior when the B and C boards are co-mounted (see previous posts on RF leakage and first measurement of this filter).  The waviness in the full scale response with the C board directly connected to the B board is new to me.  I haven't observed this previously but may not have been able to notice this fine structure when the boards were mounted together.  The piecewise linear segment nature and rough frequency span seem to indicate these are VCO bands within the synthesizer.

This response was then compared to the filter response taken manually using a spectrum analyzer.  That comparison is below.
This is encouraging (especially relative to the original response using a co-mounted B/C board as in the previous post).

Friday, April 4, 2014

B-C RF Leakage

I knew that trying to mount the boards on a BBB and mount all of them together would pose some problems...

While measuring a filter response using an A-B-C stack on a single BBB a high baseline was noted with lobing characteristics around the 1600MHz region.  To better understand the cross coupling between LOs among the boards, a spectrum analyzer was connected to the RF input port.  The other board's LO is powered off (VCO power down on the ADF4351) and the aux output is disabled.
You can see the situation is pretty pronounced beyond 1GHz.  Below 700MHz its difficult to identify the LO within the background noise from the BBB and other sources.  This was then followed up by enabling both LO's (at 10.75MHz apart as in the two stage conversion), aux output off,  and measuring each frequency at the RF input port of each board from 800MHz to the limit of my 7L12 spectrum analyzer (stop laughing).  The following figure captures that information.
A fair amount of investigation was done (disabled amplifier block, added 100pF supply bypass capacitors to the mixer,...).  In short, I cannot locate a single source of the leakage (I'm not sure if this is good, bad, or within expected behavior for this type of configuration).  There were many compromises (and errors) made in the layout of these boards.  Part of the goal of this project was to learn and experiment - just go do and learn as opposed to endlessly read, study and simulate.  The next step is to separate the B/C boards on to different BBB's and update the software to control them over the network.


Thursday, March 27, 2014

Coaxial Cavity Filter - Unit #3

This attempt differs from the previous in two important ways.  First it uses a DB9 pin on the SMA post with some heat shrink tube.  Second it uses threaded brass rod to ease fixing the final tuning.  The rest is the same as unit #2 (1/8" thick brass plate, 1.25" x 3" as the base, 1" copper pipe for outer tubes at 2.25" long).  The loops are set at 3/8" from the base plate and in the case of DB9 female connector this is about at the top of the pin where the soldered wire starts. (Recall the idea with the DB9 pin is to provide mechanical attachment between the loop and the SMA connector while soldering it to the base).  The SMA connectors are 063 board edge with the board pins broken off and soldered flush with the base.  The following shows the SMA loop prior to insertion and the SMA loop inserted into the already soldered tubes.  The loop between the cavities is just coax through a hole drilled between the tubes, insulation left for the inter-tube hole, and the ends passing through the base plate.

This worked quite well.  Care has to be taken with the SMA loop as it may provide tension and push the post off the center of the hole (the heat shrink tube helps minimize this).  The filter loops were slightly tuned and the posts inserted and filter center tuning begun.  The following picture shows the final assembly.  A top plate was not needed for fine tuning at this point (may be attached in the future with tuning screws to fine tune the response).


The original section tuning was done using an A-B-C stack with the Si application.  This is good enough to adjust the inner tubes.  As noted by others, use of threads on the tuning rods does cause some problems.  The inner tubes do not always make good contact with the base thus creating times when the filter response drops out.  This isn't a problem when the jam nuts afix the rods in final tuning.  If you apply a slight amount of pressure good contact is made while tuning.  My plan was to solder the rods in place (the threads were only intended to hold the rods firmly while upside down to prevent any movement while soldering), however, the nuts have proven to be quite stable so far and provide the ability to modify the tuning in the future so I've elected to stay with them for the time being.

The following is the response as traced by the Si application (previous post on unit #1 includes block diagram). The blue is the response of both sections while the gold (its faint) is a memory of the response with no filter attached. Not shown, is the unattenuated loop where the C-Aux is input to the B RF input directly yields a ~ -50 dB level.  This indicates a roughly 8dB insertion loss.
There are a couple of issues going on here.  First I could not get both filter sections to fully overlap - I always ended up with the double peak response.  This may be due to over coupling between sections (need to go back and do some reading).  The other issue is the roll off is not as expected for a two section filter.  Part of the concern is the response without the filter (gold line).  To investigate this, I used a spectrum analyzer to conduct a manual filter response.  Those results compared to the Si results are below.
The baseline response scan (no filter) seems to have a lobed character when you scan out several hundred MHz.  It appears there is some kind of bleed through of the C board RF into the B board keeping the base power level high.  Before fine tuning this filter or constructing another 2 section filter to cascade I need to spend some time with the Si response.

All in all this approach is better than previous attempts.  Using 1/8" brass plate might sound nice and sturdy but it creates a lot of thermal ballast which makes soldering tricky.  The material I wish I had read *prior* to starting this is from Sam Wetterlin.  He has two documents far down the page that go into great detail on variations on cavity filter construction.

Friday, March 21, 2014

Coaxial Cavity Filter - Unit#2

The second try at building a cavity filter takes a slightly different approach.  This time I used 1/8" brass plate and the SMA connectors are mounted on the outside rather than the inside.  This avoids the problem with shortening the cavity with the SMA base protruding into it and the solder paste and flux running down the connector threads clogging them up. 

This filter is also constructed as a two section filter with each built independently and inter-section coupling done externally.  The following pictures capture the construction.  Starting at upper left and moving clock wise they are: a) second section SMA loop connections prior to mounting the outer tube, b) inside the filter after loops have been bent around and soldered, c) outside view of both sections, d) end view of filter.
The SMA connectors were soldered first, the loops constructed, then the outer tube soldered in place, tuning and then inner tube soldering.  The first section worked fine.  Indirect heat was used on the outer tube to minimize heat to the base and SMAs.  Amazingly enough this worked well.

The second section was a different story.  After initial tuning and alignment with the first section, the inner tube slipped during final soldering.  While trying to correct this one of the SMA connectors shifted and shorted the post against the side of the insertion hole.  At some point the filter was dropped breaking the solder on the outside tube of section 1. (hint: whats the visual difference between hot and cold brass - none, other than the blister after touching it)  When it was all said and done both sections were corrected and worked, unfortunately their response centers were too far apart to be pulled together using 1" 6-32 tuning screws. [ being off by 1/16" inner tube length difference is roughly 75MHz and the furthest I can pull with the fine tuning screws is about 28MHz ].

The SMA board edge connectors on the outside appear viable, proper soldering and construction order should help, and tapping the center tube will avoid some of the final assembly and adjustment problems.

Friday, March 14, 2014

Cavity Filter

The A-B-C board combination can be re-configured via the SMA connectors to act as a simple spectrum analyzer with a tracking generator to measure filter responses.  That configuration is shown below.

The Si (spectral investigation) application steps the B board IF to be 10.75MHz above the  frequency of interest.  The C board synthesizer is set to the frequency of interest and the Aux output enabled.  The A board measures the power within a 250kHz window centered on 10.75MHz and converts to a dB 16 bit full scale.  This is repeated as the frequency of interest is scanned.  It isn't a true spectrum analyzer with tracking generator but it enables filter evaluation and tuning.  It takes a few seconds to scan a large bandwidth.

The figure below is the response of a home made single section coaxial cavity filter.  The gold line is a memory capture of the C Aux output directly into B RF input.  Not sure whats going on with the base response on the lower end (its stable and consistently like this - my guess is there is some kind of coupling going on between the boards in this frequency range).  The blue line is with the C board Aux connected to the filter.
This particular frequency response was taken prior to loop coupling adjustment so its very wide.  I have to admit that I've always been interested in constructing a cavity filter, however, never had the equipment to tune one.  This enables a reasonable tuning and response measurement.

The unit constructed was an initial test version to explore and understand the construction techniques outlined in "Quarter Wave Cavity Filters Using Copper Pipe, Mike Suhar, WB8GXB" and "Coaxial Cavity Filter for  Modularized Spectrum Analyzer, Scotty Sprowls".  The most significant difference is trying to use board edge SMA connectors rather than semi-rigid coax connectors and tubing (current price and availability). The pictures are prior to tuning (center tube not placed yet).  A single section is constructed for simplicity and learning.
Yes the top and bottom plate are a little wavy - they are copper pipe that was split in two and hammered flat.  When you've got the hack saw and propane torch out who can be bothered with waiting for the appropriate materials. The next step is to refine the construction techniques.

Friday, March 7, 2014

BBB Performance Notes

As part of this activity some of the BBB processor and network performance have been measured, investigated and characterized.  One of basic points is that 1MSPS (treated as 16 bit samples) is readily processed by the ARM processor and transported over the network.  In the SDR server application a down conversion and integer FIR filter is applied to the samples and sent via UDP.  This takes on the order of 87% of the processor (measured via “top” application).  While the processing is minimal, it is sensitive and on the edge.  If "–O3" is not used in compiling the FIR filter, the processed sampling rate drops from meeting 500k complex samples/second to fluctuating around 300k complex samples/second.

One of the open questions which I had no data on was the FFT performance of the ARM processor.  The Si (spectral investigation) application was designed to conduct all processing except display on the BBB.  This allows for thin java clients for control and presentation only (e.g. tablet or phone).  The FFT performance is an important aspect of spectral evaluation in the application (at this point I haven’t moved to poly-phase filter but wanted to focus on FFT based processing as a start).  The original work used a simple FFT in C from a reference text.  This approach was intended to be instructive, not high performance.  This was then updated to use the FFTW package.  The table below captures the measured FFT performance with a magnitude squared calculation on the ARM comparing both implementations.  Note: These are double implementation FFTs (not integer – which will be evaluated later if need be, wanted to start simple), also the mag squared operation appears to take a very small fraction of the time.
FFT Size
Time (uS) Reference
Time(uS) FFTW
256
907
557
512
2069
777
1024
4978
1619
2048
10156
4128
4096
21990
9143
8192
49383
20219
16384
116065
45883
The impetus for focusing on this metric is that in a spectrum analyzer like application, one of the key metrics is the refresh rate at a given frequency span.  Based on the hardware at hand this translates into frequency stepping speed.  The driving aspect of this is the collection of samples.  Based on previous noise measurements, a good starting point seems to be around an 8k FFT.  At 1MSPS the collection of 8k samples will require 8mS [i.e. (8E3 sample)/(1E6sample/sec)=8E-3 seconds ].  Sample collection can be overlapped with power spectrum estimate calculation (i.e. FFT) and transmission of results.  So the bottom line is the target is 8mS per 8k FFT which is not being met based on the data above.  There are a couple of options including switching to an alternate power spectrum estimate technique or evaluating integer FFT performance. (FFT3.3.3 includes ARM NEON support).  This will be deferred until further hardware characterization is complete.  An interim target of ~30 steps per second appears readily achievable which if we use 250kHz per step yields a sweep rate of 7.5MHz per second.