home *** CD-ROM | disk | FTP | other *** search
/ Peanuts NeXT Software Archives / Peanuts-2.iso / Developer / hardware / dsp / drbub / board / note3 < prev    next >
Encoding:
Text File  |  1991-09-07  |  5.3 KB  |  152 lines

  1. Building a DSP board, Part Three: Designing the Analog Filters
  2. --------------------------------------------------------------
  3.  
  4. This is the third in a series on how I went about building
  5. a dual Motorola DSP56000 sampling board.
  6.  
  7. Before we design the filters, let's figure out why we need them
  8. in the first place.
  9.  
  10. At first, I wasn't going to use anti-aliasing filters, as I thought
  11. most of my sources would naturally be bandlimited to 22.05 kHz,
  12. anyway.  But, there's always the possibility of some stray video
  13. signals getting in there.  The biggest factor, however, was that
  14. the SM5805 required a clock that was 256 times the sampling rate.
  15. Since I was going to be using 88.2 kHz, that meant I needed a
  16. clock rate of 22.5792 MHz.  I couldn't find a crystal at this
  17. rate (I didn't look very hard - I'm sure they are available), so
  18. I decided to use the 20 MHz off the 56000.  20 MHz / 256 = 78125 Hz.
  19. This gives me an upper limit of 19531.25 Hz.  No big deal for me,
  20. since I'm trying to do Dolby Surround off of VHS Hi-Fi or LaserDisc
  21. and movie and TV audio rarely gets up that high.  But, that means
  22. I needed an input filter that starts cutting at about 19kHz.
  23.  
  24. The beauty of the double oversampling is that it allows me to move
  25. the 90dB point out to 0.75 * 78125 Hz = 58593.75 Hz, which is a heck
  26. of a lot easy to build in analog land than one that has a 90 dB
  27. point at 20kHz!
  28.  
  29. In my last post, I mentioned that you can use the same analog filter
  30. on the input as on the output.  Why is this?  Bear with me, as these
  31. graphs are difficult to draw in ASCII terminal land.
  32.  
  33. For the sake of argument, assume that your input signal contains
  34. every frequency imaginable:
  35.  
  36.     +----------------------------------------
  37.     |
  38.     |
  39.     |
  40.     +---------+---------+---------+---------+
  41.     0     0.5       1.0         1.5       2.0 *fs
  42.  
  43. fs in these examples is the sampling frequency AFTER decimation
  44.  
  45. We pass it through our analog LP filter to get
  46.  
  47.     +--------\
  48.     |      -----\     (draw a straight line before 0.5 to before 1.5)
  49.     |        ------\
  50.     |               ------\
  51.     +---------+---------+---------+---------+
  52.     0     0.5       1.0         1.5       2.0 *fs
  53.  
  54. Now we are bandlimited to 1.5*fs.  Now, we sample at 2*fs and get
  55. the typical digital frequency repetition:
  56.  
  57.     +--------\               /--------+
  58.     |      -----\     /-----
  59.     |        --/---\--
  60.     |       /------     ------\
  61.     +---------+---------+---------+---------+
  62.     0     0.5       1.0         1.5       2.0 *fs
  63.  
  64. Gosh, that looks terrible.  Can you make it out?  Basically, they overlap
  65. between 0.5 and 1.5 (i.e., aliasing).  Make those straight lines as in
  66. the previous example.
  67.  
  68. Now, we pass the above signal thru the killer digital filter:
  69.  
  70.     +-------\            /-------+
  71.     |     |               |
  72.     |     |               |
  73.     |      \              /
  74.     +---------+---------+---------+---------+
  75.     0     0.5       1.0         1.5       2.0 *fs
  76.  
  77. We've gotten rid of all of the aliasing noise.  Next, we decimate:
  78.  
  79.     +-------\   /-------+-------\    /-------+
  80.     |     | |             | |
  81.     |     | |             | |
  82.     |      X              X
  83.     +---------+---------+---------+---------+
  84.     0     0.5       1.0         1.5       2.0 *fs
  85.  
  86. So basically, the SM5805 allows us to build an analog filter with
  87. half the number of poles that we would need if we were to use
  88. no oversampling.  Quite a big win.
  89.  
  90. Now, do we need to make a whole new design for the output (reconstruction)
  91. filter?  No.  Here's why:
  92.  
  93. Let's start with our digital signal coming out of the 56000:
  94.  
  95.     +-------\   /-------+-------\    /-------+
  96.     |     | |             | |
  97.     |     | |             | |
  98.     |      X              X
  99.     +---------+---------+---------+---------+
  100.     0     0.5       1.0         1.5       2.0 *fs
  101.  
  102. Now, the SM5805 interpolates the signal for us:
  103.  
  104.     +-------\            /-------+
  105.     |     |               |
  106.     |     |               |
  107.     |      \              /
  108.     +---------+---------+---------+---------+
  109.     0     0.5       1.0         1.5       2.0 *fs
  110.  
  111. Note that we needn't filter the signal again, since it was already
  112. bandlimited.  Next, we pass this thru the *same* analog filter
  113. we used at the input.  Remember, its frequency response is:
  114.  
  115.     +--------\
  116.     |      -----\
  117.     |        ------\
  118.     |               ------\
  119.     +---------+---------+---------+---------+
  120.     0     0.5       1.0         1.5       2.0 *fs
  121.  
  122. Here's our final output:
  123.  
  124.     +-------\
  125.     |     |
  126.     |     |
  127.     |      \
  128.     +---------+---------+---------+---------+
  129.     0     0.5       1.0         1.5       2.0 *fs
  130.  
  131. Hopefully, you've been able to follow this (I know it's tough with these
  132. lame ASCII graphics).  I was going to post how to design the actual
  133. filter, but there are so many variations that I've decided to skip that
  134. for brevity.  However, I do have some programs that will figure out
  135. what pole/zero combinations you need for Butterworth, Chebychev, Inv-Cheb,
  136. and Eliptical filters.  Also, I have some for figuring out frequency
  137. response for various pole/zero combinations and a frequency domain version
  138. of SPICE that will figure out frequency responses for op-amp type filters.
  139. All of these programs were written for a class I took, and don't have
  140. much dox, but they are written in C and should run on any computer.
  141. They are available via my archive server.
  142.  
  143. Oh, BTW, I chose Chebychev because it has no ripple in the passband
  144. and takes half as many poles as the Butterworth.  Each complex pole
  145. pair can be done with one op-amp, so the fewer pairs, the better.
  146. However, we do have a phase problem.  My Chebychev design has a
  147. phase lag of 180 degrees at 20kHz.  The phase starts taking off
  148. at about 2kHz.  This is no big deal for me, as I am dealing with
  149. yucky movie and TV signals, but for those hi-fi nuts who buy
  150. expensive cable and interconnects, this is bloody murder...
  151.  
  152.