Thursday, July 30, 2015

Constructing a simple browser controlled RF synthesizer (Part1)

Now that I had a set of modules lying around that have served their initial purpose I had to figure out another boondoggle (or just send them to the recycling center - if you are the kind of person reading this type of material you need no explanation regarding the value of boondoggles versus putting something on the shelf...)

Existing modules with a BeagleBone Black were assembled to produce a frequency synthesizer. The frequency range is 37 – 2000 MHz (CW, square wave) with at least a few kHz of resolution. The level is controllable 0dBm to -30dBm with an accuracy of +/-2 dBm.  For simplicity it uses an external 5V power supply with 100Mb/s Ethernet and web browser user interface.  You can purchase instruments like this on eBay for $200 - $600 from a few sources.  They generally have wider output level ranges and support the full frequency range of the ADF4351, come in smaller packages, and are USB only.  You won’t save yourself any money by building your own (but you’ll have more fun and learn a lot more…).

The idea is to have an  “instrument like” device – something you can plug in, turn on, use, and then turn off.  I did not want to have to spend lots of time drudging up utilities on the PC or worry about shutting the device down properly.  This is part of the reason for focusing on a web browser based control approach (and I wanted to get some hands on experience with embedded web techniques and technologies).

The basic aspects of this project are:
a) Digital and RF Hardware
b) BBB Linux Configuration
c) User Interface Software
d) Packaging

The notes are broken into multiple posts focusing on each of the steps above. The hardware involved was developed in pieces over time and is described in this entry.  In short, an ADF4351 is used as the synthesizer source and the level is controlled using an amplifier with digital step attenuator and a LTC5587 power meter. The basic control software adjusts the attenuator and synthesizer output until the final output is at the desired level.

Sunday, July 12, 2015

Single stage SDR experiment

After spending a lot of time trying to understand and evaluate the ADC distortion and noise artifacts I decided to try something different with the ADC board.  Previously I built a 1MSPS serial ADC board and mixer, amplifier and filter board.  These could be arranged in various configurations. One of those was a single IF SDR.  I wanted to try the same setup with the new ADC and some of the other mixer and amplifier boards constructed. The following is a picture of that setup.
Single IF SDR using various boards with Beaglebone Black.  See text for description of boards and links.
While it may appear somewhat rubegoldberg-esqe it is actually pretty rewarding to be able to build a set of modules and software and connect them together with a few cables and make something work.

The setup is for a FM broadcast receiver.  The signal enters at the bottom center board on its left input.  This is a Prj133 synthesizer with mixer board controlled via an SPI interface.  There are no image rejection filters for simplicity.  The output is a 10.7MHz IF exiting the board at the right. The IF is amplified in the upper right board which is a Prj135 amplifier, attenuator, power meter board, again controlled via SPI.  The amplified output (exiting the top of the board) is passed through a 10.7MHz bandpass filter using two cascaded ceramic filters.  A single filter is sufficient, however, all of the filters I have built use a 2x cascade for ADC harmonic rejection testing.  This creates a little more loss than I need or like but it was sitting there ready ... Having it hanging there in mid air also creates the appearance of putting the "rube" with the "goldberg"... but it was good enough for a quick test.  The filtered signal enters the ADC board on the center left.  You can see the SMA input but nothing else as the board is mounted on top of a Beaglebone Black but under another board (if you look at the stand offs you see 3 sets high).  The board on top of the ADC is a Prj136 interface board which provides 3 ports of discrete IO (which can be software configured for SPI control) and +5V of power.

The software on the BBB is the same as used in previous projects (single stage IF two stage IF).  It supports an amature radio control protocol interface which allows multiple PC SDR packages to be used.  The only difference is that the 10MSPS ADC stream is downsampled to 2.5MSPS (the ethernet bandwidth does not support the full 10MSPS nor does the BBB processing).  This is still larger than the serial ADC sample rate of 1MSPS so it is a little different and the distortion is better.

The clip below is a screen capture of using the SDR to move around the dial.  A VHF set of rabbit ears was used for the antenna, however, it was below ground (i.e. in a basement).  The NOAA NBFM signal takes a few seconds for the software to lock well (I believe this is an issue with my software configuration, not the hardware).


Thursday, June 25, 2015

ADC without Amplifier

In an effort to evaluate the ADC harmonic distortion and spur clusters I decided to create a variant of the ADC board which did not have the amplifier (earlier version).  This allows me to revisit the ground plane, add resistors to the digital lines and re-layout the sample clock signal.  It ends up being as close to the ADC reference design as possible.
BeagleBone ADC board with transformer input.
The first unit anti aliasing filter was not populated to allow evaluation at multiple frequencies.  Two different regulators were tried - the original 150mA and a 300mA version.

Constructed ADC board with transformer input and no amplifier. ADC anti-aliasing filter not populated.  TCXO in upper right, input transformer at lower right, ADC right of upper center, regulator and reset on left.
As in previous measurements, a DDS at 10.640MHz was used as the input.  This was filtered through a 2x 10.7MHz ceramic filter.  Without the amplifer this setup was not able to drive full scale, rather -3dBFS.  That spectrum is shown below.
-3dBFS 10.640MHz input
HD2 is still -79dBc and the spur clusters are present at the same levels and locations as the same version of the board with amplifier ( HD2 compare and spur cluster compare).  The grounded input spectrum looked similar to the previous versions with the amplifier (flat at -107dBc with small clusters at 2MHz and 4MHz in the -100dBFS range).

The continued presence of the spur clusters is disappointing but I am out of ideas on the root cause and decided to put it away for a while and move on to other topics.


Saturday, June 13, 2015

Prj137 ADC Spur Clusters

The spur clusters from the previous work proved to be an evasive problem.  Very little changes the location or the level. The structure seems to indicate there are many harmonics present based on the clustering.  To better understand this I walked the source up and down to see which ways the clusters moved (i.e. in even or odd nyquist intervals).  A capture of that is below.
Spur cluster walk from 10.640MHz up in steps of a few kHz.
Using the even/odd interval, I then stepped the fundamental by a few kHz for several steps and captured the peak of each cluster.  A fundamental delta of 10kHz moves the clusters 10kHz, not some multiple.  This told me I was looking at a modulation, not a set of harmonics of something.  If you put all of this into a spreadsheet and play around ruling out things based on even/odd nyquist and unrolling a given peak to all of the frequencies it could be you get the following table.
Spur cluster peak unrolling across Nyquist intervals
The cluster peaks are under "ADC (MHz)" and the color codings of cells match up the expected frequency the cluster represents after folding.  The rows at the bottom capture the delta in MHz of the peak from the fundamental at 10.640MHz.  So for the highest peaks of the spur clusters they appear to be 2MHz from the fundamental and appear to me to be switching power supply noise, evaluated here.  The lower spurs within the cluster would then be the AM modulated signals of the higher harmonics of the 2MHz switching impulses folded around the Nyquist regions.

Indeed, you can do the same thing at a lower sampling rate.  This both shows the fine scale structure and the harmonic spurs and verifies the above unrolling at a different set of frequencies. The following is a 2.5MSPS capture of a 10.640MHz input signal.
10.640MHz input signal using 2.5MSPS showing the spur cluster internal structure.
Numerous attempts were made to ameliorate the clusters.  This included adding/changing the supply chokes and bypass coupling.  As previously, these made no impact.  Additional ground ties were added, and removed - again with no impact.  The next logical step (in my mind) is to understand if these are coming from the amplifier or the ADC and to remove as much of the circuitry as possible.  This means backing up to a just the ADC and a transformer input - basically mirroring the ADC evaluation unit circuit.

Saturday, May 30, 2015

Prj137 Onboard BPF

Given the state of HD2 from the previous post with the BBB 10MSPS ADC board, I used Elsie to design a 3rd order BPF centered at 10.7MHz with a 3.5MHz bandwidth.  It takes a bit of trial and error to arrive at a synthesizable filter (i.e. one that uses standard values and is not overly sensitive to part value variations).  The intent is not to provide complete band rejection, rather to limit the noise from folded Nyquist bands and to knock down any harmonics created by the FDA.  The filter values along with a spice run are shown below.
SPICE steup of FDA with BPF prior to ADC.
The 902pF shunt capacitor is an 820pF with a 82pF stacked on top (the target was 900pF however these were unavailable at reasonable prices and shipping times).

BPF Filter Response
For comparison purpose the first spectrum below is the same measurement setup with no filter.  In this case (and all following) the gain has been reduced using an Rf=100, Rg=25 (this was one of the attempts to see if gain was exacerbating the harmonic distortion).

Av=4, Filtered DDS source at 10.640Mhz, no FDA-ADC filtering.
Rather than just populating the entire filter and seeing what happened, I decided to populate each stage and evaluate HD2/HD3 and the noise floor.  I chose to evaluate the center shunt stage first since I thought this had the best chance of producing expected results without imbalancing the differential arms.  Those results are below.
Av=4, Filtered DDS source at 10.640MHz with shunt stage of FDA-ADC BPF populate.
At first it seems worse, however, the noise floor has been reduced by the BPF limiting the folding noise across Nyquist zones.  This presents the illusion of the spurs being more prominent not because they have risen but because the floor as dropped.  HD2 is now roughly -74dBc and HD3 is not noticeable.  I did not pause to measure the gain and evaluate the filter insertion loss.  If one stage was good more must be better...  Unfortunately, this wasn't true.  Adding the first series made things slightly worse and with a higher noise floor.  Adding the second series stage and final BPF stage helped HD2 slightly but retained a slightly higher and tilted noise floor.  Addition of the final LPF (shunt C and series 5 ohm resistors) returned things to slightly better than the above.  The results from this configuration are shown below.
Av=4, Filtered DDS source at 10.640 MHz with 3 stage BPF.
HD2 is now approximately -80dBc but HD3 is similar but a little higher.  Interestingly enough, in no case did the spur clusters ever change.  These are now the dominant (and unexplained) feature.

At this point it was time to total up the bill for all of the filtering.  I knew the insertion loss was creeping up since the DDS level had to be adjust up to hit nearly full scale on the ADC.  I decided to return the FDA to a high gain previously used Rf=493 and evaluate the results.
Rg=25, Rf=493, Filtered DDS source at 10.640MHz with 3 stage BPF.
As expected the spectrum did not change with the increased gain. Using the same technique as in previous gain measurements, the gain was measured as Av=15.6(15dB) but Rg/Rf indicated it should be Av=9.9(20dB).  The FDA datasheet indicates this type of gain is readily supported by the device at this frequency so it looks like the insertion loss is 5dB for the 3rd order BPF.  This is higher than I had hoped for, however, I did not use the highest Q components made, rather the best ones in stock for these values at the time.

So in the end it appears the higher than expected HD2/HD3 response is predominantly deriving from the FDA and how it is being used.  Taking them down to a reasonable level adds components and increased gain needs on the FDA.  This seems like a losing game.  I may have been better off placing all of the desired gain off board, then filtering, and then conducting the differential conversion on the board with a transformer.

This is still usable for my purposes, however, the spur clusters merit some attention.  Originally I had attributed them to DDS artifacts, however, it became clear this was not the case when using a source comprised of a synthesizer and mixer.  In both cases the spurs are identical in level and structure and follow the fundamental in frequency and level.


Saturday, May 16, 2015

Prj137 HD2

Continuing with the ADC and having data on the noise floor and amplifier gain, the next step is to revisit the harmonic distortion of the board.  Previous efforts on earlier boards left me with questions regarding how much of the second harmonic (HD2) response observed was from the device versus the source and filters. When measuring a strong signal it is difficult to assess the harmonic content since even good spectrum analyzers will have a harmonic response themselves larger than I am trying to investigate with a 12 bit ADC.  The basic test filter I use is a 2x cascaded 10.7 MHz ceramic with a 3dB pad between them and a LC match from 50 ohms to 330 ohms.  The vendor does not provide a broadband filter response so I have always been left wondering what the actual response is at the harmonics (best case 50dB of rejection, worst case ...).  To address this I decided to construct a notch filter and focus only on HD2.

Below is the filter schematic and spice simulation.  I used the Elsie software package and selected L/C values I had on hand for a 50 ohm termination and notch response at HD2 for a 10.7MHz signal.
Notch Filter for Approximately 21.4Hz (HD2 of 10.7MHz signal)
The filter was constructed on some scrap PCB using an Xacto knife to cut the pads.  It is a bit tedious and care must be taken to do this away from other boards to avoid copper shavings landing where you don't want them but for small things it is faster than waiting for a board.
Constructed HD2 Notch Filter
The response of the filter was measured with a spectrum analyzer set at an input level of -15dBm. The response was scanned in large increments to save time hence the steps in the response.
Measured Response of Filter
The rejection in the range of interest is -50 to -70 dB and I trust the results in measuring the notch response more than than the harmonic response since the total input signal level is low causing less uncertainty regarding the measurement device behavior.

Using the above notch filter and a 10.7MHz BPF and ADC Unit#1 the following spectra was obtained with a synthesizer/mixer source (non-DDS).
ADC measurement of 10.640 MHz input through notch filter and BPF.
Unfortunately, HD2 is only ~65dBc.  This is significantly less than expected.  In addition there are several spur clusters besides HD2 and HD3 (markers 3,4,5,6). In fact, this is worse than the 74dBc from an earlier version of the board at lower levels.  With this measurement, there is no question regarding the input level of HD2; the notch should provide in excess of 50dB of HD2 rejection, the source HD2 is measured at least -40dBc, and the ceramic filter should provide another 25-50dB of HD2 reduction.

My first estimate was that the distortion was occuring in the fully differential amplifier (FDA). The datasheet shows -80dBc to -90dBc for HD2 and HD3 under various feedback configurations and loads at 10MHz using a 2Vpp output and a single ended input. There is a figure showing 10dB of variation in this with different common mode voltages (near the range I am operating using the ADC common mode voltage output).

In an effort to probe the FDA contribution, I changed the gain of the FDA down and up (ensuring all resistors were 1%).  In no case did this change HD2, HD3 or the spur clusters levels.

The last aspect of this which I can think of is that my input resistor is small compared to general applications referenced in the datasheet.  The exact impacts of this on distortion are not clear to me (if any).

In the update of the board, a BPF filter was added between the ADC and FDA just for this concern. The next step is to leverage the filter and monitor response changes in HD2/HD3 and the spur clusters with the idea being if they are attenuated the FDA is the source, if not, the ADC is the prime contributor.

Saturday, May 2, 2015

Prj137 Fully Differential Amplifier Gain

With a better understanding of the noise floor and spurs on the ADC board I wanted to check the actual gain produced by the buffer amplifier.

The gain was measured by Tee’ing a DDS output, post filter, to the oscilloscope (with 1M impedance), and into the ADC.  The DDS attenuation was varied to produce different levels that were measured on the scope and with the ADC in dBFS and counts.  The value of using counts is that the dbFS has small deviations from expected (0.9dB).  I believe this is due to an error in my windowing amplitude correction.  The ADC count levels are obtained using the peak picking on the time series with the offset found by “peaks” on a no-input signal.  The values are all 16 bit normalized.  The full scale is 1V. The following table captures measured values and those values processed to produce a voltage gain.
ADC values with input using Rf=294,Rg=25 ohms.
I trust the large value oscilloscope readings more than the smaller ones (scale had to change and I'm not completely sure of the calibration across scales).  Using the ADC count reading the voltage gain is roughly 5.3 (14.5dB).  The expected gain is 294/25=11.8 (21.4dB), however, this is fully differential gain on a differential input.  The actual and measured input is only half of a differential signal so in this configuration we would expect the single ended input gain to be half or 5.9 (15.4dB, or 6dB lower).  To me this agrees well and is fine for my purposes, however, my intuition and mental calculations with differential signals is not what it should be.  I often apply the wrong factor (multiply by 2 when the quantity should have been divided by 2 or the other way around). Just for sanity, I decided to use SPICE to verify the setup.  Normally I use TINA Spice, however, I had difficulty integrating the LT supplied subckt model (OTA nodes weren't transcribing well). After a brief learning curve I had the circuit below working in LTSpice.

ADC board FDA Spice Model
The application notes from TI and ADI do a good job of walking through the gain calculation and input impedance.  The short summary of that is that the differential feedback network increases the input impedance of the Rg (R7) resistor.  By using 25 ohms, the final input impedance is close to (but not exact) 50 ohms and matched with the source.  We want the feedback in both paths to see a load impedance that is the same.  The combined impedance a the input or top leg is 25 (Rg) +50 (Rsrc) ohms so the resistor on the bottom path is set to 75 ohms.

The following is a spice AC Bode plot of the single ended input and output voltages.  The single ended input is less than 0dB as it is referenced to the source (pre source output impedance).  It is a little less than a 6dB drop so the input impedance of the amplifier is not exactly 50 ohms (which we knew from the calculations but close enough using standard resistor values).  The output is +11.5dB from the reference with the difference between input and output being 15.6dB.
SPICE AC Gain. SEin=-4.5dB, SEout=11.6dB, Voltage gain=15.6dB w/ 8 degree phase variance across the span.
This simulation is a nice validation of the calculations and final circuit, however, it is still a little off from the measured values and does not include the LPF at the ADC.  The following model does that with the corresponding Bode plot of just Vout-se/Vin-se.
SPICE model with output LPF and ADC input model.
The ADC input model is not very sophisticated. I am not clear on how to properly model the sample and hold input while switching (here a simple parallel RC combination is used). The figure below captures the AC analysis. At 10.7MHz the gain is showing 15dB.
Magnitude and Phase of Vout-se/Vin-se with LPF and ADC model.
This is still a half dB off but well within my expectations and needs.