Sei sulla pagina 1di 6

ELL319 Digital Signal Processing

Lab Experiment 5:
Real-time filtering on the DSK

Prepared by

- Amit Verma
- Akhil Kajla
Procedure:

Part A:
 Designed low-pass IIR and FIR filters in Matlab by using the FDAtool in Matlab with
the following specifications: sampling frequency of 8 kHz, passband frequency of 2
kHz, transition band of 0.5 kHz, and stopband attenuation of 60 dB.

 Consider using an elliptic IIR filter and an equiripple FIR filter. Before exporting the
filter coefficients, use the option “set quantization parameters” in FDAtool to
quantize the filter coefficients to 16-bit fixed point arithmetic.

 Implement both filters on the DSK and verify that there is a reduction in noise levels.

Low-pass IIR filter designed using FDA tool


Quantizing the filter coefficients to fixed point

Part B:

-- Click on Project New CCS Project, name the project as fir_filter.

-- Configure the project as that of previous LAB1.

-- Click on the newly created project in Project Explorer Space, Open main.c, Select all and
clear main.c

-- Edit main.c as

#include "L138_LCDK_aic3106_init.h"
#define N 31
char index = 0;
float h[N] = {
-0.000035,-0.000234,-0.000454,0.000000,0.001933,0.004838,
0.005671,-0.000000,-0.013596,-0.028462,-0.029370,0.000000,0.064504,
0.148863,0.221349,0.0249983,0.221349,0.148863,0.064504,0.000000,
-0.029370,-0.028462,-0.013596,-0.000000,0.005671,0.004838,0.001933,
0.000000,-0.000454,-0.000234,-0.000035
};//FILTER CO-EFFICIENTS
float x[N]; // filter delay line
interrupt void interrupt4(void)
{
short i;
float yn = 0.0;
x[0] = (float)(input_left_sample()); // input from

for (i=0 ; i<N ; i++) // compute filter output


yn += h[i]*x[i];
for (i=(N-1) ; i>0 ; i--) // shift delay line
x[i] = x[i-1];
output_left_sample((uint16_t)(yn)); // output to DAC
return;
}
int main(void)
{
L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);

while(1);

-- Save main.c

-- Right Click on Project[fir_filter], select Add Files

-- Browse to C:/DSPLIB/support_files, select


L138_LCDK_aic3106_init.h L138_LCDK_aic3106_init.c linker_dsp.cmd vectors_intr.asm
-- Select Link to Files.

-- You should delete C6748.cmd, as you already have linker_dsp.cmd[C6748.cmd is added by


default when you create a new project].

-- Right Click on your Project Properties General, add run time support library as rts6740.lib

-- In project Properties go to C6000 Compiler Include Options, Add include search path

-- Browse for location-


C:/DSPLAB/board_support_lib/inc, click on OK C:/DSPLAB/support_files, click on OK

-- In the Project Properties go to C6000 Linker File Search Path, in Add File Path,
Browse C:/DSPLAB/board_support_lib/lib/evmomapl138_bsl.lib, click on open and finally
ok.

-- Exit Project Properties window by clicikng on OK, make sure you have selected rts6740.lib
as directed earlier.

Reset the LCDK board, Select your project, build it, debug it.
-- Connect audio source to LINE IN JACK(top) and speaker/headphone to LINE OUT
JACK(bottom).
-- Play audio available at DSPLAB folder in C:/DSPLAB/Test_signal, it has a 1kHz tone as noise
to voice signal and in Debug window, click on RESUME, the code will run and you can hear
filtered audio on the headphone side.

-- If you don’t hear anything, terminate the debug session, reset your hardware, Debug and
run once again.

-- The 1 kHz tone is removed from the signal, using FIR FILTER.

Conclusion
In this lab, we have designed, simulated and implemented an FIR filter. We have explored a
digital filter design tool and used it to generate coefficients for a digital filter running in real-
time on a DSP platform. We have also explored the C code used to run your filter, which was
implemented using a straight forward convolution.

Potrebbero piacerti anche