DSP Board FIR Filter |
||||||
Table of Contents
Project DescriptionThe 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 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:
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 boards features include:
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 DesignAn 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:
Implementation in AssemblyProgramming 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.
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:
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 FilterThe 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.
|
||||||