Summary: The six-channel board for the TI EVM320C54 offers two channels of input and six channels of output at a sample rate of 44.1 kHz. It can also communicate with the PC via a serial port connection. The file thru6.asm exercises these inputs and outputs. The linker provides several sections of memory for storing program instructions and data. Test-vector input and output with vectcore.asm permits careful testing of DSP systems.
ARx registers and the accumulators) and
changing the PMST register to
0xFFE0. This sets the OVLY bit to
1, switching the internal RAM into the DSP's program memory
space.
thru6.out file, use Code
Composer's Reset DSP menu option to reset the
DSP, and run the code. Probe at the connections with the
function generator and the oscilloscope; inputs and outputs
are shown in Figure 1. Note that output
channels 1-3 come from input channel 1, and output channels
4-6 come from input channel 2. Figure 1 shows
the six-channel board's connector configuration.
![]() Figure 1: Six-Channel Board Analog Inputs and Outputs |
![]() Figure 2: Hardware Memory Map |
.word or .space directives
to inform the linker of all of your usage of data memory, you
will not accidentally try to reuse memory that has been used
to store code or other data. (Remember that
.word allocates one memory location and
initializes it to the value given as its
parameter. .space 16*<words> allocates
<words> words of uninitialized storage.)
Avoid using syntaxes like stm #2000h,AR3 to point
auxiliary registers to specific memory locations directly, as
you may accidentally overwrite important code or
data. Instead, use syntaxes like stm #hold,AR3,
where hold is a label for memory explicitly
declared by .word or .space
directives.
2000h-3FFFh,
4000h-5FFFFh, and
6000h-7FFFh) in the same cycle, a
one-cycle stall will occur while the second memory location is
accessed. Due to the pipeline, two memory accesses in the
same instruction execute in different cycles. However, if two
successive instructions access the same area of SARAM, a stall
can occur.
6000h to
7FFFh) is used for storing your program code; a
small amount of SARAM below 6000h is also used
for storing the DSP's stack. Part of the DARAM (from
0800h to 0FFFh) is used for the
input and output buffers and is also unavailable. Ensure that
any code you write does not use any of these reserved sections
of data memory. In addition, the core file reserves six
locations in scratch-pad RAM (060h to
065h); do not use these locations in your program
code.
.text directive to declare
program code, and the .data directive to declare
data. However, there are many more sections defined by the
linker control file. Note that the core file uses memory in
some of these sections.
.sect directive:
.text: (.sect ".text") SARAM
between 6000h and 7FFFh (8192
words)
.etext: (.sect ".etext")
External RAM between 8000h and
FEFFh (32,512 words) The test-vector version
of the DSP core stores the test vectors in the
.etext section.
.data: (.sect ".data") DARAM between
1000h and 1FFFh (4096 words)
.sdata: (.sect ".sdata") SARAM between
2000h and 5EFFh (16,128 words)
.ldata: (.sect ".ldata") DARAM between
0080h and 07FFh (1,920 words)
.scratch: (.sect ".scratch") Scratchpad RAM
between 0060h and 007Fh (32
words)
.edata: (.sect ".edata") External RAM between
8000h and FFFFh (32,768 words)
(Requires special initialization; if you need to use this
memory, load and run the thru6.asm
application before you load your application to initialize
the EVM properly.)
![]() Figure 3: Linker Memory Map and Section Names |
1 .copy "core.asm" 2 3 .sect ".text" 4 main 5 ; Your initialization goes here. 6 7 loop 8 ; Wait for a new block of 64 samples to come in 9 WAITDATA 10 11 ; BlockLen = the number of samples that come from WAITDATA (64) 12 stm #BlockLen-1, BRC ; Repeat BlockLen=64 times 13 rptb block-1 ; ...from here to the "block" label 14 15 ld *AR6,16, A ; Receive ch1 16 mar *+AR6(2) ; Rcv data is in every other word 17 ld *AR6,16, B ; Receive ch2 18 mar *+AR6(2) ; Rcv data is in every other word 19 20 ; Code to process samples goes here. 21 22 sth A, *AR7+ ; Store into output buffer, ch1 23 sth A, *AR7+ ; ch2 24 sth A, *AR7+ ; ch3 25 26 sth B, *AR7+ ; Store into output buffer, ch4 27 sth B, *AR7+ ; ch5 28 sth B, *AR7+ ; ch6 29 30 block 31 b loop
WAITDATA. WAITDATA waits for the
next block of 64 samples to arrive from the A/D. When it
returns, a pointer to the samples captured by the A/D is
returned in AR6 (which can also be referred to
as pINBUF); a pointer to the start of the
output buffer is returned in AR7 (also
pOUTBUF). Note that WAITDATA
simply calls the wait_fill subroutine in the
core file, which uses the B register
internally, along with the DP register and the
TC flag; therefore, do not expect the value of
B to be preserved across the
WAITDATA call.
BlockLen is set by the core code as the
length of a block; the repeat instruction therefore repeats
for every sample time. Lines 15-18 retrieve
one sample from each of the two channels; note that the
received data is placed in every other memory
location. Lines 22-24 place the first input
channel into the first three output channels, and
lines 26-28 place the second input channel into
the last three output channels. Figure 1 shows the relationship between the channel
numbers shown in the code and the inputs and outputs on the
six-channel board.
save_test_vector (available as save_test_vector.m):
>> save_test_vector('testvect.asm',ch1_in,ch2_in); % Save test vector
ch1_in and ch2_in are the
input test vectors for input channel 1 and input channel 2;
ch2_in can be omitted, in which case both
channels of the test-vector input will have the same data.)
core.asm) with two
lines. Instead of:
.copy "core.asm"
.copy "testvect.asm" .copy "vectcore.asm"
.copy directive is required. (Download
vectcore.asm into your work directory if you do not
already have a copy.)
.etext section of
program memory between 08000h and
0FEFFh. If you do not use this section, it will
not interfere with your program code or data. This memory
block is large enough to hold a test vector of up to 4,000
elements. Both channels of input, and all six channels of
output, are stored in each test vector element.
spin b
spin.
08000h in program memory. Do this by
choosing File->Data->Save... in Code Composer,
then entering the filename output.dat and
pressing Enter. Next, enter
0x8000 in the Address field of the dialog box
that appears,
read_vector function (available
as read_vector.m)
to read the saved test vector output into MATLAB. Do this
using the following MATLAB command:
>> [ch1, ch2, ch3, ch4, ch5, ch6] = read_vector('output.dat');
ch1 through ch6
now contain the output of your program code in response to
the input from the test vector.
Comments, questions, feedback, criticisms?