EE265 Lab 3: Filtering

Winter 2008-2009
Instructor: Teresa Meng


I. Purpose:

The purpose of this lab is to build the framework for real-time filtering. Additional modules in the DSP/BIOS for handling host-to-EVM communication will be introduced. We will go into detail on how to setup the DSP/BIOS and how to control the DSP program from the host computer. As lab exercises, you will implement the framework for filtering. We will look at the hardware implementation issues of digital filters. And you will apply what you learned from the lectures and use this to experiment with filtering theories you learned in the lecture.

II. Lab exercises:

As much as you think you know about filtering, there are always things you can learn by implementing them in real-time. In this lab, you will be playing with a variety of different filters and hearing the differences. This will also be the last lab where detailed procedure for working with the development tools will be given. From the next lab on, you are on your own in the sense of figuring out how to incorporate certain extended features of the DSP development tool into your code.

A. Host/EVM Control

A detailed procedure on how to setup a host/EVM control channel is provided in this section. This allows you to use a Visual Basic program to send control information to the EVM in real-time. As in Lab 1's FIR filtering demo, this control information allows the host computer to choose between several types of FIR filters to use for processing. This is convenient in that you can compare different types of filters without having to halt the DSP.

1. Configuring DSP/BIOS

 

Note: The PRD module uses the timer interrupt to update the period ticks. You can see this by expanding the CLK - Clock Manager module. It is a PRD_clock object, which calls the function PRD_F_tick every 1 ms.

Expand the SWI module. You will see that a new object, PRD_swi, is automatically added. The PRD_swi is the software interrupt handler that executes a specific PRD object when that object's timing condition is met. This software interrupt handles all PRD objects.

Click on the SWI module itself and look at the priority listings. (In order to see the listings, you may need to maximize your cdb-editor window and possibly select "Property/value view" from the right-click menu.) Note that the PRD_swi has priority 2 and audioSwi has priority 1.

 

 

#include <rtdx.h>
//extern Void _change_filter_asm(Void); /* Updates filter type */

This will be uncommented out later.

Uns filterType = 0;
RTDX_CreateInputChannel(control_channel);
Void change_filter(Void);
RTDX_enableInput(&control_channel);

A functional overview of RTDX is in the DSP/BIOS User's Guide under section 3.8. More information on the RTDX functions is available in the DSP/BIOS API Reference Guide under section 2.19.

Void change_filter()


{


    static Int control;





    /* Read new filter control when host sends it */ 


         


    if (!RTDX_channelBusy(&control_channel)) {


       RTDX_readNB(&control_channel, &control, sizeof(control));


        if ((control < 0) || (control > 4)) {


            control=0;


        } else {


            filterType = control;


            //change_filter_asm();


        }


    }          


}

What this function does is it checks to see if the RTDX control_channel is busy. The RTDX control_channel is busy if there is an outstanding request for the host to write control data onto the control channel and the host has not done so already. The inverse implies either that there is no control request from the EVM board and/or the control data has already been written onto the control channel. In the latter case, a new non-blocking control request can be made and the control channel can be checked for data.
The change_filter_asm(); function is something you will have to write to handle the filter type updates. At this point, it is commented out so the code template can be built to test the control channel.

2. Control via RTDX channel

As mentioned above, the filter type is controlled on the host side (your PC) via RTDX control channel. Thus, we need to have an appropriate control program on the host side; that is, a control application that sends the filter type you specify to the DSP so that change_filter function can set the proper filter type. You can find the already completed control function in the fir_tmpl.zip.
This is a visual basic program, and if you are interested in the programming of such an application, download
visual_basic.zip, which includes a brief guide to making visual basic RTDX control applications using MS visual studio, and the actual FIR_Control application project files for MS visual studio .net platform.
NOTE that there might be some differences on the development environment between old visual studio and visual studio .net. Also, it seems that there's a problem running visual basic executable developed by visual studio .net on network drive due to security issue. Hence, if you made your own version of FIR_con
trol, and it doesn't run from the network drive, then copy it to local drive and try it again.

3. Host-EVM Channel Test

That's all the Visual Basic you need to write. Now you will test the linkup between the host and the EVM board in this section.

B. Complete the Demo

You now have both the working DSP code and the host control program. You are to complete the demonstration that you saw in lab 1 where real-time audio signals are processed using different FIR filters.

1. Coding Specifications

The specifications of the FIR filters are given below:

2. MATLAB Verification

As in Lab 2, you will be expected to write a script to verify your code.  Here are the requirements.

3. What to Report

After you have simulated and verified that your FIR filter works, do the following measurements and report them in the write-up:

Execution cycles


Last modified: 10:00 pm 1/29/2008