Sei sulla pagina 1di 6

EEE8091 Implementation of Wireless Receiver Algorithms

Lab 3: Bandpass Filter Design

3 Lab 3: Bandpass Filter Design


3.1 Aim
To design and implement the front-end of the DPSK receiver in the ADSP 21061 SHARC DSP board.

3.2 Objectives
Design in Matlab a bandpass FIR lter that meets a given set of specications. Transfer the coefcients of the designed FIR lter from Matlab into a C-like structure format. Implement the ltering in the ADSP 21061 SHARC DSP board.

3.3 Background
The bandpass lter is required to remove out-of-band interference and noise before down-conversion.
rx_buf[buf_no][i] &

x0

x1

Figure 1: Front-end of the receiver structure.

3.4 Digital FIR Lowpass Filter Specications


Hbp (f ) Rp
Stopband Passband Stopband

Rs
0

fs1

fp1

fp2

fs2

Figure 2: Bandpass specications. 1 Lower passband cut-off frequency: fp1 = fc Rb 2 1 Upper passband cut-off frequency: fp2 = fc + Rb 2 3 Lower stopband cut-off frequency: fs1 = fc Rb 2 3 Upper stopband cut-off frequency: fs2 = fc + Rb 2
Dr. C. Tsimenidis University of Newcastle Upon Tyne School of Electrical, Electronic and Computer Engineering 1

EEE8091 Implementation of Wireless Receiver Algorithms

Lab 3: Bandpass Filter Design

Stopband attenuation Rs = 50 dB Passband ripple Rp = 0.1 dB where fc = 4800 Hz is the carrier frequency, Rb = 2400 bps is the data rate and fs = 48000 Hz is the sampling frequency.

3.5 Lab 3 Tasks


3.5.1 Filter Design in Matlab Start Matlab and type sptool on the command prompt.

Figure 3: Starting Matlab and SPTool. Select New Design to begin with a new lter design.

Figure 4: Create a new lter design.

Dr. C. Tsimenidis

University of Newcastle Upon Tyne School of Electrical, Electronic and Computer Engineering

EEE8091 Implementation of Wireless Receiver Algorithms

Lab 3: Bandpass Filter Design

Insert the FIR lter specications and complete the lter design by pressing Design Filter.

Figure 5: Inserting the FIR lter specications.

To access the lter coefcients of the designed lter go to the SPTool window and select Export from the File Menu. Next highlight the designed lter name and use the Export to Workspace button to make the lter parameters accessible on the workspace.

Figure 6: Exporting FIR lter variables to the Matlab workspace (step 1).

Dr. C. Tsimenidis

University of Newcastle Upon Tyne School of Electrical, Electronic and Computer Engineering

EEE8091 Implementation of Wireless Receiver Algorithms

Lab 3: Bandpass Filter Design

Figure 7: Exporting lter variables to the Matlab workspace (step 2). The lter parameters are stored under the variable name filt1 in an object-oriented manner. You can access the FIR lter coefcients as illustrated in Fig. 8. The custom Matlab function coef2c.m converts the lter coefcient vector h into a C-like structure format which is stored in the text le bp.h for subsequent use. The Matlab function coef2c.m is included in the project folder.

Figure 8: Converting the FIR lter coefcients to a C-like structure format.

Dr. C. Tsimenidis

University of Newcastle Upon Tyne School of Electrical, Electronic and Computer Engineering

EEE8091 Implementation of Wireless Receiver Algorithms

Lab 3: Bandpass Filter Design

3.5.2

C Implementation

FUNCTION FIR-Finite Impulse Response (FIR) Filter SYNOPSIS


#include <filters.h> float fir(float sample, \ float pm coeffs[], \ float dm state[], int taps);

DESCRIPTION This function is an Analog Devices extension to the ANSI standard. The fir() function implements a nite impulse response (FIR) lter dened by the coefcients and delay line that are supplied in the call of fir. The function produces the ltered response of its input data. This FIR lter is structured as a sum of products. The characteristics of the lter (passband, stop band, etc.) are dependent on the coefcient values and the number of taps supplied by the calling program. The oating-point input to the lter is sample. The integer taps indicates the length of the lter, which is also the length of the array coeffs. The coeffs array holds one FIR lter coefcient per element. The coefcients are stored in reverse order; for example, coeffs[0] holds the (taps-1) coefcient. The coeffs array is located in program memory data space to use the single-cycle dual memory fetch of the processor. The state array contains a pointer to the delay line as its rst element, followed by the delay line values. The length of the state array is therefore 1 greater than the number of taps. Each lter has its own state array, which should not be modied by the calling program, only by the fir function. The state array should be initialized to zeros before the fir function is called for the rst time. EXAMPLE The rst step required is to include the header filters.h. At the top of your C program, insert the following: #include <filters.h> For simplicity, it is constructive to dene the preprocessor variable N_bp:
#define N_bp 61

where 61 is the number of taps used in the lter design. Variable declarations required in the main():
float x0; /* Filter I/P */ float x1; /* Filter O/P */ int k;

Dr. C. Tsimenidis

University of Newcastle Upon Tyne School of Electrical, Electronic and Computer Engineering

EEE8091 Implementation of Wireless Receiver Algorithms

Lab 3: Bandpass Filter Design

Next, the lter variables need to be both declared and initialised. Make sure that the data le bp.h is in the working project directory.
float dm state_bp[N_bp+1]; float pm h_bp[N_bp] = { #include "bp.h" };

where dm and pm denotes data and program memory, respectively. Initialisation of the state_bp array to be inserted before the while(1) loop:
for (k=0; k < N_bp+1; k++) state_bp[k]=0;

Using the lter inside the for(;;) loop:


x1 = fir(x0, h_bp, state_bp, N_bp);

3.5.3

Bandpass Filter Optimisation and Testing

The number of taps of the bandpass lter should be optimised and its functionality tested with the signal generator. Apply in-band and out-of-band sinusoids and test the attenuation levels by using the DAC outputs and the PicoScope for displaying. Check the output of the generator with PicoScope before connecting any signal to the DSP board. The input signal amplitude to be used should be 1 V.

Dr. C. Tsimenidis

University of Newcastle Upon Tyne School of Electrical, Electronic and Computer Engineering

Potrebbero piacerti anche