lab session

53
Lab Session on Introduction to Code Composer Studio & DSP Applications with the TMS320C6713 DSK

Upload: shalin-doshi

Post on 29-Oct-2015

40 views

Category:

Documents


4 download

DESCRIPTION

Lab Session onIntroduction to Code Composer Studio&DSP Applications with the TMS320C6713 DSK

TRANSCRIPT

Page 1: Lab Session

Lab Session on

Introduction to Code Composer Studio

&DSP Applications with the TMS320C6713 DSK

Page 2: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 2

Outline of Laboratory

• Introduction to Code Composer Studio• Installation and setup of CCS• Laboratory

Familiar with DSK6713 starter kit Creating a project and developing a simple Program Building options. Run and Debug a Program. Data Visualization

17/02/2010

Page 3: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 3

DSK Kit Components

17/02/2010

Page 4: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 4

Overview

17/02/2010

Page 5: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 5

Overview

17/02/2010

Page 6: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 6

DSK Details

17/02/2010

Page 7: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 7

Overview

• It is intelligent IDE to offer DSP application development for multi processor, multi-user, multi-site projects.

• It provides complier, assembler and linker in order to generate output file for any input algorithm file. It also helps us to download and run algorithm on DSK.

• The development flow of most DSP-based applications consists of four basic phases: application design,code creation, debug, and analysis/tuning.

17/02/2010

Page 8: Lab Session

CCS Integrated DevelopmentEnvironment

Useful TI documentation (available online or on your hard drive):

SPRU509F.PDF CCS v3.1 IDE Getting Started Guide C6713DSK.HLP C6713 DSK specific help material

Note that your DSK includes CCS v3.1.

17/02/2010 8ISRO WS Prepared By Prof. Tanish Zaveri

Page 9: Lab Session

Code Composer Studio Toolbar

17/02/2010 9ISRO WS Prepared By Prof. Tanish Zaveri

Page 10: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 10

Overview

• 225 MHz TMS320C6713 floating point DSP• Advance VLIW architecture with 8 different functional Units (6 ALUs & 2 Multiplers)• Eight 32 bit instructions can be process simultaneously at every 4.44ns; In one second

8 x 2.25 x108 ≈ 1800 millian instructions can be process per second; It is useful in computationally intensive algorithm (MIPS)

• 16 bit TLV320AIC23 Analog Interface Circuit stereo codec (ADC and DAC) – Sigma delta technique with 12 Mhz clock – 8-96 kHz sample rates can be selected– Ideal for audio applications

• Memory– 16 MB dynamic RAM– 512 kB nonvolatile FLASH memory– General purpose I/O– 1.26 V for DSP core and 3.3 V for memory and peripherals– 32 bit Address Bus so 4 GB address

• 4 LEDs• 4 DIP switches• USB interface to PC

17/02/2010

Page 11: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 11

Is my DSK working?

• Power up DSK and watch LEDs• Power On Self Test (POST) program stored in FLASH

memory automatically executes• POST takes 10-15 seconds to complete• All DSK subsystems are automatically tested• During POST, a 1kHz sinusoid is output from the AIC23

codec for 1 second• Listen with headphones or watch on oscilloscope• If POST is successful, all four LEDs blink 3 times and

then remain on17/02/2010

Page 12: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 12

Is my DSK working? DSK Diagnostic Utility

17/02/2010

Page 13: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 13

Code Composer Studio IDE

• Connect power supply to DSK• Wait for POST to complete• Connect USB cable from PC to DSK

– If this is the first time connecting the DSK, you may be asked to install a driver. The driver is on the Code Composer Studio CD and will automatically be found by Windows if the CD is in the drive.

• Launch Code Composer Studio C6713 DSK• CCS will load and wait for your input17/02/2010

Page 14: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 14

CCS Integrated DevelopmentEnvironment

Useful TI documentation (available online or on your hard drive):

SPRU509F.PDF CCS v3.1 IDE Getting Started Guide C6713DSK.HLP C6713 DSK specific help material

Note that your DSK includes CCS v3.1.

17/02/2010

Page 15: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 15

Overview

17/02/2010

Page 16: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 16

Connecting to the C6713 DSK

17/02/2010

Page 17: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 17

Opening an Existing Project

Select a .PJT file and press “Open”. Chassaing example projects should be in c:\CCStudio_v3.1\myprojects\

Other example projects for the C6713 can be found in c:\CCStudio_v3.1\examples\dsk6713

17/02/2010

Page 18: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 18

Compiling/Building a Project

17/02/2010

Page 19: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 19

Loading and Running a Project on theC6713 DSK

17/02/2010

Page 20: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 20

Loading and Running a Project on theC6713 DSK

17/02/2010

Page 21: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 21

Halting a Running Program on theC6713 DSK

17/02/2010

Page 22: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 22

Build Options• Fixing the search path• Add C:\CCStudio_v3.1\C6000\

dsk6713\include to the search path

Project -> Build Options ->[Compiler tab] ->[Preprocessor category]

17/02/2010

Page 23: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 23

Build Options

17/02/2010

Page 24: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 24

Build Options

17/02/2010

Page 25: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 25

Build Options• Complier setting

– Basic Category – Target Version –mv6710– Advance Category – Memory Models to Far– Preprocessor Category – Predefine symbol CHIP_6713– Include search path

• Linker Settings– Give Library Search path and directory name– Give path to generate map and executable files

17/02/2010

Page 26: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 26

Debugging and Other Useful Featuresof the CCS IDE

• Breakpoints• Probe points• Watch variables• Plotting arrays of data• Animation• General Extension Language (GEL)

17/02/2010

Page 27: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 27

Build Options Suppress Linker Warnings

17/02/2010

Page 28: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 28

Breakpoints and Probe Points

17/02/2010

Page 29: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 29

Breakpoints

17/02/2010

Page 30: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 30

Watch Variables

17/02/2010

Page 31: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 31

Watch Variables

• In the Watch Locals tab, the debugger automatically displays the Name, Value, and Type of the variables that are local to the currently executing function.

• In the Watch tab, the debugger displays the Name, Value, and Type of the local and global variables and expressions that you specify.

• Can add/delete tabs.

17/02/2010

Page 32: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 32

Graph Windows: Plotting Arrays of Data

17/02/2010

Page 33: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 33

FIR Filter

17/02/2010

Page 34: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 34

Creating FIR Filters

17/02/2010

Page 35: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 35

Creating FIR Filters

17/02/2010

Page 36: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 36

Creating FIR Filters

17/02/2010

Page 37: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 37

Filter Realization Structure

17/02/2010

Page 38: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 38

Filter Realization Structure

17/02/2010

Page 39: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 39

Compute FIR Filter Coefficients

17/02/2010

Page 40: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 40

Compute FIR Filter Coefficients

17/02/2010

Page 41: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 41

More Interesting Programs

17/02/2010

Page 42: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 42

Example we would like to design

• Polls DIP switch 0. If pressed, light up all four LEDs.

• Sets the sampling rate of the AIC23 codec to 44.1kHz.

• Uses an ISR to sample the left and right channels.

• Multiplies the left and right channels by a variable gain.

• Outputs the modified samples to the left and right channels.

17/02/2010

Page 43: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 43

Directory Structure

1. myprojects: a folder supplied only for your projects. 2. bin: contains many utilities.3. docs: contains documentation and manuals.4. c6000\cgtools: contains code generation tools.5. c6000\RTDX: contains support files for real-time

data transfer.6. c6000\bios: contains support files for DSP/BIOS.7. examples: contains examples included with CCS.8. tutorial: contains additional examples supplied with

CCS.

17/02/2010

Page 44: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 44

Useful Types of Files

1. file.pjt: to create and build a project named file2. file.c: C source program3. file.asm: assembly source program created by the user, by the C

compiler, or by the linear optimizer4. file.sa: linear assembly source program. The linear optimizer uses file.sa

as input to produce an assembly program file.asm5. file.h: header support file6. file.lib: library file, such as the run-time support library file rts6700.lib7. file.cmd: linker command file that maps sections to memory8. file.obj: object file created by the assembler9. file.out: executable file created by the linker to be loaded and run on the

C6713 processor - .coff format 10. file.cdb: configuration file when using DSP/BIOS

17/02/2010

Page 45: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 45

SUPPORT FILES

1. C6713dskinit.c: contains functions to initialize the DSK, the codec, the serial ports, and for I/O. It is not included with CCS.

2. C6713dskinit.h: header file with function prototypes. Features such as those used to select the mic input in lieu of line input and gain

3. C6713dsk.cmd: sample linker command file. This generic file can be changed when using external memory in lieu of internal memory.

4. Vectors_intr.asm: a modified version of a vector file included with CCS to handle interrupts. Twelve interrupts, INT4 through INT15, are available, and INT11 is selected within this vector file. They are used for interrupt-driven programs.

5. Vectors_poll.asm: vector file for programs using polling.6. rts6700.lib,dsk6713bsl.lib,csl6713.lib: run-time, board, and chip

support library files, respectively. These files are included with CCS and are located in C6000\cgtools\lib, C6000\dsk6713\lib, and c6000\bios\lib, respectively.

17/02/2010

Page 46: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 46

SUPPORT FILES

1. DSP Bios : enable us to develop sophisticated application more quickly better than traditional approach

2. CSL File- It provides c program function to configure and control on chip peripherals– manages standard protocol for program peripherals– Basic resource management

3. BSL : Provides control on board devices and allowing developer to get algorithm functioning in a real system

rts6700.lib,dsk6713bsl.lib,csl6713.lib: run-time, board, and chip support library files, respectively. These files are included with CCS and are located in C6000\cgtools\lib, C6000\dsk6713\lib, and c6000\bios\lib, respectively.

17/02/2010

Page 47: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 47

Examples for Demonstration

• Example 1 Sine Generation Using Eight Points with DIP Switch Control. This example generates a sinusoid using a table lookup method.

17/02/2010

Page 48: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 48

Examples for Demonstration

• Within the function main, another function, comm_poll, is called that is located in the communication and initialization support file c6713dskinit.c. It initializes the DSK, the AIC23 codec onboard the DSK, and the two McBSPs on the C6713 processor. Within c6713dskinit.c, the function DSK6713_init initializes the BSL file, which must be called before the two subsequent BSL functions, DSK6713_LED_init and DSK6713_DIP_init, are invoked that initialize the four LEDs and the four dip switches.

• When dip switch #0 is pressed, LED #0 turns on and the sinusoid is generated. Otherwise, DSK6713_DIP_get(0) will be false (true if the switch is pressed) and LED #0 will be off.

• The function output_sample, located in the communication support file C6713dskinit.c, is called to output the first data value in the buffer or table sine_table[0] = 0. The loop index is incremented until the end of the table is reached, after which it is reinitialized to zero.

17/02/2010

Page 49: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 49

Creating Project

17/02/2010

Page 50: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 50

Examples for Demonstration

1. Press the up-arrow key to increase the gain value from 10 to 15, as displayed in the Slider window. Verify that the volume of the sine wave generated has increased.

2. Press the up-arrow key again to continue increasing the slider, incrementing by 5 up to 30. The amplitude of the sine wave should be about 2.5 V p-p with a gain value set at 30.

3. Change the sampling frequency from 8 to 16 kHz by setting fs in the C source program to DSK6713_AIC23_FREQ_16KHZ. Rebuild. The sampling frequencies supported by the AIC23 codec are 8, 16, 24, 32, 44.1, 48, and 96kHz.17/02/2010

Page 51: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 51

Example 2: Generation of the Sinusoid andPlotting with CCS (sine8_buf)

17/02/2010

Page 52: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 52

Sine Stereo File#include "dsk6713_aic23.h" //codec supportUint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate#define DSK6713_AIC23_INPUT_MIC 0x0015#define DSK6713_AIC23_INPUT_LINE 0x0011Uint16 inputsource=DSK6713_AIC23_INPUT_MIC; // select input

#define LEFT 0#define RIGHT 1union {Uint32 uint; short channel[2];} AIC23_data;

#define LOOPLENGTH 8 // size of look up tableshort sine_table_left[LOOPLENGTH]={0,7071,10000,7071,0,-7071,-10000,-7071}; // 3Khzshort sine_table_right[LOOPLENGTH]={0,-7071,10000,-7071,0,7071,-10000,7071}; //1khzshort loopindex = 0; // look up table index

interrupt void c_int11() //interrupt service routine {

AIC23_data.channel[RIGHT]=sine_table_right[loopindex]; //for right channel;AIC23_data.channel[LEFT]=sine_table_left[loopindex]; //for leftchannel;

output_sample(AIC23_data.uint); //output to both channels if (++loopindex >= LOOPLENGTH) loopindex = 0; // check for end of look up table return;}

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

17/02/2010

Page 53: Lab Session

ISRO WS Prepared By Prof. Tanish Zaveri 53

Examples for Demonstration

• Example 3: Loop with Data in a Buffer Printed to a File• Example 4: Loop Program with Input Data Stored in Memory• Example 5: Echo with Control for Different Effects

(echo_control) with MIC control• Example 6: Low Pass FIR Filter for three different frequencies• Example 8: Band Stop IIR Filter • Example 9: Adaptive Filter Design for noise cancellation• Example 10: Interfacing between Matlab and CCS using RTDX

(Real Time Data Exchange). It allows for data exchange between host PC and target DSK as well as analysis in real time without halting the target.

17/02/2010