You are on page 1of 18

Real Time Signal Processing with DSPs

Session 2

Department of Electrical Engineering

Air University

Todays Agenda

Structure of Code Composer Studio Building a Project in CCS Some useful information on CCS

Structure of Code Composer The most important components of CCS are Studio

Editor Compiler Assembler Linker Debugger Config tool Analyze and Tune Tool

Simplified Code Composer Studio IDE Development Flow

Building a Project in CCS

When you build a project, CCS compiles your source code files written in C and generates corresponding ASM files. Then Assembler generates object files. Finally Linker generates a single executable file. During these operations, in addition to the source code files, CCS may require the following files.

Library Files (e.g. rts6700.lib) Header files (e.g. stdio.h) Interrupt vectors table file (vectors.asm) Linker command file (e.g. Lab1.CMD)

Requirements of a Project in CCS build operation essentially requires a linker A project


command file (.cmd). This file can be written manually and added to the project. Alternatively this file can be generated using a built-in config tool. This file normally specifies where are the various segments placed in memory. A project build may also require a interrupt vectors table file which tells the processor, when an interrupt at what memory address it should find the corresponding ISR (interrupt service routine). This file can be written manually as but this task can also be done by the config tool.

Requirements of a Project in .global _vectors CCS .global _c_int00 ;Reset Vector


.global _vector1 .global _vector2 .global _vector3 .global _vector4 .global _vector5 .global _vector6 .global _vector7 .global _vector8 .global _vector9 .global _vector10 .global _vector11 .global _vector12 .global _vector13 .global _c_int14 ; ISR for int14 .global _vector15 A portion of vectors.asm

/* Memory Map 0 - the default */ MEMORY { PMEM: o = 00000000h l = 00010000h BMEM: o = 00010000h l = 00030000h } SECTIONS { .text > PMEM .csldata > PMEM .stack > PMEM .far > PMEM .switch > BMEM

A portion of a .cmd file

Some useful information on You can CCS configure CCS to load the executable file

automatically after a successful build. Select Option:Customize menu item. Navigate to the Program/Project Load options tab and click Load Program After Build. Click OK.

Some useful information on For counters and index, do CCS


not use float or signed number types, otherwise you will waste your memory. Store output of a division operation in a float or double variable. If you store it in an integer variable, its fractional part will be lost. Multiplying two short variables will give a short variable in answer. If you like to have a 32-bit result, use type-casting.

Some useful information on Working with multiple projects CCS open multiple projects, only one of them will be active. If you

When you invoke the build operation, the active project will be compiled, linked, loaded and run.

Build Configurations

Primarily you have two build configurations available; DEBUG and RELEASE. DEBUG option allows you to debug your program from within CCS but it reduces speed and increases code size. RELEASE option eliminates any debug information from the generated code, increases speed and reduces code size.

Help on CCS

For online help select Help : Contents menu item and you will see a list of help material including User manuals, Tutorials, DSP knowledge base, etc. If you have access to internet, you can visit DSP knowledge base on TIs website. This knowledge base answers many of your problems regarding DSP, CCS, etc. In the knowledge base search window, enter your query and you will see a list of possible answers. If you dont find the solution of your problem, you may send an email to TI.

McBSP on C6713

Most of TI DSPs have built-in mult-channel buffered serial port (McBSP). It is similar to a computer serial port, with some additional features. In C6713, McBSP has two serial channels called McBSP0 and McBSP1. On DSK6713, McBSP1 is connected to a codec (coder-decoder). The codec has an Analog-to-Digital Coveter (ADC) and a Digitalto-Analog Converter (DAC). With this McBSP1 to codec connection, DSP can send/receive digital data to/from codec. In todays lab, we will use DAC portion of codec, therefore we will send digital data to codec.

Codec TLV320AIC23

This is a 16-bit audio codec that converts an analog signal to digital data and vice versa at sampling rates ranging from 8 kHz to 96 kHz. When used as a DAC, it receives a 16-bit digital sample from DSP thru McBSP1 and generates equivalent analog value. If the sampling rate is 8 kHz, it will receive 8000 digital samples per second and generate their equivalent analog values. In this case any two consecutive samples will be 125 us apart. After every 125 us, it generates an interrupt for DSP. In response the DSP sends next digital sample and so on.

Codec and McBSP interface


Function for generating digital samples of sine wave Digital samples

C6713
Codec

Analog

Hardware Interrupts

An interrupt generated by a hardware module may be termed as hardware interrupt (HWI). In CCS, for each HWI, an interrupt service routine (ISR) is defined. ISR is a function written in a source code file, which executes at the occurrence of the corresponding HWI.

Basics of C6000 Interrupts


16 interrupt sources (timers, serial ports, ) 12 interrupt events (INT4 to INT15) are available to user INT0 to INT3 are reserved Interrupt events must be mapped to interrupt sources Interrupt vectors must be set up. An interrupt vector is a special pointer to the start of the interrupt service routine (ISR). There are 12 interrupt vectors. Timer0 interrupt Timer1 interrupt McbSP0 interrupt . ......... DMA interrupt
Interrupt sources

1 2 3 16

INT4 INT5 INT6 . ..... INT15 Mapping


Interrupt events

DMA ISR Timer0 ISR .. .. ......... McBSP0 ISR


ISRs

Codec-McBSP Interface and Interrupt


McBSP1

Codec

ISR

Interrupt

Generating Sine with Codec


CPU Digital values McBSP Digital values Codec Analog Interrupt

Generating Sine with Codec


Digital value sent to codec must be 16-bit long. The 16-bit word can take values -32768 to 32767. Each value sent to codec converts into a voltage level in the range +Vmax and Vmax.

You might also like