With so many of the newest radios
coming out incorporating digital signal processing for demodulation
and filtering, I got the itch to play with one myself. By "play
with it," I don't mean just operating one; I wanted to be
able to try out my own software. I wanted to try out some of those
nifty signal processing ideas I teach about.
This article actually describes the second generation of this project. Ralph Stirling, KC3F, and I built the first generation using a Texas Instruments C5X DSK digital signal processing starter kit. Let it suffice to say that the second generation is a tremendous improvement over the first, because it uses a much more suitable DSP evaluation board from Motorola, the DSP56002EVM.
Why DSP?
You may wonder what the big deal
is. Why are so many of the latest radios coming with DSP demodulators
and filters? Digital techniques have several advantages. Probably
the most exciting is that everything is done in software. That
means when I design a new demodulator you can download it to your
radio and then you have my new demodulator. No soldering; no hunting
parts; no ugly modifications; it's so easy! Another benefit is
that results are predictable. Component tolerances are not a factor
as they are with analog signal processing. Simulations are easier
to do and their results more closely approximate what happens
in the actual system. Yet another advantage results from the speed
of today's DSPs. Nowadays it is quite realistic to have a digital
filter with the equivalent of hundreds of poles, a filter that
would require hundreds of inductors, capacitors or crystals in
the analog world. Few analog designers use more than ten poles
in a filter, because it's very difficult to make designs with
more work properly.
Some Background
This project actually started back in 1994. Ralph Stirling, KC3F,
and I did exactly what Rick Campbell, KK7B, suggested in his original article on the R2 receiver.
We used Rick's R2 receiver and the Texas Instruments C5X DSK digital
signal processing starter kit to construct a DSP based direct
conversion receiver. We modified the DSK with our custom daughter
board containing another TLC32040 codec. The DSP replaced the
analog phase shift network with its digital counterpart and a
sharp digital filter. We were able to obtain almost 50 db of opposite
sideband rejection. However, it wasn't quite ready to take home
and tune to 20 meters. The gain distribution needed adjustment.
About the time we got this far, Motorola came out with their DSP56002EVM evaluation
board. It made what we did with the TI board obsolete. The
Crystal
Semiconductor 16 bit stereo codec built into the Motorola
board was much better than the two TI 12 bit TLC32040 codecs.
The Motorola 56002 processor used 24 bits of precision and the
TI TMS320C5X used only 16. It was obvious that we needed to start
over. That start didn't come until I taught Communications Systems
during winter quarter of 1996. As a homework assignment I had
my students try the Motorola EVM in place of the TI DSK. It proved
simple to modify a filter program supplied by Motorola to do the
basic filtering necessary for SSB demodulation, and it worked
much better than the TI based receiver had. I spent many hours
during the summer improving on that design. This article describes
that improved system.
Implementation
We chose the R2 receiver not only because of its high dynamic
range and ready availability, but also for the image-reject down-converter
it uses. Its in-phase (I) and quadrature (Q) channels provide
all the signals needed to demodulate any type of modulation resulting
in a band-pass signal. These two signals are called the in-phase
modulation, x(t), and the quadrature modulation, y(t). See the
block diagram of the receiver in Figure (Generalized
Receiver). The demodulators described in this article are
for AM, DSB, CW, ISB and SSB, but because other modes need only
new software we can expect more modes to be available in the future.
The cost of this project is quite modest. The R2 board kit with circuit board and parts to populate it is available for about $109 from Kanga or just the circuit board for $20. I've seen the DSP board as low as $85 (when TAPR put together a group order). The list price is $150. If you plan to do any of your own programming of the DSP board, you will need an IBM PC compatible computer (386 or better) with at least two megabytes of memory, a 3.5 inch floppy disk drive, and a serial port capable of 19,200 baud. If such a PC is not available, you can purchase a pre programmed NVROM from Kanga.
The steep skirts of the digital filters are advantageous on SSB and CW. A simulation of the filter responses for those modes are shown in Figures (CW Response) and (SSB Response). This simulation does not include quantization effects of the A/D converter or the processor. A spectrum analyzer measurement of the digital filter response is also shown in Figures (CW Response) and (SSB Response). The shape factors were all less than 1.3:1.
At almost 50 db, the opposite sideband rejection is at least as good with the DSP demodulator as it was with the original analog demodulator. A simulation of the opposite sideband rejection for SSB and CW are shown in Figures (Sideband Rejection SSB) and (Sideband Rejection CW). The simulation assumes that all the analog electronics are perfect and that there is no quantization error. With these assumptions, the sideband rejection is much greater than the 50 db I measured. It is still very important that the components in the I and Q channels be matched carefully and that the local oscillator provides equal amplitude signals, 90 degrees out of phase. There is also a 0.5 db possible gain mismatch between channels on the codec. I made no effort to measure and eliminate this, but it would be very easy to do. The advantage for the DSP demodulator is that there are fewer components that must be matched. It might be worth the time and effort to match these more carefully.
Because of the analog filtering before the DSP, the IMD dynamic range is expected to be the same with digital demodulation as it was with analog demodulation. Measurement bears this out. The blocking dynamic range, on the other hand turns out to be about 13 db poorer with the digital demodulator than its analog counterpart. However, it is still quite respectable at 113 db. Perhaps it is reasonable to keep both demodulators, switching between them as necessary, especially since the analog one is already furnished on the R2 board.
Hardware Description
Hooking up the DSP demodulator is very simple. There is no hardware
needed beyond the R2 board, the Motorola DSP56002EVM, shielded
wire, a few connectors and optionally a switch or two and enclosures.
Basically, the analog audio phase-shift networks of the original R2 or mini-R2 are replaced by the DSP56002EVM. The codec used on the Motorola EVM has quite a range of adjustability for both the input and output signal levels. This adjustability was important because it made it possible to adjust the signal levels in software to match those the of the original R2 or mini-R2. (The mini-R2 and the R2 actually have different gain distributions and require separate settings of the output gain in the software.)
We can all appreciate Rick Campbell's foresight. He designed the printed circuit boards for both the R2 and mini-R2 receivers with pads for connectors at just the right places so that a sideband selector switch could be added. These pads connected to jumpers or switches in the original receivers. I used connectors which would allow connecting either jumpers or cables to the EVM. The EVM uses mini-stereo connectors for both audio input and output.
The present software utilizes one output
channel for lower sideband and the other for upper sideband, allowing
us to demodulate independent sideband (ISB) or stereo AM (C-QUAM).
Only one channel, however, is amplified beyond the EVM.
R2 Board Connections
First go get your copy of Rick's original article on the R2. I
will refer to in extensively in this section. On the R2 board,
disconnect the jumper wire from C10 to R20 and C21 and reconnect
it to the left audio channel in, on the DSP. Similarly, disconnect
the jumper from C20 to R35 and C26 and reconnect it to the right
audio channel in of the DSP. Both of these connections are marked
on Rick's R2 schematic with "Break connection here and insert
sideband selection switch (see text)". These two connections
put the in-phase modulation, x(t), and the quadrature modulation,
y(t), into the two analog input channels of the DSP56002EVM. See
Figure (Generalized
Receiver). The analog output of the EVM must also be hooked
back into the audio amplifier of the R2. To do this, disconnect
the jumper wire from the output of op-amp U5A, pin 1, to C25.
This connection is marked "Break here for SIDEBAND SELECT
Switch (See Fig. 5)" on Rick's R2 schematic. Depending on
which sideband you wish to demodulate connect the wire from C25
to either the right or left audio output from the DSP. (Which
sideband you actually get depends on your LO connections; if you
get the wrong one, either swap your LO connections or the wire
from C25 to the other channel.) All the other connections are
the same as they were for the R2 with the original analog demodulator.
I suggest enclosing the DSP and the R2 board in separate sub-enclosures and using shielded cable for all interconnections. I also strongly suggest being very careful about allowing any coupling between the output audio stage and the receiver input. These two parts of the circuit are fairly close together on the PC board. I noted that at high AF gain settings, oscillation would occur if the output wires to the speaker were routed too close to the input stage. I also found that additional 0.01 uF bypass capacitors in parallel with C9 and C19 and one between the positive terminals of C9 and C19 eliminated strange oscillations that occurred only at particular LO settings. With a little luck and these precautions in place, you should find no birdies anywhere with a 50 dummy load connected as the antenna. The LO I'm using on 40 meters is a common base circuit with a simple buffer and a simple phase splitter.
Mini-R2 Board Connections
You may find Rick's original article
on the Mini-R2 helpful when trying to understand these connections.
The jumpers for the input to the DSP board are found between U4
and U5 on the PC board. The jumper that went to pin 3 of U4 is
reconnected to one channel of the DSP audio in. The jumper that
went to pin 5 of U4 now goes to the other channel of the DSP audio
in.
Boot ROM
To make the receiver run stand-alone (so you don't have to use
a PC to load the software every time you turn the receiver on)
insert an ATMEL
AT29C256 non-volatile read only
memory (NVROM) into a socket soldered in the spot marked U10 on
the DSP evaluation board. It was nice of Motorola to provide this
luxury for us. This NVROM may be programmed on-board using software
available free on the internet. It is an accessory well worth
the small additional investment
Bandpass Filter
As Rick noted, the R2 board does
need a bandpass filter to eliminate strong out of band signals.
I found this to be true so I simply copied Rick's bandpass filter
in my 40 meter receiver.
Software Description
The software demodulates AM (mono or stereo), DSB, CW, ISB (independent-sideband)
and SSB. I picked SSB and CW because they are my favorite modes
on HF. I like to have an AM demodulator to listen to WWV and shortwave
broadcast stations. DSB can be demodulated with the same detector
as AM so it was a "freebie". Implementing ISB was also
easy and made changing sidebands easier. ISB doesn't seem to be
used much on the ham bands, but it could be used for transmitting
simultaneously a slow scan television picture on LSB while explaining
it on USB voice. These modes don't exploit all the advantages
of using a DSP as the demodulator, but they certainly illustrate
it. The advantages of the DSP demodulator really shine when demodulating
digital signals. Perhaps after reading this article you will get
busy and write some software for a digital mode.
Sampling Rate
Several different sampling rates between 8 KHz and 48 KHz were
tried. Sampling theory advises us to use a rate at least twice
as fast as the highest frequency component in the signal we are
processing. Faster sampling rates actually cut the quantization
noise a small amount, but they leave less time between samples
for processing the signal. I finally settled on an 8 KHz rate
because the filters I used to get good opposite sideband rejection
required more processing time. Another possibility with the Motorola
board is to setup the processor clock speed via software to 80
MHz. Motorola claims some of their boards will actually operate
at that speed. I decided that I would rather have this software
work on all EVM's so I didn't try 80 MHz. Another possibility
would be to use the new DSP56303EVM from Motorola. It's processor
is twice as fast as the 56002 and it uses the same codec.
AGC
In all modes, the software incorporates
22.5 db of automatic gain control (AGC). The AGC is different
than that of most receivers. You will not find it useful
to keep your eardrums in one piece. Its purpose is to keep the
signals to the A/D converters in range as long as possible. The
dynamic range of the A/D converter is greater then 80 db. Due
to the narrow filters preceding the A/D conversion I noticed no
AGC pumping from a signal 20 KHz off frequency until it was -10
dbm (more than 60 db over S9). At that level an oscillation at
about 1 Hz ensues.
Designing and debugging the AGC turned out to be one of the most challenging parts of this project. The codec has provisions to let the DSP know when an overload has occurred. It also provides a way of adjusting the gain on the fly by up to 22.5 db in 1.5 db increments. The gain is only changed when the signal passes through zero, eliminating "zipper noise" created by sudden gain changes at a high signal level. The AGC software checks for an overload condition. When it finds one, it lowers the gain. It doesn't check again until the codec has had time to clear the overload condition and change the gain. It has a fast attack of about 0.75 db/ms and slow decay of about 6 db/s. There is a noticeable, but unobjectionable, cycling effect when AGC is active due to the discrete gain steps of 1.5 db. This effect occurs only on the very loudest signals (above about -50 dbm (more than 20 db over S9)) and is really only noticeable on constant amplitude carriers.
Demodulation
The beauty in the generalized demodulation scheme (Generalized
Demodulator) is that it retains all the information present in
the modulation in the signals x(t) and y(t). We may demodulate
any narrowband modulation that will ever be in use with only software
changes . Actually, limitations of the DSP board may prevent this,
but I don't foresee that happening very often.
I chose to demodulate SSB, ISB, AM, DSB and CW, because they all use only linear operations in the DSP. Two channels of finite impulse response (FIR) filtering are employed for this. These are the I (in phase channel) and the Q (quadrature channel) filters. The input to the I channel filter is called the in-phase modulation, x(t), and the input to the Q channel filter is called the quadrature modulation, y(t). See Figure (Generalized Receiver). FIR filters were chosen for their simplicity. Any bandlimited linear operation may be approximated by selecting the proper FIR filter coefficients, h(m). The more coefficients used, the better the approximation. An FIR filter is really just a tapped delay line. The coefficients are the weights of each of the delayed signals that are all summed together at the output. See Figure (Tapped Delay FIR Filter). This made programming particularly easy; there is only one program, but there are eight sets of coefficients, two for each type of demodulation. To design your own custom frequency response, you need not understand the details of the program. All you need to understand are the basics of FIR filter design. If this interests you, see the sidebar or references on designing your own custom filter responses. After x(t) and y(t) are filtered, their sum yields the one sideband and their difference yields the other sideband. Each sideband is sent to its channel of D/A on the stereo codec. See Figure (Program Block Diagram).
MATLAB was a very useful tool for computing filter coefficients, plotting the corresponding frequency response curves and computing the opposite sideband rejection of the whole receiver assuming everything was perfect except the FIR filters. The only things I didn't simulate with MATLAB was the effect of quantization of the A/D and D/A converters, the finite word length of the DSP and the imperfections in the analog circuitry. I was grateful that most of the design could be so easily simulated. Simulation shortened the testing and debugging phase of the project by many many hours.
AM and DSB Demodulation
Exactly the same product detector demodulator is used for both
AM phone and DSB demodulation. A product detector AC coupled on
the output demodulates either AM or DSB modulation. Using a product
detector has the advantage of a heterodyne to zero beat. I find
this particularly handy, because it is easy to tune the signal
in exactly.
The in-phase (I) channel is simply passed straight through. The quadrature channel (Q) channel is unused. (Actually, its gain is set at zero so it won't affect anything when the output of the two channels are summed together.) See Figure (Block Diagram of Program). To accomplish this, the coefficients of the I filter were set to {1,0,0,0,0,....}, and the Q filter to {0,0,0,0,0,....}. These coefficients leave the analog filtering in the R2 and the anti-alias filter of the DSP to do all the filtering for AM and DSB demodulation. The bandwidth of the narrow analog elliptical filter in my R2 board was fine for listening to regular shortwave broadcast stations, however, in the future it would be interesting to try a Butterworth design having a larger bandwidth. With that, a faster sampling rate and the right coefficients, the DSP could tailor the frequency response.
It is interesting to note that the stereo AM signal can be demodulated using {1,0,0,0,0,....} coefficients for both I and Q filters. Motorola C-QUAM is the type of stereo modulation now in use. Previously independent sideband was used as well, but it has now been phased out. I assigned this as a homework for my communications students this year and it was the first time I'd ever listened to AM stereo and I was pretty impressed with the stereo sound. We found the zero beat feature of the product detector very handy in tuning AM stereo. If you don't have the station exactly zero beat, it sounds like the singer is moving from your left to right or vice versa over and over again.
CW, ISB and SSB
For CW, ISB and SSB the in-phase and quadrature channels' filters
have identical magnitude responses; the phase of the Q channel's
filter response is delayed by 90 degrees with respect to the I
channel. See Figure (Program Block
Diagram). The bandwidths of the band-pass filters are those
appropriate for the different modes (3 KHz for SSB, and 400 Hz
for CW). This scheme yields single signal reception.
The filter responses were created by defining the pass-band desired, then these were used to compute the coefficients. Finally the coefficients were tapered at the ends by multiplying them by a windowing function. The purpose of the window function is to sacrifice the steep skirts for a more uniform large attenuation in the stop-band. If the window function is omitted, sidelobes from the Gibbs phenomenon in the stop-band are relatively large. Several windowing functions were tried. I finally settled on a Kaiser window which has an adjustable parameter, ß, to control the trade-off between a steep transition region and lower sidelobe levels. You can use formulas given in the FIR Filter Design Sidebar to compute your own coefficients and to plot the resulting frequency response curves.
All the software, including the MATLAB code is available free on the internet.
Summary of Test Results
Table I provides a summary of the
measured specifications using the R2 DSP receiver with comparisons
to the original R2 with the analog demodulator. The mini-R2 should
give similar results. SSB was the mode for all measurements in
Table I. I used several old HP-606A signal generators for the
LO and as test signals because of they are virtually free of phase
noise. The dynamic range, both two tone IMD and blocking, were
measured at 20 kHz spacing. I used a Fluke 8910A true RMS voltmeter
to measure the output. The power splitter used for the dynamic
range tests was a Mini-Circuits PSC2-1. The LO phase shift network
used was a one pole cross over network.
SSB Receiver | R2 with DSP Demodulator | R2 with Analog Demodulator |
Minimum Discernable Signal | -116 dbm | -116 dbm |
Blocking Dynamic Range | 113 db | 126 db |
Third Order IMD Dynamic Range | 89 db | 90 db |
60-6 db Shape Factor | 1.1:1 | 1.6:1 |
Opposite Sideband Rejection | 40 - 50 db | 40 - 50 db |
Conclusions
I've enjoyed listening to Europe,
South America and the Pacific from my office using only a UHF
discone on the roof with this receiver. Download my software;
play with it! I'm looking forward to the day when I'll hear you
say "Hey Rob! Why don't you download my latest demodulator!
"
Acknowledgements
I would like to thank Ralph Stirling,
KC3F, who did the hardware portions of the first generation DSP
demodulator with the TI DSK, my Communications Systems students
for trying things out for me in their homework assignments and
for reading this manuscript, and Jim Forsyth, WA7CLI, for constructing
a respectable cabinet for the R2-DSP receiver.