DSP Board FIR Filter


Table of Contents

  • Project Description
  • The DSP Board
  • Filter Design
  • Implementation in Assembly
  • Testing the Filter

Project Description

The goal of this project is to implement an FIR filter in real-time on an ADSP-21061 SHARC EZ-Kit Lite DSP Board. An analog signal is created with a function generator, sampled by the board's A/D converter, digitally filtered, and then converted back to an analog signal. The programming of the board, including the FIR algorithm, will be done in assembly. The FIR filter coefficients are determined in Matlab, using the Remez exchange algorithm, and then included in the assembly program. The code is then written and compiled on a PC and then downloaded to the EZ-Kit Lite over the RS-232 interface. Finally, the response of the filter is tested by applying white noise to the input and using a SR770 FFT spectrum analyzer to display the averaged spectral output.

The DSP Board

The following excerpt is taken from the May 1997 version of the ADSP-2106x SHARC EZ-Kit Lite Reference Manual.

"Your SHARC EZ-KIT Lite™ is one of the best values in development systems available today. Your small investment gives you everything you need to access [what was at one point] the most powerful floating point digital signal processor in the world! The Analog Devices ADSP-21061 processor used in the SHARC EZ-KIT Lite has many features integrated onto a single chip:

  • The industry’s fastest general-purpose 32-bit single-precision (or 40-bit extended precision) IEEE floating-point and 32-bit fixed-point DSP core with three independent, parallel computational units: ALU, multiplier, and shifter (40-MIPS, with 120 MFLOPS peak, 80 MFLOPS sustained)
  • On-chip, configurable memory banks: dual-ported 1-megabit internal SRAM for fast, independent local memory access for DSP core, DMA controller and I/O processor
  • Two 40 Mbit/s synchronous serial ports
  • A sophisticated DMA controller (6 simultaneous channels with zero impact on performance of DSP core)

The SHARC EZ-KIT Lite provides an easy way for you to investigate the power of the SHARC family of processors and develop your own applications based on these high-performance DSPs. It is a complete development system package with a price that makes it ideal for getting started in DSP. The SHARC EZ-KIT Lite was designed to help you accomplish these goals:

  • Evaluate Analog Devices’ floating-point DSPs
  • Learn about DSP applications
  • Develop DSP applications
  • Simulate and debug your application
  • Prototype new applications

The SHARC EZ-KIT Lite consists of a small ADSP-21061 based development / demonstration board with full 16-bit stereo audio I/O capabilities. The board’s features include:

  • Analog Devices ADSP-21061 DSP running at 40 MHz
  • Analog Devices AD1847 16-bit Stereo SoundPort® Codec
  • RS-232 interface
  • Socketed EPROM
  • User push-buttons
  • User programmable LEDs
  • Power supply regulation
  • Expansion connectors

The board can run standalone or can simply connect to the RS-232 port of your PC. A monitor program running on the DSP in conjunction with a host program running on the PC lets you interactively download programs as well as interrogate the ADSP-21061. The board comes with a socketed EPROM so that you can run the monitor program and demonstrations provided or you can plug in an EPROM containing you own code.

The SHARC EZ-KIT Lite also comes with all the software you need to develop sophisticated, high-performance DSP applications. A C compiler, assembler, run-time libraries and librarian, linker, PROM splitter utility, and simulator are all included.

You can also connect an optional EZ-ICE® In-Circuit Emulator to the SHARC EZ-KIT Lite. The emulator allows you to load programs, start and stop program execution, observe and alter registers and memory, and perform other debugging operations. The EZ-ICE emulator is available from Analog Devices and other third party resellers.

The ADSP-21061 SHARC EZ-KIT Lite was designed and manufactured by BittWare Research Systems, Inc., of Concord, NH to Analog Devices’ specifications."

Filter Design

An FIR filter can be designed using Matlab's Remez function. (The Remez function creates a filter with equiripple in the stop band.) the filter should pass low frequencies, while the transition band edges and filter order can be arbitrarily chosen. One possiblity for the filter design is shown below:

The characteristics are as follows:

  • Filter type
  • Filter order
  • Pass-band edge
  • Stop-band edge
FIR, Low Pass
15th
20% of Nyquist
40% of Nyquist

Implementation in Assembly

Programming the SHARC EZ-Kit Lite in assembly requires a solid understanding of the SHARC ADSP-21061 architecture and the various methods of I/O. In other words, you must know the hardware to write the software. The architecture file (ezkit.ach, located in C:\EZ-KIT\EZSHARC) is worth taking a look at. It describes the division of the memory into program and data segments with further subdivisions for the interupt vectors, etc. Listed below are a few good resources on the web that can help you gain a better understanding of the processor and the board.

  • DSP Lab 1 (pdf) - An introduction to the SHARC EZ-Kit Lite, this lab was written for an older version of the board, but is still informative.
  • DSP Lab 2 (pdf) - The second lab in the sequence; both labs written by Mitch Wilkes, a Professor of Electrical and Computer Engineering at Vanderbilt University, for a course called EECE 256: DSP Hardware, taught in the Spring of 1997
  • Digital Signal Processors - A general overview of DSPs. This is Chapter 28 from a book by Steven W. Smith called The Scientist and Engineer's Guide to Digital Signal Processing.
  • Getting Started with DSPs - An introduction to using the SHARC EZ-Kit Lite with a specific FIR filter example. Chapter 29 from the book mentioned above.

Looking for a template to work from, we find that most of the demonstration programs included in the EZ-Kit Lite package are written in C, and therefore are not very useful to us. To the best of my knowledge the only demo program written in assembly is the Peter Gunn Theme. That particular program contains three separate assembly files: init.asm, init1847.asm, and notes.asm.

A good portion of the assembly code for the FIR filter can be taken from Chapter 29, page 541, of the book by Smith (see the link above). However, there is some code that needs to be filled in, and there are a few small errors in his algorithm.

I was able to implement the FIR filter using the following files:

  • main.asm - The main file: gets a sample, filters, and outputs the sample.
  • init.asm - Sets up the interupt vectors.
  • init1847.asm - As the name implies, this file sets up the AD1847 Stero Codec.
  • lpf.dat - Contains the coefficients for the FIR low-pass filter (lpf).
  • make.bat - Batch file for compiling and linking the assembly files.

Downloading these files to the same directory and then running make.bat will result in a file called main.21k. This executable file can be downloaded to the board with the SHARC EZ-Kit Host program (Use File, Open to select main.21k). Note that the sampling rate is set to 48 kHz by default. This can be changed by modifying the data format register in init1847.asm (see the code's comments for details).

Testing the Filter

The filter was tested by applying white noise to the board's A/D converter. This noise was generated with the source module of an SR770 spectrum analyzer. The filter's D/A output was subsequently passed to the spectrum analyzer, and the FFT averaged over 600 frames. The plot below shows the ideal frequency response of the filter (top), generated with Matlab, and the measured frequency response (bottom). You can notice the effects of the anti-aliasing filter near 24 kHz, the Nyquist frequency.



Back to the Projects page