<< Chapter < Page | Chapter >> Page > |
At the heart of the hardware interaction is the auto-buffering
serial port. In the auto-buffering serial mode, the TI-C54xprocessor is able to do processing
uninterrupted while samples are
transferred to/from a buffer of length
samples. However, the spectrum analyzer to be
implemented in this lab works over a block of
samples. If it were possible to compute a
1024-point FFT in the sample time of one
BlockLen
, then no additional interrupt handling
routines would be necessary. Samples could be collected ina 1024-length buffer and a 1024-point FFT could be computed
uninterrupted while the auto-buffering buffer fills.Unfortunately, the DSP is not fast enough to accomplish this
task.
We now provide an explanation of the shell C program
lab4main.c
listed in
Appendix A . The
lab4main.c
file contains the function
interrupt void irq
and a main program. The
main program is an infinite loop over blocks of
samples. Note that while the DSP is executing
instructions in this loop, interrupts occur every
BlockLen
samples. Inside the infinite loop,
you will insert code to do the operations whichfollow. Although each of these operations may be performed
in C or assembly, we suggest you follow the guidelinessuggested.
The function WaitAudio is an assembly function in the core code
which handles the CODEC interrupts. An interrupt from the CODECoccurs every
BlockLen
samples. The
SetAudioInterrupt(irq)
call in the main program
tells the core code to jump to the
irq
function
when an interrupt occurs. In the
irq
function,
BlockLen
samples of the A/D input in
Rcvptr
(channel 1) are written to a length
inputs
buffer, and
BlockLen
of the output samples in the
outputs
buffer are written to the D/A output
via
Xmitptr
on channel 2. In C, pointers may be
used as array names so that
Xmitptr[0]
is the
first word pointed to by
Xmitptr
. As in the
assembly core, the input samples are not inconsecutive order. The right and left inputs are offset from
Rcvptr
respectively by
and
,
, …,
.
The six output channels are accessed consecutively as offsetsfrom
Xmitptr
. On channel 1 of the
output, the input is echoed out.
You are to fill
the buffer
outputs
with the windowed
magnitude-squared FFT values by performing the operationslisted above.
In the main code, the
while(!input_full);
loop waits for
samples to collect in the
inputs
buffer. Next, the
inputs and outputs must be transferred. You are
to write this portion of code. This portion of code is tobe done first, within
BlockLen
sample times;
otherwise the first
BlockLen
of samples of
output would not be available on time. Once this loop isfinished, the lengthy processing of the FFT can continue.
During this processing, the DSP is interrupted every
BlockLen
samples to transfer samples. Once
this processing is over, the infinite loop returns to
while(!input_full);
to wait for
samples to finish collecting.
Notification Switch
Would you like to follow the 'Digital signal processing laboratory (ece 420)' conversation and receive update notifications?