[comp.dsp] Building a DSP board, Part Three: Designing the Analog Filters

todd@ivucsb.sba.ca.us (Todd Day) (09/27/89)

Building a DSP board, Part Three: Designing the Analog Filters
--------------------------------------------------------------

This is the third in a series on how I went about building
a dual Motorola DSP56000 sampling board.

Before we design the filters, let's figure out why we need them
in the first place.

At first, I wasn't going to use anti-aliasing filters, as I thought
most of my sources would naturally be bandlimited to 22.05 kHz,
anyway.  But, there's always the possibility of some stray video
signals getting in there.  The biggest factor, however, was that
the SM5805 required a clock that was 256 times the sampling rate.
Since I was going to be using 88.2 kHz, that meant I needed a
clock rate of 22.5792 MHz.  I couldn't find a crystal at this
rate (I didn't look very hard - I'm sure they are available), so
I decided to use the 20 MHz off the 56000.  20 MHz / 256 = 78125 Hz.
This gives me an upper limit of 19531.25 Hz.  No big deal for me,
since I'm trying to do Dolby Surround off of VHS Hi-Fi or LaserDisc
and movie and TV audio rarely gets up that high.  But, that means
I needed an input filter that starts cutting at about 19kHz.

The beauty of the double oversampling is that it allows me to move
the 90dB point out to 0.75 * 78125 Hz = 58593.75 Hz, which is a heck
of a lot easy to build in analog land than one that has a 90 dB
point at 20kHz!

In my last post, I mentioned that you can use the same analog filter
on the input as on the output.  Why is this?  Bear with me, as these
graphs are difficult to draw in ASCII terminal land.

For the sake of argument, assume that your input signal contains
every frequency imaginable:

	+----------------------------------------
	|
	|
	|
	+---------+---------+---------+---------+
	0	 0.5	   1.0	     1.5       2.0 *fs

fs in these examples is the sampling frequency AFTER decimation

We pass it through our analog LP filter to get

	+--------\
	|	  -----\     (draw a straight line before 0.5 to before 1.5)
	|		------\
	|		       ------\
	+---------+---------+---------+---------+
	0	 0.5	   1.0	     1.5       2.0 *fs

Now we are bandlimited to 1.5*fs.  Now, we sample at 2*fs and get
the typical digital frequency repetition:

	+--------\		       /--------+
	|	  -----\	 /-----
	|		--/---\--
	|	   /------     ------\
	+---------+---------+---------+---------+
	0	 0.5	   1.0	     1.5       2.0 *fs

Gosh, that looks terrible.  Can you make it out?  Basically, they overlap
between 0.5 and 1.5 (i.e., aliasing).  Make those straight lines as in
the previous example.

Now, we pass the above signal thru the killer digital filter:

	+-------\			/-------+
	|	 |		       |
	|	 |		       |
	|	  \		      /
	+---------+---------+---------+---------+
	0	 0.5	   1.0	     1.5       2.0 *fs

We've gotten rid of all of the aliasing noise.  Next, we decimate:

	+-------\   /-------+-------\	/-------+
	|	 | |		     | |
	|	 | |		     | |
	|	  X		      X
	+---------+---------+---------+---------+
	0	 0.5	   1.0	     1.5       2.0 *fs

So basically, the SM5805 allows us to build an analog filter with
half the number of poles that we would need if we were to use
no oversampling.  Quite a big win.

Now, do we need to make a whole new design for the output (reconstruction)
filter?  No.  Here's why:

Let's start with our digital signal coming out of the 56000:

	+-------\   /-------+-------\	/-------+
	|	 | |		     | |
	|	 | |		     | |
	|	  X		      X
	+---------+---------+---------+---------+
	0	 0.5	   1.0	     1.5       2.0 *fs

Now, the SM5805 interpolates the signal for us:

	+-------\			/-------+
	|	 |		       |
	|	 |		       |
	|	  \		      /
	+---------+---------+---------+---------+
	0	 0.5	   1.0	     1.5       2.0 *fs

Note that we needn't filter the signal again, since it was already
bandlimited.  Next, we pass this thru the *same* analog filter
we used at the input.  Remember, its frequency response is:

	+--------\
	|	  -----\
	|		------\
	|		       ------\
	+---------+---------+---------+---------+
	0	 0.5	   1.0	     1.5       2.0 *fs

Here's our final output:

	+-------\
	|	 |
	|	 |
	|	  \
	+---------+---------+---------+---------+
	0	 0.5	   1.0	     1.5       2.0 *fs

Hopefully, you've been able to follow this (I know it's tough with these
lame ASCII graphics).  I was going to post how to design the actual
filter, but there are so many variations that I've decided to skip that
for brevity.  However, I do have some programs that will figure out
what pole/zero combinations you need for Butterworth, Chebychev, Inv-Cheb,
and Eliptical filters.  Also, I have some for figuring out frequency
response for various pole/zero combinations and a frequency domain version
of SPICE that will figure out frequency responses for op-amp type filters.
All of these programs were written for a class I took, and don't have
much dox, but they are written in C and should run on any computer.
If you are interested, drop me a line.  If there is enough interest, I
will make them available on my archive server and will post them to this
group (they're not tooooo long).

-- 

Todd Day  |  todd@ivucsb.sba.ca.us  |  ivucsb!todd@anise.acc.com
"Ya know, some day these scientists are going to invent something
	that can outsmart a rabbit" -- Bugs Bunny