Sei sulla pagina 1di 7

C6713 Report Uday Kiran Thummalapalli

1. STEPS FOR BUILDING A PROJECT ON C6713DSK


1) Build a new project with the included C file.
2) Include the C6713dsk_init.c.
a. This file contains the necessary utilities to initialize the DSK kit. The function
DSK_init() initializes the kit i.e., the codec, serial ports, and I/O ports.
b. Inuput_sample() collect the data from the line-in or the microphone, based on the
Shift register 4 value (check config in C6713dsk_init.h), and stores the sample
from a AIC23_data.uint to Uint32 data type, a 32-bit integer.
c. The output_sample() takes the int data type and assigns the data to
AIC23_data.uint. McBSP writes this stream to the necessary ports for the
respective register values.
d. Comm_poll()
e. Comm_intr()
3) Add file C6713dsk.cmd to the project. A linker file is always necessary to send the files
from the compiler to the DSP processor to execute the code. This file helps in locating
the variables used in the project to the physical memory and allotting the sections. So, if
you define a new variable in the .asm file, then allot the variables to the memory or
sections they belong.
4) Add file Vectors_poll.asm or Vectors_intr.asm to the project, as required.
5) Include the library files:
a. rts6700.lib Runtime library
The run-time-support libraries contain the following supported by the C6000 compiler:
ISO C/C++ standard library
C I/O library
Low-level support functions that provide I/O to the host operating system
Intrinsic arithmetic routines
System startup routine, _c_int00
Functions and macros that allow C/C++ to access specific instructions.

b. dsk6713bsl.lib Board support library
The TMS320C6000_ DSK Board Support Library (BSL) is a set of application
programming interfaces (APIs) used to configure and control all on-board devices. It is
intended to make it easier for developers by eliminating much of the tedious grunt-work
usually needed to get algorithms up and running in a real system. Some of the advantages
offered by the BSL include: device ease of use, a level of compatibility between devices,
shortened development time, portability, some standardization, and hardware abstraction.
The programs use the AIC23 codec in the 6713 Board Support Library to generate a
response. AIC23 codec is the basic device of the C6713DSK for handling the input and
output signals. The values for the AIC23 control registers can be manipulated by the
different functions offered by the bsl header file. The BSL contains 5 modules:
Board Setup General Board initialization
1

Codec Access the AIC23 codec


DIP Switch Read DIP switches
LED Manipulate LEDs
Flash Program and erase Flash

c. csl6713.lib Chip Support library
The Chip Support Library (CSL) provides an application programming interface (API)
used for configuring and controlling the DSP on--chip peripherals for ease of use,
compatibility between various C6000 devices and hardware abstraction.

Please select Project >> Scan All File Dependencies.
This command will extract the necessary files which the all the project files are includeing.
Project >> Build Options >> Compiler
Basic: Target version = C671x (-mV 6710)
Preprocessor: Define Symbols = CHIP_6713
Feedback: Banners = Show Banners, Interlisting = Opt/C and ASM.
Project >> Build Options >> Linker
Uncheck Suppress Banner (-q)
Map Filename = (delete the entry)
Now, the project is ready for compiling. Select Project >> Rebuild All. This creates a .out file in
the Debug folder of the project. Load the program (File >> Load Program) to have the project
being executed. Now select Debug >> Run to execute the code.



C6713 Report Uday Kiran Thummalapalli

2. DESIGNING A FIR FILTER



A finite impulse response (FIR) filter is a type of a digital filter structure that can be used
to implement almost any sort of frequency response digitally. An FIR filter is usually
implemented by using a series of delays, multipliers, and adders to create the filter's output.


y(n) = b

- x (n -i)
N
=0



The filter design can be implemented with a set of coefficients known with the number of delays
sample. Open MATLAB and type sptool, which should cause startup.spt window to open as
shown below.

3


Click on New under the Filters menu to start a new filter design session. Enter the filter
characteristics that you want or as shown below.



The configuration shown here is a band pass FIR filter for respective pass and stop
frequencies. The order is changed to 80 to have a steep fall in the transition band also having low
ripple factor. Push Design Filter to build the required data structure which can be used in the
workspace later on.

Go back to sptool window, select File Export file, and export to workspace. Execute the
snippet below to have the coefficients in a comma separated value format (easy to paste in CCS
project).

coeffs = (filt1.tf.num)*(2^15);
csvwrite('coeffs.dat',coeffs);

4

Open the directory where MATLAB saves all the files and find coeffs.dat. Open the file with
Notepad and copy all the contents to clipboard. These coefficients are used in the file called
bs2700.cof in CCS environment.

Create a new project with fir.c as the file with the program as shown below.

//fir.c FIR filter. Include coefficient file with length N
#include "bs2700.cof" //coefficient file
#include "dsk6713_aic23.h" //codec-dsk support file
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
int yn = 0; //initialize filter's output
short dly[N]; //delay samples
interrupt void c_int11() //ISR
{
short i;
dly[0]=input_sample(); //input newest sample
yn = 0; //initialize filter's output
for (i = 0; i< N; i++)
yn += (h[i] * dly[i]); //y(n) += h(i)* x(n-i);
for (i = N-1; i > 0; i--) //starting @ end of buffer
dly[i] = dly[i-1]; //update delays with data move
output_sample(yn >> 15); //scale output filter sample
return;
}
void main()
{
comm_intr(); //init DSK, codec, McBSP
while(1); //infinite loop
}

//bs2700.cof FIR band pass coefficients designed with MATLAB
#define N 81 //number of coefficients
hort h[N]={268.53,3462.3,-881.55,-390.55,-
82.85
528.38
99.43,-592.86,-221.23,64.94,157.98,41.137,-215.18,-478.74,-
1.15,-528.38,-
xecuting the program gives the desired response of a band pass filter with pass band ~ (1.1 5
s
1 ,134.71,508.42,873.36,1138.8,1211.4,1059.8,702.95,229.99,-221.44,-
,-611.15,-478.74,-215.18,41.137,157.98,64.94,-221.23,-592.86,-899.43,-
1007.1,-864.62,-533.21,-173.64,8.8679,-148.41,-688.69,-1494.3,-2302.1,-2780,-
2634,-1723.5,-125.28,1861,3787.9,5183.7,5692.9,5183.7,3787.9,1861,-125.28,-
1723.5,-2634,-2780,-2302.1,-1494.3,-688.69,-148.41,8.8679,-173.64,-533.21,-
864.62,-1007.1,-8
61
221.44,229.99,702.95,1059.8,1211.4,1138.8,873.36,508.42,134.71,-182.85,-
390.55,-881.55,3462.3,268.53
};

E
KHz).
C6713 Report Uday Kiran Thummalapalli

3. TIME MULTIPLEXING OF LINE IN AND MICROPHONE



Code below can connect to ports of the AIC23 codec based on control register values.
The value for each cycle is toggled between MIC IN and LINE IN, where LINE IN is fed by 2
KHz Sine wave with 2 V amplitude. The .asm file toggles the value of the AIC23 control register
each time the interrupt in being executed. For each clock cycle, the input value for the
microphone and LINE IN are multiplexed. Image below illustrates the mechanism behind Time
division multiplexing (TDM).

Tmux.c file below has implements the logic behind the TDM.
//Tmux.c Interlaces the audio stream from MICROPHONE and LINE IN. Calls
function Tmux.asm

#include <stdio.h> //for print statement
#include "dsk6713_aic23.h" //support file
for codec,DSK
Uint32 fs=DSK6713_AIC23_FREQ_16KHZ; //set sampling rate
const short BUFFERLENGTH = 256; //size of output buffer
short buffer[256]; // buffer defined
int i = 0; //for buffer count
short flag = 0;

interrupt void c_int11() //interrupt service routine
{
flag = Timemux(flag); // Check the Flag and change the Control register 4
value
buffer[i] = input_sample(); //output sine values
output_sample(buffer[i]); //output to buffer
i++;
//increment buffer count
if(i==BUFFERLENGTH) i=0; //if @ bottom
reinit count

//printf("%d\n",flag);
6

return;
//return from interrupt
}

void main()
{
comm_intr(); //init DSK, codec,
McBSP
while(1); //infinite loop
}

A C-callable assembler linker file has been created which can toggle the register value with
respective to flag passed to it.
;Timemux.asm Assembly function called from C to interlace MICROPHONE and
LINE IN

.def _Timemux ;asm function called from C
_Timemux: NOT A4,A1
;SUB A1,1,A1 ;decrement loop count
[A1] MVK .S1 0x0011,A0 ;LINE IN Instead of A0 find the reister
value for AIC23 control resiter 4
[!A1] MVK .S1 0x0014,A0 ;MICROPHONE
MV A1,A4
B B3 ;return to calling routine
NOP 5 ;five NOPs for delay slots
.end

Executing the above program results an audio out with interlaced audio signal and MIC input
signal.

Potrebbero piacerti anche