<< Chapter < Page | Chapter >> Page > |
An interrupt from the CODEC occurs 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
$N$
inputs
buffer, and
BlockLen
of the output samples in the
outputs
buffer are written to the D/A output
via
Xmitptr
on channel 2. 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
$N$ samples to collect in the
inputs
buffer. Next, the
$N$ 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
$N$ samples to finish collecting.
The flow diagram in summarizes the operation of the interrupt handling routine
As the list of operations indicates, bit-reversal and FFT
computation are to be done in assembly. We are providingyou with a shell assembly file, available at
v:\ece320\54x\dspclib\c_fft_given.asm
and shown
in
Appendix B , containing many
useful declarations and some code. The code for performingbit-reversal and other declarations needed for the FFT
routine are also provided in this section.
However, we would like you to enter this code
manually, as you will be expected to understand itsoperation.
Now, we explain how to use the FFT routine provided by TI
for the C54x. The FFT routine
fft.asm
located
in
v:\ece320\54x\dsplib\
computes an in-place,
complex FFT. The length of the FFT is defined as a label
K_FFT_SIZE
and the algorithm assumes that the
input starts at data memory location
_fft_data
.
To have your code assemble for an
$N$ -point FFT, you will have to include the following
label definitions in your assembly code.
N .set 1024
K_FFT_SIZE .set N ; size of FFT
K_LOGN .set 10 ; number of stages (log_2(N))
In addition to defining these constants, you will have to
include twiddle-factor tables for the FFT. These tables
twiddle1 and
twiddle2 ) are available in the shared
directory
v:\ece320\54x\dsplib\
. Note that the
tables are each
$N$ points long representing values from 0 to just shy
of 180 degrees and must be accessed using a
circular pointer . To include these
tables at the proper location in memory with the appropriatelabels referenced by the FFT, use the following
Notification Switch
Would you like to follow the 'Ece 320 - spring 2003' conversation and receive update notifications?