EE 451
Lab 7: Spectrum Analyzer using the DSP 56002


Part 1: Reading in the Data

For the next two labs, we will make the 56002 act as a spectrum analyzer. That is, we will find an approximation of the energy density spectrum of an input signal x(n):

Sxx(w) = |X(w)|2

The approximation we will use for X(w) is the Discrete Fourier Transform (DFT). We won't discuss the DFT or how to calculate it until later in the semester, but numerous well-coded DFT routines exist, and we will use one of them.

What we need to do is to read in a block of data from the A/D converter (say, 1024 samples), calculate its DFT, find the squared magnitude, and write this out to the D/A converter. It takes time to calculate the DFT, so while we're calculating the DFT, we want to make sure we continue reading data in through interrupts. Thus, we need several buffers -- space to read data into, space to store the data we want to write out, and space to do the calculations. Next weeks lab will be concerned with the actual calculation of Sxx(w). This week, we will write a program which will properly manage the buffers. This will give you a good deal of experience with the address pointers of the 56002.

In this lab, we will deal with two buffers. Let's call one the write/read buffer and the other the calculation buffer. We assume that the write/read buffer has Sxx(w) in it. When new data comes in we need to write out Sxx(w), then x(n) into that now-available space. All of this needs to be done via interrupts so we can (next week) calculate Sxx(w) while the I/O is taking place. After 1024 new samples have been read in, we will switch the write/read and calculation buffers, and write out the newly calculated Sxx(w). Use address pointer r2 to keep track of the current location in the 2 Kword buffer. All the other pointers will be used by the DFT routine.

This lab will be concerned with learning about address pointers on the 56002, and about how to fill the buffers properly in the interrupt service routines.

  1. Write an interrupt service routine to replace the existing ssi_rx_isr (in the file txrx_isr.asm) which will, when it gets a Receive Data Interrupt, do the following if this is a new frame:

  2. In the main program, you should do the following:

  3. Replace the sample-processing loop with the following: Next week you will replace the do-nothing loops with the calculations to determine

    Here is an example of how you could do it in C:

             while (TRUE)
             {
                 if (r2 == BUF1)
                 {
                    bring_tio_high();
                    process_BUF2();
                    bring_tio_low();
                 }
                 else if (r2 == BUF2)
                 {
                    bring_tio_high();
                    process_BUF1();
                    bring_tio_low();
                 }
             }
    
    Sxx
    .

When done with today's lab, your DSP's left channel should be the same as the input signal, your DSP's right channel should be the input signal delayed by 2048 samples, and your TIO pin should send out a pulse every 1024 samples. Verify this using a function generator and oscilloscope.



Bill Rison, <rison@ee.nmt.edu >
Wed Oct 30 1996
Copyright © 1996, New Mexico Tech