Friday, April 25, 2014

Si Updates (Examples)

Continuing from the last post on the Si updates and spectrum analyzer-like functionality on the Beagle Bone Black... The basic structure is that the first LO is swept over a specified frequency span.  At each point a measurement bandwidth is used.  This is in fractions of the 1MSPS usable bandwidth of 450, 250, 125, 63kHz.  An FFT of a specified size is conducted on the samples at the frequency step.  The center points are chosen, reflecting the measurement bandwidth.

Below is a screen shot of the full application.  On the left, top to bottom, are buttons to control the IP address to connect to, the sweep center and span, the vertical scale, and some useful processing features like an envelope history and automatic peak picking and assignment to markers.  On the right, top to bottom, are buttons to control the scan resolution, tracking generator control and sweep/step rate, analog processing (IF amplifier, RF amplifier, and attenuation), and display memories.  Only the IF gain is functional as the others require another board (to be completed).  The memories have been expanded to four (the filter response scans have taught me the value of having multiple on-screen comparisons).

Below is a PNG export of a 108MHz signal.  A C board aux output was used to generate a 36MHz square wave.  36MHz was chosen to avoid any of the harmonics surrounding any of the TCXO clocks at 20MHz and 25MHz.  The 108MHz is the 3rd harmonic of the C aux.  A 20dB attenuator is placed in-line between the C board and the B board input to bring all harmonic levels down enough so the amplifiers are never saturated.  The scale is centered a bit off from 108MHz to clearly see the signal over the reticule.  Unlike previous captures, this is indeed calibrated in dBm (finally).  The signal was verified on a 7L12 at -39dBm (+/- 1dBm).  The header lines contain all of the parameters in-use including a measured sweep rate, in this case almost 3 seconds. Ignore the secondary responses - more about them later.
The next export modifies the resolution rate to obtain a faster sweep.  The original sweep at 8k FFT with a 63kHz measurement bandwidth is captured in the first memory (gold line).  In this case a small FFT size has been used (512) resulting in a lower resolution bandwidth (2kHz rather than 122Hz) and a slightly higher noise floor but a much faster sweep rate of 342mS.
Finally, for scanning large bandwidths and when you aren't too worried about the details in the noise, the power can be integrated at every frequency step (i.e. all of the FFT bins summed to produce a single point estimate at the given frequency).  This has the effect of raising the noise floor (its all integrated) and allowing a much smaller FFT size (and number of samples) to be used.  This then translates into the sweep rate being roughly equivalent to the scanning rate of the synthesizer used as the LO.  Don't take the scan rate of 121mS literally, once the rates drop below 200mS there is a lot of fluctuation on both the BBB side and the PC side as none of the processing is done on a real-time basis (so there's lots of fluctuations based on the processor scheduler and state of socket io buffers).  Basically, its smooth enough but just above the eye's  refresh rate detection to know it is not continuous.
Wider sweeps across 30Mhz and 50MHz can be similarly configured.  Unfortunately, this setup is a single IF and has no image rejection filter (the images were verified to come out at the right spots and the same amplitude) so wide sweeps end up looking like a picket fence (there is a second harmonic present at a low level so when you add a response every 36MHz and an image of this every 21.4MHz you get lost in the forest...).

Once the calibration for the mixer, amplifier, and board are added wider scans can be taken at higher frequencies.  The following is a sample of a 500Mhz sweep about a 1500MHz signal at -40dBm.  The lowest resolution parameters have been used (MBW=450kHz, FFT=256) to yield a sweep period of about 2 seconds.  Here the image is clearly visible 21.4MHz prior to the signal in the scan.  You can also see the results of the RF level calibration in the waviness of the baseline.

I have not had time to fully investigate the spurious responses. It is a bit difficult to see where everything is coming from since the higher order harmonics get in with the mixer LO harmonics and wind up in the image band. I also haven't been able to convince myself if the non-uniform duty cycle sampling clock is coming into play at low levels with one or more of the  harmonics on the input when the B board is co-mounted with the A board on a single BBB.   Prior to doing any of this I want to complete an attenuator board and get back to the cavity filters to support a two stage conversion.

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.