Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lab 3 Part III Instructions

Similar presentations


Presentation on theme: "Lab 3 Part III Instructions"— Presentation transcript:

1 Lab 3 Part III Instructions
By Yeong Choo and Sam Kanawati The University of Texas at Austin, February 26, 2018

2 WinDSK Demonstration Connect your DSP board with the PC through the USB-UART. Run winDSK8 on the PC, and then follow the instruction on page 38 & in the real-time DSP book to run the “Notch Filter” applications. Tune the parameter “r” and see how it affects the attenuation around the center frequency.

3 IIR Filter Design in Matlab
Run fdatool in Matlab to design a bandpass IIR filter: Design method: Butterworth Order: 6 Sampling frequency: 48000Hz Passband: 5000Hz to 15000Hz Go to menu “Edit””Convert to Single Section”, then export the numerator and denominator coefficients into the workspace. Export the coefficients into the workspace with variable name “Num”. Set “..\appendix_e\MatlabExports” as the current folder of Matlab. You have the option of using addpath( ) in MATLAB to add appropriate path to directory of “..\MatlabExports” In the command window run >> IIR_dump2c('coeff’, 'B’ , filt1.tf.num ,'A’, filt1.tf.den , length(filt1.tf.den)) Please supply filter coefficients in lab report. Measure the magnitude response (dB) for the FIR filter that you just designed. You need to compute and tabulate the magnitude response for 1 kHz, 2 kHz … 24 kHz. You will need to measure the Vin from signal generator and Vout on the oscilloscope. Save these values in an Excel file. You will need to compare them with the experimental values later. Please tabulate and graph theoretical magnitude response.

4 DSK implementation using DF-I
Create a new project as before. After adding the files in “..\common_code_LCDK” folder except “vectors_EDMA.asm”, add “IIRmono_ISR.c” and “StartUp.c” in “code\chapter_04\ccs\IIRrevA”. Finally add the target configuration files as usual. Read and understand the code in “IIRmono_ISR.c” based on the explanation on page in the real-time DSP book. Once you have understood the code, you need to modify it based on following requirements: (1) Define N as 6 (2) Change the numerator (B) and denominator (A) coefficients based on what you get from MATLAB. The initialization of x and y need to be changed accordingly as N has been changed. (3) Delete the code between ‘x[0] = CodecDataIn.Channel[LEFT];’ and ‘CodecDataOut.Channel[LEFT] = y[0];’, then insert ‘iir_df_one();’. (4) Create the new function ‘iir_df_one()’ in “IIRmono_ISR.c” file to implement IIR filtering using direct form I. In this new function you need to compute the output value y[0] and also update all the state variables in x and y.

5 Experimental Magnitude Response Measurement - DF I implementation
Run the program with your own IIR function. Measure the experimental magnitude response and compare it with the theoretical one. Please tabulate and graph experimental magnitude response along with the theoretical magnitude response. Compare the number of clock cycles cost by ‘iir_df_one()’ with different optimization levels. Please provide four screenshots accompanying the measurement of clock cycles.

6 DSK implementation using SOS
Implement the IIR filter using SOS and measure the experimental magnitude response. To get the coefficients please go back to fdatool and choose “Edit””Convert to Second-Order Sections”. Export the variables. The SOS matrix should have 6 columns and 3 rows. Each row corresponds to set of coefficients for the respective biquad. The first 3 columns are the feedforward (numerator) coefficients and the last 3 columns are the feedback (denominator) coefficients. Here are some hints: 1. The code for variable declaration should look like: #define N 2 // IIR filter order #define M // number of biquad float B[M][N+1] = {{},{},{}}; // numerator coefficients float A[M][N+1] = {{},{},{}}; // denominator coefficients float G[M+1] = {}; // scale factors float x[M][N+1] = {{},{},{}}; // input value (buffered) float y[M][N+1] = {{},{},{}}; // output values (buffered) 2. The in function “Codec_ISR()” should look like: x[0][0] = CodecDataIn.Channel[LEFT]; // current input value for (i=0;i<M;i++){ biquad(i); // implement the i_th biquad } CodecDataOut.Channel[LEFT] = y[M-1][0]; // setup the LEFT value WriteCodecData(CodecDataOut.UINT); // send output data to port Note that in function ‘biquad(i)’ you need to compute the output using x[i][] and y[i][]; update the state variables; and then assign x[i+1][0]=y[i][0].

7 Experimental Magnitude Response Measurement - SOS implementation
Run the program; connect the board with the signal generator and the oscilloscope. Tune the frequency in the signal generator from 1 kHz to 24 kHz and record the experimental magnitude response. Please tabulate and graph experimental magnitude response and compare this with previous two graphs

8 Lab Assignment Please answer the following questions in lab report:
Number of taps before you run out of time for FIR filtering. Why use circular buffers? What happens if you do not multiply the scale factor in an IIR filter implementation using a cascade of second-order sections (SOS)? Advantages and disadvantages of FIR vs. IIR filters. Notes on Lab Report Submission: Please include all labs measurement, code changes and screenshots from Week 1 and Week 2. Please graph theoretical and measured magnitude response (FIR sample & frame-based and IIR) for direct comparison. Please supply ISR code change including generated filter coefficients. Please provide all required screenshots showing the number of clock cycles of code profiling. Please answer the above questions.


Download ppt "Lab 3 Part III Instructions"

Similar presentations


Ads by Google