LABORATORY 6: Implementation of Digital FIR and IIR filters on TMSC320C31 DSP Starter Kit EEE 182: DIGITAL SIGNAL PROCESSING LABORATORY Department of Electrical & Electronic Engineering College of Engineering & Computer Science California State University, Sacramento SPRING 2013 EEE 182 LABORATORY 6 Introduction The TMS320C31 DSK starter kit has the capability of real-time signal processing operations, the most important of which is digital filtering. Filtering is one of the most widely used application in Communication Engineering. Some of the practical applications of filtering are listed below: Demodulation of AM and FM signals: Low pass filtering is utilized to filter out the baseband audio or video signal from the carried modulated signal. Stereo generation: In stereo systems, the basic audio signal is separated into low frequency and high frequency components using filter banks, amplified, and then synthesized to generate the stereo signal Filtering of noise: Communications signals such as audio and video signals are corrupted with various sources of noise during propagation through the communication system. Filters are very useful in removal of noise from signals, if the approximate frequency spectrum of noise can be predicted. Digital Filter Implementation using the TMS320C31 DSK Real-time digital filters can be implemented in three steps: 1. Given a desired analog frequency response, Hd(j), convert to the corresponding digital frequency Hd(ej), using the transformation = T, where T (sec.) is the sampling interval. Note that T = 1/fs, where fs is the sampling frequency (Hz). The default sampling rate in the DSK is 10 KHz. 2. Obtain the desired Nth order FIR digital filter coefficients h(n), 0 n N using MATLAB. The various MATLAB commands for Digital Filter Design are given in the filter handout. Examples of commands are fir1, fir2, Remez in which the appropriate windowing function should also be specified. 3. Once the required filter coefficients, h(n), 0 n N, are obtained, these coefficients should be entered as data into the DSK assembly file, firall.asm, which is located in the directory C:\dsktools. The program firall.asm should be assembled using the command: >> dsk3a firall.asm The program firall.asm can now be run, and the designed digital filter will now be implemented. Setting up the DSP Starter Kit 1. Connect the DB25 cable from the parallel printer port of the DSK board to the IBM compatible PC. 2. Connect the power input of the DSK board to the 7.5-9 V DC adapter. The light on the LED should glow red. 3. Open the directory C:\dsktools on the PC and check if all the required software programs are loaded. 4. To invoke the debugger, type: C:\DSKTOOLS: DSK3D If the debugger is properly installed, the light on the LED will change colors from red to green. The DSK board is now ready for running real-time DSP experiments Experiment 1. Filtering of mixed sinusoidal signals of different frequency 1. Generate a mixed signal (using a BNC TEE junction) consisting of two sinusoidal signals of frequency 2 KHz and 4 KHz (Note that this step will require two HP 3324A signal generators). Verify the mixed output signal on both the oscilloscope and the spectrum analyzer. 2. Implement the DSK as a bandpass filter centered at 2 KHz, and a bandwidth of 0.2 Khz., using the three-step procedure outlined in the previous section. Implement using at least two of the methods given in the filter handout, such as fir1, fir2 and Remez. Verify the filtered output on both the oscilloscope and HP 35665A Dynamic Signal Analyzer. 3. Repeat the procedure in the section 2 above and implement a bandpass filter centered at 4 KHz, and a bandwidth of 0.2 KHz. Verify the filtered output on both the oscilloscope and HP 35665A Dynamic Signal Analyzer. Experiment 2. Filtering of sinusoidal signals mixed with random noise Communication systems face the common problem of noise. As shown in the figure below, the simplest form of noise is additive noise n(t), which adds on to the transmitted signal s(t). Several methods have been developed to tackle the problem of noise removal from the corrupted signal y(t) = s(t) + n(t). The commonly used methods include autocorrelation, and filtering. Signal s(t) + Noisy signal y(t) Noise n(t) 1. Generate a sinusoidal signal, s(t), ofn(tn amplitude 2 Volts , and frequency of 3 KHz, using the HP 3324A Signal Generator. Check the output of the generator on the oscilloscope HP (t) 35665A Dynamic Signal Analyzer. 2. Generate a random noise signal, n(t), using the HP 35665A Dynamic Signal Analyzer. Set the noise level at 0.05 volt rms. Check the output of the generator on the oscilloscope. 3. Combine the signal s(t), and the noise n(t), and check the noisy output on the oscilloscope and HP 35665A Dynamic Signal Analyzer. In this experiment, two types of noise-removal filters will be designed, and tested. Digital bandpass filter Design a digital bandpass filter with a center frequency of 3 KHz, and suitable bandwidth to filter out the sinusoidal signal s(t) from the noisy signal y(t). Implement the bandpass filter on the DSK (using the procedure outlined in previous section), and verify the output of the filter. Digital lowpass filter Design a digital lowpass filter with cutoff frequency of 4 KHz, to filter out the sinusoidal signal s(t) from the noisy signal y(t). Implement the lowpass filter on the DSK (using the procedure outlined in the previous section), and verify the output of the filter. 4. Repeat experiment 2 for a noise level of 0.1 volt rms, and the same signal level of 2 Volts.