Document Sample
dsplab8_overlap_fft Powered By Docstoc
                        LAB-WORK 8
In previous labs, you have implemented FFTs and energy calculation on overlapping buffers.
In this lab you are asked to perform FFT on a sliding (overlapping) window. This kind of
operations on sliding windows is a common application scheme which is good to be an expert
on it.

In this experiment, you will use 5 64-sample buffers to collect and 4 64-sample consecutive
buffers to perform FFT in a sliding way.

Create a new project with name dsplab8. Create a new config (cdb) file with name
dsplab8.cdb and add it and dsplab8cfg.cmd to the project. Add library files
(bsl6711dsk.lib, csl6711.lib and dsp6211.lib) into the project.

Adding Source Files
Create a new C files with name dsplab8.c and add it to the project. Write standard include and
initialization statements in the file.

       #include <c6x.h>             // C6000 compiler definitions header
       #include <c6x11dsk.h>        // C6000 DSK header

       #include <csl.h>       // CSL (Chip Support Library) headers
       #include <csl_irq.h>   // CSL Interrupt related routines
       #include <csl_mcbsp.h> // CSL Multi Channel B. Serial Port related

       #include <bsl.h>        // BSL headers
       #include <bsl_ad535.h> // Audio Codec
       #include <bsl_suggestions.h>

       #include <bitrev_cplx.h>             // bit reverse header
       #include <radix2.h>                  // Radix 2 FFT implementation

       void main()
             CSL_init();            // Initialize CSL library
             BSL_init();            // Initialize BSL library

              // .... the rest of the program

Now, you are ready to compile your code. Compile your project. If you obtain any warnings,
discard them for now.
Lab Work
In order to receive sample values, you need to modify the receive interrupt. Reroute to your
function Rx_ISR_fft().

Implement the buffer called

       #define BUF_SIZE    320
       char buffer[BUF_SIZE];

We will use 5 x 64 point quarters. While computing FFT on 4 buffers, sampling in the next
buffer is done. Buffer must be implemented as a circular buffer, ie. When we put the sample
buffer[BUF_SIZE-1], we go back to buffer[0] next time. You can use an integer
variable (in_ptr) to detect where to put the next sample. Integer division, in_ptr/64
yields the currently sampling quarter number.

You will need a TASK and a SEMAPHORE to realize the following scenario.

   1. The semaphore is used to trigger for crossing the end of quarter by the
   2. Task waits for the semaphore to be posted at the beginning of a . If posted, it
      calculates the FFT of the last 256 sample long buffer (4 quarters). And it goes back to
      the “waiting for the semaphore” state.

Make sure that, the calculation of FFT can be performed in 64 x sample_period.
(Measure how long does it take to perform signal energy calculation using the profiler).

After Lab
Make a record of how long it takes to calculate 256 sample FFT. How can you perform
Inverse FFT? Does it take the same amount of time with FFT?

Shared By: