Professional Documents
Culture Documents
TMS320C6000 One-Day Workshop
TMS320C6000 One-Day Workshop
Texas Instruments reserves the right to update this Guide to reflect the most current product information for the spectrum of users. If
there are any differences between this Guide and a technical reference manual, references should always be made to the most current
reference manual. Information contained in this publication is believed to be accurate and reliable. However, responsibility is assumed
neither for its use nor any infringement of patents or rights of others that may result from its use. No license is granted by implication
or otherwise under any patent or patent right of Texas Instruments or others.
Workshop Requirements
Hardware
x Pentium 266 IBM PC or compatible (faster CPU recommended)
x 600 megabytes of hard-disk space
x Read/Write access to C:\ drive
x CD-ROM drive
x 64 megabytes of RAM (128MB suggested)
x SVGA (1024 x 768) display
x Working PC Sound card or portable audio player
Software
x Win98, WinNT4, Win2000 ONLY
x Microsoft Excel 97 (or later)
x Windows Media Player (or some other midi player)
x Netscape Navigator 3.0 or later; or Internet Explorer 3.0 or later
Other
x Speaker (to connect to DSK)
x Audio source (PC sound card, portable audio player, etc.)
x Stereo cables to connect to Speaker and Audio source
x Internet access (recommended, not required)
Revision History
October 1999 – Version 1.0
November 1999 – Version 1.1
November 2000 – Version 2.0
March 2001 – Version 2.1
September 2001 – Version 2.2
Copyright 1999, 2000, 2001 by Texas Instruments Incorporated. All rights reserved.
For more information on TI Semiconductor Products, please call the SC Product Information Center at
(972) 644-5580 or email them at sc-infomaster@ti.com.
Introduction
Objectives
x Be able to describe the basic architecture of the TMS320C6000
x Use Code Composer Studio (CCS) to build, debug, optimize C programs
x Use the resources of the ‘C6711 DSP Starter Kit (DSK)
x Use TI’s Software Foundation Libraries (Chip and Board Support Library) to utilize:
On-chip peripherals (McBSP, EDMA, Cache, Interrupts)
DSK resources (Codec, switches, LEDs)
x Use DSP/BIOS to build a multi-threaded system
x Use the DSP/BIOS Real-Time Analysis features
x Build an application visually
x Inspire you to use ‘C6000
Course Outline
Workshop Agenda
Overview Hello, TI DSP, ‘C6000
DSK Tour of ‘C6711 DSK
C Code Code Composer
System Algo, RT Events, Init
DSP/BIOS Real-Time Tools
Epilogue What Next?
Module Topics
Introduction ............................................................................................................................................... 1-1
Workshop Details
‘C6000 One-Day Workshop
Consumer Audio
Stereo A/D, D/A DSP: Automotive
PLL Technology Digital radio A/D/A
Mixers Enabler Active suspension
Voltage regulation
Multimedia
Stereo audio
Imaging
DTAD
Graphics palette
Speech synthesizer
Mixed-signal
Voltage regulation
processor
These and future applications have varying system requirements. That is, each of these systems
demands different priorities from DSPs. For example, while performance is important in a
portable MP3 player, more important would be efficiency of power dissipation and board space.
On the other hand, a cellular base station might require higher performance to maximize the
number of channels handled by each processor.
System Considerations
Performance
Interfacing
Power
Size
TI DSP Families
TI provides a variety of DSP families to handle the tradeoffs in system requirements.
‘C5x
Max Performance
C2000 with
(C20x/24x/28x) Efficiency Best Ease-
Ease-of-
of-Use
‘C1x ‘C2x Best MIPS per Multi Channel and
Watt / Dollar / Size Multi Function App's
Wireless phones Comm Infrastructure
Lowest Cost Internet audio players Wireless Base-
Base-stations
Control Systems Digital still cameras DSL
Motor Control Modems Imaging
Storage Telephony Multi-
Multi-media Servers
Digital Ctrl Systems VoIP Video
The TMS320C2000 (‘C2000) family of devices is well suited to lower cost, microcontroller-
oriented solutions. They are well suited to users who need a bit more performance than today’s
microcontrollers are able to provide, but still need the control-oriented peripherals and low cost.
The ‘C5000 family is the model of processor efficiency. While they boast incredible performance
numbers, they provide this with just as incredible low power dissipation. No wonder they are the
favorites in most wireless phones, internet audio, and digital camera (just to name a few) designs.
Rounding out the offerings, the ‘C6000 family provides the absolute maximum performance
offered in DSP. Couple this with its phenomenal C compiler and you have one fast, easy-to-
program DSP. When performance or time-to-market counts, this is the family to choose. It also
happens to be the family the course was designed around, thus, the rest of the workshop will
concentrate only on it.
TMS320C6000 Architecture
Goals of ‘C6000 Architecture
Conundrum: How to define Digital Signal Processing (DSP) in one slide.
In its simplest form, most DSP systems receive data from an ADC (analog to digital converter).
The data is processed by the Digital Signal Processor (also called DSP) and the results are then
transformed back to analog to be output. Digitizing the analog signal (by evaluating it to a
number on a periodic basis) and the subsequent numerical (a.k.a. digital) analysis provides a more
reliable and efficient means of manipulating the signal vs. performing the manipulation in the
analog domain. With the growing interest in multimedia, the demand for DSPs to process the
various media signals is growing exponentially.
x Y
ADC DSP DAC
While interest in DSP is constantly growing today, the DSProcessor grew out of TI over 20 years
ago in its educational products group, namely the Speak and Spell. These products demanded
speech synthesis and other traditional DSProcessing (like filters) but with quick time-to-market
constraints.
The heart of DSP algorithms hasn’t changed from the early days of TI DSP; they still rely on the
fundamental difference equation (shown above). Often this equation is referred to as a MAC
(multiply-accumulate) or SOP (sum-of-products). TI has concentrated for years on providing
solutions to MAC based algorithms. The wide variety of TI DSPs is a testament to this focus,
even with the widely varying system tradeoffs discussed earlier.
For the ‘C6000 to achieve its goal, TI wanted to provide record setting performance while coding
with the universal ANSI C language.
Ease of C Programming
Even using natural C, the ‘C6000 Architecture can
perform 2 to 4 MACs per cycle
Compiler generates 80-100% efficient code
TI ‘C6000 devices deliver 200 to 2400 MMACs of performance, where MMAC is mega-MAC or
millions of MACs. It's stellar performance, in any case. When this can be achieved using C code,
it's even better. While providing efficiency ratings for a compiler is difficult, TI has benchmarked
a large number of common DSP kernels to provide an example of the compiler’s efficiency:
As described in the graphic, please visit our website to see more results and to download the code
and try them yourself. (Note: this graphic also appears in the upcoming chapter on using C code.)
Also, even though the ‘C6000 boasts incredible MAC performance, many users have chosen it for
either its high processing rate, its compiler, or its comprehensive suite of tools.
Controller/Decoder
Controller/Decoder
The following example demonstrates the capability of the ‘C6000 architecture. Specifically, the
‘C6700 floating-point DSP can execute these eight instructions in parallel, allowing two single-
precision floating point MACs to be performed in just one processor cycle. Oh, and all that from
ordinary C code.
;** --------------------------------------------------*
.M1
.M1 .M2
.M2 LOOP: ; PIPED LOOP KERNEL
LDDW .D1 A4++,A7:A6
|| LDDW .D2 B4++,B7:B6
.L1 .L2 || MPYSP .M1X A6,B6,A5
.. .L1 .L2 .. || MPYSP .M2X A7,B7,B5
A15 B15 || ADDSP .L1 A5,A8,A8
.. .. || ADDSP .L2 B5,B8,B8
.S1
.S1 .S2
.S2 || [A1] B .S2 LOOP
A31 B31
|| [A1] SUB .S1 A1,1,A1
;** --------------------------------------------------*
Controller/Decoder
Controller/Decoder
Shown below is a breakout of the internal bus structure of the ‘C6201, the first device in the
‘C6000 family. As you can see, the ‘C6201 is able to perform five bus operations simultaneously:
program read, two data read/writes, one DMA read, and one DMA write. This bus architecture
provides flexibility required to achieve high throughput.
Because the ‘C6000 architecture is designed as a semi-custom ASIC built around the ‘C6000
custom CPU core, other family devices can conveniently contain additional buses. In fact, the bus
structure of the second device in the family – the ‘C6701 – has been modified to allow 64-bit data
loads. This allows the ‘C67x CPU to perform a single-cycle load of a double-precision floating
point operand.
‘C6711 Memory
The ‘C6711 memory map consists of three levels of access
x Separate Level 1 Program and Data caches
x Unified Level 2 memory – you can use this for data or program
x Level 3 consists of external memory (briefly discussed in the next topic)
‘C6711 Memory
0000_0000
4K 64KB Internal
Program
Cache
0180_0000
On-chip Peripherals
64K
CPU Prog / Data
(Level 2)
8000_0000
0 128MB External
9000_0000
4K 1 128MB External
Data A000_0000
Cache 2 128MB External
B000_0000
3 128MB External
cache logic
FFFF_FFFF
cache details
Note: Configuring the Level 2 cache memory is discussed further in Chapter 5, but your
instructor will not have time to cover the specific details of the ‘C6711 cache or the
internal memory descriptions of the other ‘C6000 devices. There just isn’t enough time.
Even though there isn’t time today to cover these details, we thought we’d pass along in your
notes a few extra specifics about the ‘C6711 internal memory and cache.
You might notice that the data paths are wider than expected. In fact, when a request from either
Level-1 cache is made to Level-2, two transfers actually take place. That is, sixteen instructions
or 32 bytes of data are transferred (rather than just one). This “look ahead” or “burst” feature
maximizes performance.
Along with the notes in the graphic, here are a few others:
x L1P: 4 Kbytes = 1K instructions; Line size is 512 bits = 16 instructions = 2 FP
x L2: Line size is 1024 bits = 4 FP (2x L1P line size) = 128 bytes (4x L1D line size)
x L2 can be configured 5 different ways. This is discussed in Chapter 5 of this workshop.
x Here is a diagram of the cache control logic:
Copy Data
No No
from
Is data in L1? Is data in L2?
External Mem
to L2
Yes Yes
‘C6000 Peripherals
High performance processing aside, DSPs exist within a larger system context. This CPU is
supported by its peripherals in supporting this larger context.
The ‘C6000 also contains several peripherals for communication with off-chip memory, co-
processors, and serial devices. The diagram below provides a quick overview of the ‘C6000
peripheral set:
'C6000 Peripherals
XB, PCI,
Host Port Internal
Memory
GPIO
Register Set A
Register Set B
DMA, EDMA .M1 .M2
(Boot)
.L1 .L2
Timers
VCP
.S1 .S2
TCP CPU
PLL
Utopia
x 50 MHz wide area network connectivity
x Use for ATM connection
x New to the ‘C64x devices
DMA: Offers four fully configurable channels (additional channel for the HPI), Event
synchronization, Split mode for use with McBSP, and Address/count reload
EDMA: Enhanced DMA (EDMA) offers 16 fully configurable channels (64 on ‘C64x
devices), Event synchronization, Channel linking, and Channel auto-initialization.
Timer / Counters
x Two (or three) 32-bit timer/counters
x Can generate interrupts/events
x Both input and output pins
PLL
On-chip PLL provides clock quadrupling. The ‘C6000 family can run at one or more times a
provided input clock. This reduces cost and electrical interference (EMI).
Device Clock Mode Pins PLL Rate
C6201
C6204
CLKMODE x1, x4
C6205
C6701
CLKMODE0
C6202 x1, x4, x6, x7,
CLKMODE1
C6203 x8, x9, x10, x11
CLKMODE2
C6211
C6711 CLKMODE x1, x4
C6712
C6414
CLKMODE0
C6415 x1, x6, x12
CLKMODE1
C6416
Power Down
x The ‘C6000 also supports power down modes to significantly reduce overall system
power.
For more detailed information on these peripherals, refer to the ‘C6000 Peripherals Guide.
‘C6000 Roadmap
The ‘C6000 family has grown considerably over the past three years. With the addition of the 2nd
generation of devices (‘C6400), performance has increased yet again.
C6000 Roadmap
Software Compatible
Floating
Floating Point
Point
Multi-core
Multi-core C64x™
C64x ™ DSP
DSP
1.1
1.1 GHz
GHz
Performance
2nd Generation
C64x™
C64x ™ DSP
DSP
General
Purpose C6414
C6414 C6415
C6415 C6416
C6416
t ce Media 3G Wireless
1st Generation es an Gateway Infrastructure
i gh orm
H rf
C6203 Pe
C6204 C62x™
C6202
C6201 C6205
C6211 C67x™
C6701 C6711 C6712
Time
Yet, the ease of design within the ‘C6000 architecture has not been abandoned with its growing
family of devices. Software compatibility is addressed by the architecture, rather than by the
hard-work of the programmer. With both the ‘C67x and ‘C64x devices being able to run ‘C62x
object code, upgrading DSPs is much easier.
Optional Topics
Due to the time constraints of a one-day workshop, your facilitator will not have time to cover
these additional topics. We have included them for your convenience in the unlikely case they
should be discussed.
x Y
ADC DSP DAC
40
Y = 6
i = 1
a i * xi
t
40
y = ¦ an * xn
Mult
.M
Mult
.M n = 1
The ’C6000
MPY .M a, x, prod
Designed to ALU
.L
handle DSP’s ALU
.L ADD .L y, prod, y
math-
math-intensive
calculations
Note:
You don’t have to
specify functional
units (.M or .L)
Register File A 40
a y = ¦ an * xn
.M
.M n = 1
x
16 registers
MPY .M a, x, prod
prod .L
.L ADD .L y, prod, y
y
..
.
32-bits
Register File A 40
a y = ¦ an * xn
.S
.S n = 1
x
MVK .S 40, cnt
cnt
16 registers
loop:
prod .M
.M MPY .M a, x, prod
y
ADD .L y, prod, y
.. .L SUB .L cnt, 1, cnt
.L
. B .S loop
32-bits
[condition] B loop
Register File A 40
a y = ¦ an * xn
.S
.S n = 1
x
MVK .S 40, cnt
cnt
loop:
prod .M
.M MPY .M a, x, prod
y
ADD .L y, prod, y
.. .L SUB .L cnt, 1, cnt
.L
. [cnt] B .S loop
32-bits
Register File A 40
a y = ¦ an * xn
.S
.S n = 1
x
MVK .S 40, cnt
cnt
loop:
16 registers
prod .M
.M LDH .D *ap ,a
y
LDH .D *xp ,x
*ap
.L
.L MPY .M a, x, prod
*xp
ADD .L y, prod, y
*yp
SUB .L cnt, 1, cnt
.D
.D [cnt] B .S loop
Data Memory:
x(40), a(40), y
How do we increment through the arrays?
Auto-Increment of Pointers
Register File A 40
a y = ¦ an * xn
.S
.S n = 1
x
MVK .S 40, cnt
cnt
loop:
16 registers
prod .M
.M LDH .D *ap++, a
y
LDH .D *xp++, x
*ap
.L
.L MPY .M a, x, prod
*xp
ADD .L y, prod, y
*yp
SUB .L cnt, 1, cnt
.D
.D [cnt] B .S loop
Data Memory:
x(40), a(40), y
How do we store results back to memory?
Register File A 40
a y = ¦ an * xn
.S
.S n = 1
x
MVK .S 40, cnt
cnt
loop:
prod .M
.M LDH .D *ap++, a
y
LDH .D *xp++, x
*ap
.L
.L MPY .M a, x, prod
*xp
ADD .L y, prod, y
*yp
SUB .L cnt, 1, cnt
.D
.D [cnt] B .S loop
STW .D y, *yp
Data Memory:
x(40), a(40), y
But wait - that’s only half the story...
Today’s Agenda
Agenda
Overview Hello, TI DSP, ‘C6000
DSK Tour of ‘C6711 DSK
C Code Code Composer Studio
System x McBSP, Interrupts
x EDMA, Cache
DSP/BIOS Real-Time Tools
VAB Visual Design
Epilogue What Next?
T HE WORLD LEADER IN DSP SOLUTIONS TI
Introduction
The ‘C6711 DSK provides a powerful, low-cost development environment. This chapter serves to
introduce its the main hardware and software components.
The lab at the end of this chapter asks you to hook-up your DSK and run the confidence test to
verify it’s working. We’ll get a chance to work with Code Composer Studio (CCS), the main
software package that ships with the DSK, during the next chapter.
Module Topics
'C6711 DSK Tour ...................................................................................................................................... 2-1
DSK Summary
The DSP Starter Kit provides a low-cost hardware development environment for the ‘C6000 DSP
family. Specifically, it contains the ‘C6711 processor. The following graphic provides all the
pertinent features of the DSK.
Software
Code Generation Tools
(C Compiler, Assembler & Linker)
Code Composer Debugger
(256K program limitation)
Example Programs & S/W Utilities
Power-on Self Test
Flash Utility Program
Board Confidence Test
Host access via DLL
Sample Program(s)
Along with this information, TI provides schematics and board layout information for the
hardware design.
DSK Hardware
Overview
Here’s a detailed look at the DSK board and it’s primary features:
Parallel
Port I/F
TMS320C6711 ‘C6711
DSP
Power
Jack D. Card I/F
(Periph Con.)
Power
LED User DIP
switches
The daughter card sockets included on the DSK are similar to those found on the other DSKs and
EVMs available from Texas Instruments. Thus, any work (by you or any 3rd Party) applied to
daughter card development can be reused with the DSK. If you’re interested in designing a
daughter card for the DSK/EVM, check the TI website for an application note which describes it
in detail.
Reset
Providing reset control for development boards is always challenging. Understanding the various
reset capabilities and issues will help to provide you an easy DSP development experience.
Absolute Reset
On rare occasions
you might have to: Reset Pushbutton Power On Self Test (POST)
Pull power jack Counts 1 - 7
Don’t push when CCS
Pull parallel port is running 4: }}z mic input o spkr out
5: z}z sinewave o spkr out
Does not force FULL
Don’t start CCS until end
Apply Power system reset
POST runs
(all 3 LEDs flash at the end)
To fully reset board, If switches are set to 0100, a fast
pull power plug version of POST is run
There are four or five reset methodologies for the ‘C6711 DSK. We’ll list each below; please
refer to the diagram above for additional caveats on the various DSK resets.
1. Power – Removing power from the board, then applying power forces the board to begin
operating from its reset state. The DSK Power-On Self-Test (POST) should run after
applying power to the board.
2. Absolute Reset – In rare cases, the power drawn from the parallel port may prevent a full
DSK reset, even if you have removed the power connector. Therefore, to absolutely force a
reset, remove all cable connections, then reconnect them to begin in from the DSKs reset
state. (POST should run.)
3. Reset Pushbutton – The DSK has a reset pushbutton that may or may not reset the whole
DSK board. By design, if Code Composer Studio (CCS) has been run, the reset pushbutton
will not reset the emulation logic which connects the parallel port to the JTAG test access
port on the DSP. This was designed to prevent CCS from crashing if the button was pushed
while CCS was running. Still, it is recommended that you close CCS before pushing the
reset button the board. While nothing will be damaged, CCS may not work properly after
the reset button has been pushed.
Occasionally, the codec may not be properly reset after pushing the reset button. If you are
using the codec, your best bet to assure reset is to remove and apply power.
Pushing the reset button may or may not cause the POST to run. If it runs, then the board can
be assured it has been fully reset. If not, then you may want to remove/reapply power to
verify the codec was properly reset.
4. Software DSK Reset – The DSK software installation provides an DOS batch file which
forces the emulation logic on the board to be reset. A shortcut to this can be found on the
Windows Start menu (and may also be on the Windows desktop). This software reset is
similar to that provided with TI’s full hardware emulation tools (XDS tools). This reset does
not cause the POST to run.
5. DSP Reset on the CCS Debug Menu –The DSP Reset menu selection within CCS is
intended to reset the DSP chip only. This is accomplished by sending a reset signal via the
emulation port on the DSP which forces it to reset and sets the program counter back to its
reset location (address 0).
The ‘C6711 bootloader cannot be disabled; therefore, the internal memory of the DSP is
overwritten from the DSKs FLASH memory whenever the device is reset. While convenient
for production usage, this presents a challenge to development board designers. In the case of
the DSK, TI provides a DSP RESET script (GEL script) that is run by CCS every time you
invoke DSP Reset. (You can view this script by viewing the contents of the dsk6xinit.gel file
that ships with the DSK.) Essentially, this script forces the DSP internal memory and EMIF
control registers to their reset states before actually sending the reset command to the DSP.
This assures that CCS is cognizant that the DSPs memory state has changed.
Note: The Restart command on the CCS Debug menu does not emulate a DSP device reset. The
only register that is modified by restart is the program counter (PCE1). The program
counter is loaded with the entry point specified by the code generation tools (-e linker
option, or default value which is usually _c_int00).
We suggest you refer to the DSK Help file for additional details.
Note: Don’t worry if it takes a few seconds to perform Test 2 (External SDRAM test). It can
take a while to test all the SDRAM memory included on the DSK. (Of course, if it takes
more than 15-30 seconds, then there might be a problem.)
Memory Map
The following memory map and table describe the memory resources designed into the ‘C6711
DSK.
Memory Maps
TMS320C6711 ‘C6711 DSK
0000_0000
16MB SDRAM
64KB Internal
(Program or Data)
FFFF_FFFF
The left map describes the resources available on the ‘C6711 DSP, the right map details how the
external memory resources were used on the DSK.
DSK Memory
Description Origin
MapLength
Internal RAM (L2) mem 0x00000000 0x00010000
EMIF control regs 0x01800000 0x00000024
Cache configuration reg 0x01840000 0x00000004
L2 base addr & count regs 0x01844000 0x00000020
L1 base addr & count regs 0x01844020 0x00000020
L2 flush & clean regs 0x01845000 0x00000008
CE0 mem attribute regs 0x01848200 0x00000010
CE1 mem attribute regs 0x01848240 0x00000010
CE2 mem attribute regs 0x01848280 0x00000010
CE3 mem attribute regs 0x018482c0 0x00000010
HPI control reg 0x01880000 0x00000004
McBSP0 regs 0x018c0000 0x00000028
McBSP1 regs 0x01900000 0x00000028
Timer0 regs 0x01940000 0x0000000c
Timer1 regs 0x01980000 0x0000000c
Interrupt selector regs 0x019c0000 0x0000000c
EDMA parameter RAM 0x01a00000 0x00000800
EDMA control regs 0x01a0ffe0 0x00000020
QDMA regs 0x02000000 0x00000014
QDMA pseudo-
pseudo-regs 0x02000020 0x00000014
McBSP0 data 0x30000000 0x04000000
McBSP1 data 0x34000000 0x04000000
CE0, SDRAM, 16 MBytes 0x80000000 0x01000000
CE1, 8-
8-bit ROM, 128 Kbytes 0x90000000 0x00020000
CE1, 8-
8-bit I/O port 0x90080000 0x00000004
CE2 - Daughtercard 0xA0000000 0x10000000
CE3 - Daughtercard 0xB0000000 0x10000000
Note: The Confidence Test may be run from either the PC host (former) or on the DSP within
CCS (latter). In the upcoming lab exercise, we will run it from the PC only.
PC Æ DSK Communications
CCS uses parallel port to control DSP via JTAG port
You can use full TI eXtended Dev System (XDS) via 14 pin
header connector
Communicate from Windows program (C++, VB) via parallel
port using Win32 DLL
JTAG
JTAG
Emulation
.......
....... Port
Note: You should not use the parallel port for simultaneous emulation and HPI connection.
2. The Win32 HPI mode (for lack of a better name) provides a second method to
control/observe the DSP. Using the Win32 API functions delivered as a DLL file with the
DSP, you can write a PC based program that can communicate with the DSP via its Host Port
Interface (HPI).
The Win32 HPI mode provides great flexibility for controlling the DSP. It is also an nice
example of an HPI interface. For other examples, please refer to the wide selection of
application notes on the TI website (http://www.dspvillage.com).
Note: The parallel port interface is designed to only support one mode at a time. If you are
using CCS via the parallel port connection, you should not talk to the DSP via the Win32
HPI mode.
If you connect CCS via an XDS emulation tool (by connecting it to the 14 pin header
connector), you are free to communicate to the HPI via the parallel port.
DSK Help
This file describes the board design, its schematics, and how the DSK utilities work.
DSK Help
Note: If the DSK fails the confidence test, first assure that you have properly connected all
wires and that none of them are loose.
If the wiring is OK, did the POST run when power was applied? Try unplugging and
plugging back in the power jack to test this again.
If you are still unable to proceed, please ask the facilitator for help.
Note, we used a batch file to run the confidence test. It can also be run directly by navigating
in Windows Explorer or DOS to c:\ti\c6000\dsk6x11\conftest\dsk6xtst.exe. Also, you can
chose the Confidence Test shortcut on the start menu (placed there during CCS installation)
or on the Windows desktop (placed there by installing the C6000 1-day Workshop lab files).
End of Exercise
Please inform your facilitator that you have finished. Thank You.
Introduction
The use of the C language has grown significantly over the past few years. TI has responded by
creating an architecture and compiler that yields such efficient processor code, that you may never
need to program in assembly. Thus, we shall begin discussing ‘C6000 coding with the C Compiler.
All it takes is a couple of minutes to get C code running on the 'C6000. That's the goal of this module.
First you'll compile a C dot-product routine, then learn how to debug and benchmark, as well.
Outline
Agenda
Overview Hello, TI DSP, ‘C6000
DSK Tour of ‘C6711 DSK
C Code Code Composer Studio
System x McBSP, Interrupts
x EDMA, Cache
DSP/BIOS Real-Time Tools
VAB Visual Design
Epilogue What Next?
T HE WORLD LEADER IN DSP SOLUTIONS
Linear
Assembly 95 - 100% Med
ASM Optimizer
As described in the introduction, C is –by far– the most popular method of programming the ‘C6000
family of devices. The ‘C6000 processor was designed with C code in mind. In fact, its architecture
was designed concurrently with its C compiler. This provided a rapid prototyping design environment
and afforded effective architectural decisions.
Unlike most real-time embedded DSPs, the efficiency of the C compiler, combined with the raw high-
performance of the ‘C6000, makes for an incredible combination. The goal? To achieve
supercomputing performance with maximum ease-of-use.
OK, so this sounds like marketing stuff (and it is), but it’s also true. C is the predominant language for
‘C6000 programming. The efficiency enumerated above has been demonstrated across a series of
DSP-centric benchmarks. In fact, in the first couple of lab exercises, we’ll see the performance in the
100% range.
As with all microprocessors, our machine instructions are translated into assembly mnemonic syntax.
While you may program in assembly language, it is done rarely. Rather, when you want to write
directly at the machine level, Linear Assembly is a better option. Linear assembly is a variation of
standard assembly. It provides access to the same mnemonic instructions but, since code passes
through an Assembly Optimizer tool, Linear Assembly provides three important benefits:
Instead of defining and specifying specific register usage, the Assembly Optimizer can provide
register assignment and optimization for you.
The tedious chore of setting up argument passing from subroutine to subroutine, or C function to
assembly subroutine is handled automatically for you.
The ‘C6000, like most RISC processors, provides a simple, fast instruction set. Likewise, it’s also a
pipelined processor that requires management of instruction latencies. With the Assembly Optimizer
you are freed from worrying about these issues. While the “rules” to follow are simple, we thought,
‘Why can’t we handle these issues for you?’.
Unfortunately, there is no time to discuss Linear Assembly and the Assembly Optimizer in the one-
day workshop. They are covered in greater detail in the four-day ‘C6000 workshop.
Standard SIM
3rd Party PLUG INS
Compiler
Runtime
Asm Opt Libraries
DSK
.out
Edit Asm Link Debug
EVM
DSP/BIOS DSP/BIOS
Config Third
Tool Libraries
Party
When TI developed Code Composer Studio, it added a number of capabilities to the environment.
First of all, the code generation tools (compiler, assembler, linker) were added so that you wouldn’t
have to purchase them separately. Secondly, the simulator was included (only in the full version of
CCS, though). Third, TI has included DSP/BIOS. DSP/BIOS is a real-time kernel consisting of three
main features: a real-time pre-emptive scheduler; real-time capture and analysis; and finally, real-time
I/O.
Finally, CCS has been built around an extensible software architecture which allows third parties to
build new functionality via plug-ins. See the TI website for a listing of 3rd parties already developing
for CCS. At some point in the future, this capability may be extended to all users. If you have an
interest, please voice your opinion by calling the TI SC Product Information Center (you can find their
phone number and email address in last module, “What Next?”).
Since it’s hard to evaluate a tool by looking at a simple screen capture, we’ll provide you with plenty
of hands-on-experience throughout today.
Essentially, within CCS you create a project for each executable program you wish to create. Projects
store all the information required to build the executable. For example, it lists things like: the source
files, the header files, the target system’s memory-map, and program build options.
What is a Project?
Project settings:
Build configurations
(compiler, asm options)
DSP/BIOS
Linking, etc …
The project information is stored in a .PJT file, which is created and maintained by CCS. To create a
new project, you need to select the Project:New… menu item.
Project Menu
Project Menu
Create new projects
Open projects
Manage projects
Along with the main Project menu, you can also manage open projects using the right-click
popup menu. Either of these menus allows you to Add Files… to a project. Of course, you can
also drag-n-drop files onto the project from Windows Explorer.
Right-Click Menu
Add files… to project
Add drag-n-drop files onto .PJT
Export Makefile
New Export project details
to a standard .mak file
Set as Active Project
New Keep multiple
projects open
Open for Editing
New Opens PJT with
text editor
Configurations…
New Keep multiple sets
of build options
Options…
Set build options
There are many other project management options. In the preceding graphic we’ve listed a few of
the most commonly used actions:
x If your project team builds code outside the CCS environment, you may find Export
Makefile (and/or Source Control) useful.
x CCS now allows you to keep multiple projects open simultaneously. Use the Set as
Active Project menu option or the project drop-down to choose which one is active.
x If you like digging below the surface, you’ll find that the .PJT file is simply an ASCII
text file. Open for Editing opens this file within the CCS text editor.
x Configurations… and Options… are covered in detail, next.
There are probably about a 100 options available for the compiler alone. Usually, this is a bit
intimidating to wade through. To that end, we’ve provided a condensed set of options. These few
options cover about 80% of most users needs.
Options Description
-mv6700 Generate ‘C67x code (‘C62x is default)
-mv6400 Generate 'C64x code
-fr <dir> Directory for object/ouput files
-q Quiet mode (display less info while compiling)
-g Enables src-level symbolic debugging
debug
-s Interlist C statements into assembly listing
-o3 Invoke optimizer (-o0, -o1, -o2/-o, -o3)
optimize -gp Enable function-level profiling
(release)
-k Keep asm files, but don't interlist
As you probably learned in college programming courses, you should probably follow a two-step
process when creating code:
x Write your code and debug its logical correctness (without optimization).
x Next, optimize your code and verify it still performs as expected.
As demonstrated above, certain options are ideal for debugging, but others work best to create
highly optimized code. When you create a new project, CCS creates two sets of build options –
called Configurations: one called Debug, the other Release (you might think of as Optimize).
Configurations will be explored in the next section.
Note: Like any compiler or toolset, learning the various options requires a bit of
experimentation, but it pays off in the tremendous performance gains that can be
achieved by the compiler.
The Release (optimized) configuration invokes the optimizer with –o3 and disables source-level,
symbolic debugging by omitting –g (which disables some optimizations to enable debug).
In many cases you might also want to add the –gp option to the Release configuration as this
makes it easier to evaluate the optimized performance. In the upcoming lab exercise, you will
build a new configuration (called Optimize) that adds –gp to the Release configuration.
Note: The examples shown here are for a C67x DSP, hence the –mv6700 option.
There is a one-to-one relationship between the items in the text box and the GUI check and drop-
down box selections. Once you have mastered the various options, you’ll probably find yourself
just typing in the options.
Here are a few more compiler option pages (the ones that contain options from the Debug
configuration):
Feedback page
Default is -q, which
suppresses some
tool feedback
Files page
Code gen tools create:
.obj
.out
.map
Preprocessor page
-d option allows symbols
to be defined
_DEBUG used by CCS
enviroment during debug
Linker Options
Options Description
-o<filename> Output file name
-m<filename> Map file name
-c Auto-initialize global/static C variables
-x Exhaustively read libs (resolve back ref's)
Like Compiler Options,
Build Configurations also
contain Linker Options
-q -c -o".\Debug\lab3.out" -x Default linker options are
shown for the Debug
configuration of a project
name lab3.pjt
".\Debug\" indicates one
subfolder level below
.\Debug\lab3.out project (.pjt) location
Linking discussed in
Run-time Autoinitialization detail during four-day
workshop
Due to time, the linker is not covered in greater detail. Please refer to the C6000 Assembly
Language Tools User’s Guide or attend the 4-day C6000 DSP Workshop.
TMS320C6000 One-Day Workshop - Using C on the 'C6000 3 - 13
Code Composer Projects
The Config Tool is used to create and edit a Configuration DataBase (.CDB) file. If we talk about
using CDB files, we’re also talking about using the Config Tool. The following figure shows a
CDB file opened within the configuration tool:
Configuration Tool
Simplifies
Simplifies system
system design
design
Automatically
Automatically includes the
includes the
appropriate
appropriate runtime
runtime support
support libraries
libraries
Automatically
Automatically handles
handles interrupt
interrupt
vectors
vectors and
and system
system reset
reset
MEM
MEM handles
handles system
system memory
memory
configuration
configuration (builds
(builds CMD
CMD file)
file)
Many
Many other capabilities will be
other capabilities will be
discussed
discussed later
later …
…
As the bullets in the figure state, the Config Tool simplifies embedded design by providing a GUI
interface to configure many system objects. It also automates many system requirements
(including libraries, building vector tables, etc.). For pure coding (and code optimization) the
Config Tool offers only a few features. These few features will be explored in this – and the next
few – chapters. Later in the workshop, we will examine some of its many other capabilities. To
explore its full capabilities, we suggest you attend the 4-day DSP/BIOS workshop. (We just don’t
have time to explore all of it in this workshop.)
When a CDB file is saved, the Config Tool creates a number of other files:
Filename.cdb Configuration Database
Filenamecfg_c.c C code created by Config Tool
Filenamecfg.s62 ASM code created by Config Tool
Filenamecfg.cmd Linker commands
Filenamecfg.h header file for *cfg_c.c
Filenamecfg.h62 header file for *cfg.s62
When you add a CDB file to your project, CCS automatically adds the .C and assembly (.S62)
files. To prevent confusion, these files are added to the Generated Files folder.
On the other hand, the CMD file must be added manually. In some systems, a user will create
their own CMD file and reference the config tool’s CMD file. Since a project may only contain a
single CMD file, the decision was made to make this a manual step for the user.
C Data Types
OK, so discussing data types isn’t a sexy topic. It is an important topic, though, if you’re interested in
achieving maximum performance.
Here are a few short rules to keep in mind regarding C data types:
1. Use short types for integer multiplication. As with most fixed-point DSPs, our ‘C62x devices use
a 16x16 integer multiplier. If you specify an int multiply, a software function in the runtime
support library will be called. (Note, the ‘C67x devices do have a 32x32o64-bit multiply
instruction, MPYID.)
2. Use int types for counters and indexes. As we examine during the next module, all registers and
data paths are 32-bits wide.
3. Avoid accidentally mixing long and int variables. Many compilers allocate 32-bits for both types,
thus some users interchange these types. The ‘C6000 allocates longs at 40-bits to take advantage
of 40-bit hardware within the CPU. If you mix types, the compiler may be forced to manage this –
which will most likely cost you some performance.
Why 40-bits? The extra 8-bits are often used to provide headroom in integer operations. Also,
they can act like an 8-bit “carry bit”.
4. On ‘C67x devices, 32-bit float operations are performed in hardware. The ‘C6000 supports IEEE
32-bit floating-point math.
LAB 3: Using C
This lab has four goals:
x Build a project using C source files.
x Benchmark/profile C code.
x Contrast results for both sets suggested compiler options:
Debug build configuration
Release (Optimized) build configuration
x Examine fixed vs. floating-point solutions
We’ll begin by building the fixed-point version of the dot-product code shown below. Halfway
through the lab we’ll switch to the floating-point version. At the end, we’ll compare our results.
// Lab3.c
/* Prototype */
int dotp(short *m, short *n, int count);
/* Include Files */
#include <stdio.h>
#include "data.h"
/* Definitions */
#define COUNT 256
/* Declarations */
short a[COUNT] = {A_ARRAY};
short x[COUNT] = {X_ARRAY};
volatile int y = 0;
/* Main Code */
main()
{
y = dotp(a, x, COUNT);
y = dotp(a, x, COUNT);
// data.h
#define A_ARRAY 1, 2, 3, ... , 256
#define X_ARRAY 256, 255, 254, ... ,1
Note: The dot-product routine is called twice so that we can examine the effects of on-chip cache.
2. If instructed to do so, configure CCS to use the DSK’s driver (as opposed to the simulator
driver). Your instructor will tell you where to find instructions, if this step is required.
3. Start Code Composer using the Code Composer Studio desktop icon.
By default, after building your program using CCS, you must then use the File:Load Program to
download the executable (.OUT) file onto your target (DSP microprocessor or simulator). To
perform this download automatically – after each successful build – follow the next two
instructions:
4. Open the CCS customize options dialog: Option:Customize…
5. Navigate to the Program Load Options tab and click Load Program After Build.
Then click OK to save the change and close the Customize dialog.
Project:New…
You will encounter the Project Creation dialog. Fill in the Project Name and Location as shown
below:
You can also use the … button to specify the correct path.
9. Verify the newly created project is open in CCS by clicking on the + sign next to the Projects
folder in the Project View window.
You may want to expand the lab3.pjt icon to observe the project contents. (Of course, it
should be empty at this time.)
11. CCS allows you to select a template configuration file. Since no simulator specific CDB template
is available, we’ll choose the dsk6711.cdb template.
Note: In some TI classrooms you may see two or more tabs of CDB templates; e.g. TMS62xx,
TMS54xx, etc. If you experience this, just choose the ‘C6x tab and make your selection.
The CDB templates automate the process of setting up numerous system objects/parameters.
Those shown above are shipped with CCS revision 2.0. You can create your own CDB templates,
just copy a CDB file you have created to the directory where the above files are stored
(C:\ti\c6000\bios\include).
12. While there are many objects displayed in the configuration editor, we don’t need to configure
any of them. The dsk6711 defaults will work fine.
File:Save As…
Note: If during the process of creating or saving a configuration file you get an error (something like Server Error), please hit the
Retry button in the error dialog box and ignore it. It’s just an internal CCS module reporting it is temporarily busy.
LAB3.C
LAB3.CDB
LAB3cfg.CMD
When these files have been added, the project should look like:
Note: If, for some reason, you must quit Code Composer before completing this lab, you must:
x Open the project (LAB3.PJT), and
x Load the executable program (LAB3.OUT) files with File:Load Program…
Debug:Go Main
The debugger should run past the system initialization code, until main() is reached. Since
main is in LAB3.C, this file should appear in CCS’s main work area.
Watch Variables
20. Add y to the Watch window.
After adding a variable, the Watch window automatically opens and y is added to it.
Alternatively, you could have opened the watch window, selected y, and drag-n-dropped it
onto the Watch 1 window.
21. Click on the Watch Locals tab.
You’ll notice this is empty since main() doesn’t contain any local variables.
22. Let’s single-step the debugger into our dotp() function, which contains local variables.
Note: At some point, if the Watch window shows an error “unknown identifier” for a variable,
don’t worry, it's probably due to the variable’s scope. Local variables do not exist (and
don’t have a value) until their function is called. If requested, Code Composer will add
local variables to the Watch window, but will indicate they aren’t valid until the
appropriate function is reached.
This opens up the Command window and docks it at the bottom of the CCS window. You
may wish to resize or rearrange the windows, for your convenience. In fact, it may help to
right-click inside the Build window and select Hide to give you more space.
24. To try out the Command window, let’s add a and x to the Watch window.
The wa (watch add) command adds a variable to the watch window. Type the following into
the Command textbox and hit the Execute button (or enter key):
wa a
25. The Command window also represents one of the two automation methods provided within CCS.
As a demonstration, we created a debugger command/log file called WATCH.TXT. To invoke it,
type the following into the Command textbox and hit the enter key.
take watch.txt
You should see a and x added to the Watch window. Like batch files or macros, this works
especially well if you want to repeat a given sequence at a later time … or over and over.
Note: If you receive an error, “Cannot open file: “watch.txt”, it’s just that CCS cannot find the
file. A small idiosyncrasy (bug) in CCS causes it to look in the path of the last file opened
with File:Open, rather than the local path of the active project.
26. Since both a, x, and y were in our take file, a and y show up twice in the Watch window since
we had added them previously. Let’s remove them.
28. Try executing step command within the Command window to single-step the processor.
step
-or- F5
30. Eventually, the processor will reach the end of the main( ) function.
y = ____________
The answer should be:
34. Before we begin, let’s restart our program. Make sure the processor is halted, then:
Debug:Restart
Debug: Go Main
Note: If you choose CPU Reset rather than Restart, the DSP will be reset and your program will
be erased. If this occurs, just reload the program again with File:Reload Program.
35. Also, let’s close some windows to free up some extra room. Close the Watch and Command
windows (right-click on each of them and select close.)
36. Open a new profiling session.
39. Before running the code, set a breakpoint at the end of main() to stop the processor automatically.
F5 then F8
42. Since future revisions of the compiler can alter performance (by increasing performance), record
your results.
How fast was your dotp? Min Incl _________________ clock cycles
How fast was your dotp? Max Incl _________________ clock cycles
Why did you receive different results for Min and Max? _____________________________
__________________________________________________________________________
If you ran it a third time, which would you get (Min or Max)? ________________________
43. Copy the minimum result to the table on page 3-33.
44. Halt the processor if it’s still running.
Project:Configurations...
The release configuration doesn’t enable any level of debugging. That is, no symbolic
information is included in the .OUT file. While this is great for a final release, it makes it
difficult to profile while optimizing for performance. We can either change the Release build
configuration, or create a new one. Let’s try the latter.
Project:Configurations
52. Name your new configuration “Optimize” (at least, that’s what we suggest). Make sure it
copies the settings from Release. Click OK.
54. Open the build options dialog to modify the active (Optimize) configuration.
Project:Build Options...
Function Profile Debug (-gp) is a less severe form of Full Symbolic Debug (-g). While –g
makes debugging very easy, if often severely reduces the performance of compiled code. The
–gp option places the minimum amount of debug information into the code needed for
function level profiling.
55. Rebuild and load the program (as discussed in step 16).
56. Close the current profile session (to save screen space). The original Debug session won’t
respond to the Optimize configuration.
63. Clear any breakpoints you set in the lab. Use Debug:Breakpoints Æ Delete All or the
toolbar button:
64. Close the project and any windows associated with it.
Project:Close
Window:Close All
Lab 3 Summary
Let’s summarize the profile results.
Build
Lab Step Lab Cycles
Configuration
Lab 3 Lab 3
Debug
Step 42 Integer
Lab3a.c
/* Prototype */
float dotp(float *m, float *n, int count);
/* Include Files */
#include <stdio.h>
#include "data.h"
/* Definitions */
#define COUNT 256
/* Declarations */
float a[COUNT] = {A_ARRAY};
float x[COUNT] = {X_ARRAY};
volatile float y = 0;
/* Main Code */
main()
{
y = dotp(a, x, COUNT);
y = dotp(a, x, COUNT);
Q: Should we have just done a global search and replace on int and short to change them to float
when we created LAB3a.C from LAB3.C?
A: No, it’s better for variables used as things like counters to remain integers. For example, our
counter, i, was kept as an integer type. We bolded the changes we made to LAB3a.C (above)
to make them easier to observe.
This time, make sure the target is set for TMS320C67XX. This sets the –mv6700 option in
the project’s build options.
3. Open the file C:\c60001day\labs\lab3\LAB3.CDB and save it as LAB3a.CDB:
File:Open... C:\c60001day\labs\lab3\LAB3.CDB
LAB3a.C
LAB3a.CDB
LAB3aCFG.CMD
5. Build (and load) the program using the Debug build configuration.
6. Open a new profile session (as described in steps 36-37 on page 28). And set a breakpoint as
shown in step 39 (page 29).
7. Run (F5) to the breakpoint and single-step once.
8. What is the value of y? ________________________ (should be 2829056 decimal)
9. Is this the same as the integer result (see step 33 on page 27)? ________________________
10. How fast was the floating-point dotp?
15. Open a new profile session. You can call it whatever you wish; we called ours Optimized.
16. If it doesn’t still exist, set a breakpoint as shown in step 39 (page 29).
17. Run (F5) to the breakpoint and single-step once.
18. Is the value of y still the same? ________________________ (should be 2829056 decimal)
23. Close the project and any windows associated with it.
Project:Close
Window:Close All
3. While we know this is a bit tedious, it’s a simple way to copy the three files needed from the
previous lab folder.
x Open the file C:\c60001day\labs\lab3a\LAB3a.C and save it as LAB3b.C:
File:Open... C:\c60001day\labs\lab3a\LAB3a.C
File:Save As... C:\c60001day\labs\lab3b\LAB3b.C
File:Open... C:\c60001day\labs\lab3a\LAB3a.CDB
File:Save As... C:\c60001day\labs\lab3b\LAB3b.CDB
File:Open... C:\c60001day\labs\lab3a\data.h
File:Save As... C:\c60001day\labs\lab3b\data.h
LAB3b.C
LAB3b.CDB
LAB3bCFG.CMD
5. Uncomment the following two lines from LAB3b.C by removing the // from the beginning of
the line. These #pragma’s force the a and x arrays to be aligned to 8-byte (double-word)
boundaries in memory.
You should notice the lines change from green (indicating they’re comment lines) to normal
code.
6. Create a new project build configuration called Optimize.
Use the same steps as before (steps 50-54), where you copied the Release configuration to a
new one called Optimize; then you added the –gp option.
7. Build (and load) the program using the Optimize build configuration.
8. Open a new profile session. You can call it whatever you wish; we called ours Optimized.
9. If it doesn’t still exist, set a breakpoint as shown in step 39 (page 29).
10. Run (F5) to the breakpoint and single-step once.
11. Is the value of y still the same? ________________________ (should be 2829056 decimal)
12. How fast was the optimized floating-point dotp using the #pragma DATA_ALIGN?
16. Close the project and any windows associated with it.
Project:Close
Window:Close All
CCS lets you remap many of these functions. Let’s try remapping Restart.
1. Open the CCS customization dialog.
Option:Customize…
F4
We already checked and this one isn’t assigned within CCS, by default.
6. Click OK twice to close the dialog boxes.
7. From now on, to Restart and Run the CPU, all you need to do is push F4 then F5.
c:\c60001day\labs
/* Declarations */
#pragma DATA_ALIGN(a, 8);
#pragma DATA_ALIGN(x, 8);
float a[COUNT] = {A_ARRAY};
float x[COUNT] = {X_ARRAY};
Note: This trick is not required for integer math. By default, short arrays are aligned
on 32-bit boundaries, allowing the optimizer to always make this optimization.
The DATA_ALIGN pragma’s cut 30% of the cycles from the algorithm by providing just a little
more insight about your system to the compiler can lead to big gains in performance.
To better understand the effects of the #pragma DATA_ALIGN on the ‘C67x and other
optimization techniques, please refer to the Compiler Tutorial in the CCS online help. As we do
not have time in the 1-day workshop to review all these hints, please refer to the Compiler Tutorial for
more information.
Further C Optimization
Program Level Optimization (-pm)
Command Window
GEL Scripting
GEL Scripting
GEL:
GEL: General
GeneralExtension
Extension
Language
Language
CCstyle
stylesyntax
syntax
Large
Large numberof
number ofdebugger
debugger
commands
commands as GELfunctions
as GEL functions
Write
Writeyour
yourown
ownfunctions
functions
Create
CreateGEL
GELmenu
menuitems
items
x Notice the GEL folder in the Project View window. You can load/unload GEL scripts by right-
clicking this window.
x GEL syntax is very C-like. Notice that QuickTest() calls LED_cycle(), defined earlier in the file.
x You can add items to the GEL menu. An example is shown in the above graphic.
x Finally, a GEL file is loaded upon starting CCS.
DSK Note
The startup GEL filename is a property of the emulation configuration selected during CCS
Setup. The C6711 DSK uses this startup GEL file: C:\TI\CC\GEL\DSK6211_6711.GEL
Volatile
When highly optimizing compilers are used, it is not unusual for a program to fail to execute correctly.
The optimizer analyzes data flow and avoids memory accesses whenever possible – which can lead to
incorrect behavior described below.
If C code reads memory locations that are modified outside the scope of C (such as a hardware
register), the compiler may optimize these reads out. To prevent this, these memory accesses must be
identified with the “volatile” keyword. The compiler does not optimize out any references to volatile
variables.
For example, the while loop waits (polls) for a location to be read as non-zero (i.e. it waits while the
location is equal to zero):
int *ctrl;
while (*ctrl == 0);
In this example, *ctrl is a loop-invariant expression; i.e., the expression never changes during
execution of the loop. In this case, the optimizer will reduce the loop to a single memory read — not
what was intended by this “busy-waiting loop.” This kind of code is common in control-type
applications. To prevent this busy-waiting loop from essentially being optimized out of existence, use
the “volatile” keyword. Although it is an ANSI Standard C keyword, it is often only understood by
embedded control programmers who have used highly optimizing C compilers.
To prevent the optimizer from changing this expression, the declaration for *ctrl is changed to:
This error is has been a major source of optimizer problems, just ask our support hotline.
A couple of caveats:
x Don’t run PBC until your project is fully debugged. PBC is a great optimization tool but wasn’t
designed for debugging.
x The Profile Based Compiler is included with the full version of Code Composer Studio. It does
not ship with the ‘C6711 DSK.
Today’s Agenda
Agenda
Overview Hello, TI DSP, ‘C6000
DSK Tour of ‘C6711 DSK
C Code Code Composer
System 1. McBSP, Interrupts
2. EDMA, Cache
DSP/BIOS Real-Time Tools
VAB Visual Design
Epilogue What Next?
T HE WORLD LEADER IN DSP SOLUTIONS
Learning Objectives
Building a Real-Time System
TI Foundation Software
What is CSL?
Sine Algorithm
Using AD535 codec
Using Interrupts
Lab 4
Create and listen to sinewave
Module Topics
Building a System (McBSP & HWI) ........................................................................................................... 1
Background ................................................................................................................................................ 4
TI Software Foundation Support............................................................................................................ 4
TI Software Foundation Libraries.......................................................................................................... 6
What is CSL and BSL? ................................................................................................................. 6
CSL Benefits ................................................................................................................................. 7
Modules contained within CSL and BSL...................................................................................... 9
General CSL protocol.................................................................................................................. 10
Other Libraries ............................................................................................................................ 11
Generating a Sine Wave ........................................................................................................................... 12
Sine Algorithm and Code..................................................................................................................... 12
Output Sine Value to the Speaker ........................................................................................................ 13
Hardware Interrupt Driven Systems..................................................................................................... 17
Serial Port Transmit Interrupt (XINT0) ...................................................................................... 18
System Initialization ............................................................................................................................ 21
BSL and CSL Initialization ......................................................................................................... 21
Codec Initialization ..................................................................................................................... 22
Hardware Interrupt Initialization................................................................................................. 23
Lab 4......................................................................................................................................................... 25
Open Project................................................................................................................................ 29
Configure Hardware Interrupts (HWI)........................................................................................ 30
Codec Functions.......................................................................................................................... 32
Build it and they will run …........................................................................................................ 33
Using IDL.................................................................................................................................... 33
Take Home Exercises ............................................................................................................................... 34
Lab4a – Try graphing the Sine Wave .................................................................................................. 34
Lab4b – Compare floating vs. fixed-point sine algorithm ................................................................... 35
Optional Topic - Data Convert Plug-in.................................................................................................... 37
Background
TI Software Foundation Support
TI Software Foundation Model
Plug-
Plug-ins
Board Support D TI’s User.lib
Layer C bsl.lib
P
Chip Support
TI’s csl.lib
Layer
Building a system is often a process of creating layers of services or code. Like writing code, usually
one finds that the higher level you can work at, the faster you can get the job done. DSP based systems
are no different. To that end, TI has worked hard over the last few years (and continues to do so) to
create a development platform that speeds your design efforts.
Since the DSK was designed by TI, it is easy for us to create routines to access its resources. On the
other hand, if you design your own board we cannot provide these routines as there are just too many
possibilities for you to exploit in your design. To this end, we currently have two aids:
x Use TI’s Board Support Library (BSL) as an example. You can build a library of routines to
support your board’s hardware.
x TI provides a Code Composer Studio plug-in which may help you. The Data Converter Plug-
in (DCP for short) is included with CCS. When using one of many TI data converters, the
plug-in may be used to generate the code required to initialize and use the device. Essentially,
you specify the codec’s options in a GUI dialog and the plug-in creates the interface code for
you.
In the Foundation Model diagram above, we displayed other vacant slots for board support layer
support. Currently DCP is the only tool available, although there are many application notes on our
website available that describe interfacing to other system resources.
Note: This workshop uses the codec routines from TI’s Board Support Library – this allows us to
use the codec without having to completely discuss the specific codec or the ‘C6711 McBSP
(serial port) used to access the codec. This level of discussion is precluded by the limited 1-
day format of the workshop.
While some parts of DSP/BIOS are discussed in the later Introduction to DSP/BIOS chapter, alas,
there is not enough time in the day to cover these communications capabilities. To explore these
further, we suggest you: attend the 4-day DSP/BIOS Workshop; follow the DSP/BIOS tutorial
included with CCS; and , read the DSP/BIOS users guides and many application notes on the TI
website.
This library supports the use of the on-chip peripherals by providing a set of low-level functions and data
structures to ease their implementation. CSL has been designed to support multiple invocations – such as
you might find when using the multiple serial ports or DMA channels found on TI’s DSP devices.
Simplified directions for using the CSL are located in the lab exercises and in the appendix of this
workshop. For complete details, please refer to the C6000 CSL Reference Guide (SPRU401b.pdf).
The BSL has not been officially released. In other words, it is brand new. These functions support the
specific hardware found on TI hardware development platforms. The first platform being supported is the
TMS320C6711 DSP Starter Kit. If you look through the following list of modules supported, you will
notice the hardware features discussed in the early DSK Tour chapter: AD535 codec, LEDs, DIP switches,
Flash, etc.
BSL is build upon CSL. That is, to use BSL you must also include the CSL libraries in your project.
Essentially, BSL provides a higher-level system interface than CSL. Since various decisions are made
when building a board, TI can leverage those decisions to simplify your system development. For example,
one of the serial ports (McBSP0) is directly connected to the AD535 codec in the standard DSK
configuration. With this knowledge, a set of functions can be written to directly address the AD535 codec.
When configuring the AD535, these functions automatically open and configure the McBSP; then use that
McBSP to configure the AD535. This saves you from the drudgery of researching and programming the
AD535 and McBSP!
The lab exercises make use of the BSL library. Since the standard CCS install does not currently include
this new library, we have installed it in a folder along with the lab exercises. It should be located at:
C:\C60001DAY\TI\PRELIMINARY_BSL. Along with the libraries and header files, we have included the
BSL documentation in a PDF file in the C:\C60001DAY\TI directory (SPRU432.pdf).
CSL Benefits
Why CSL and BSL? Here are a few reasons:
Increased Portability
x Supports all ‘C6000 DSPs. When changing from one device to another, no (or little) re-coding is
required for peripherals.
x Where possible, TI has used the same API’s for both the C5000 and C6000 DSP families. This
makes porting C code between processors much easier. Taking into account the cross-platform
support of DSP/BIOS makes TI’s software tools quite powerful.
x The goal is to provide compatibility at the _open(), _close(), _config() level. The initialization data
structures may be different, but we have striven to make the functions as compatible as possible
Easier to use
x When TI’s DSP 3rd parties and customers use the same CSL/BSL functions, it becomes easier to
use and understand code written by others.
Please refer to the various reference guides for specific details on each API:
x TMS320C6000 Chip Support Library API Reference Guide
This book is installed with Code Composer Studio 2.0 at:
C:\ti\docs\pdf\spru401b.pdf
x TMS320C6000 DSK Board Support Library API User’s Guide – Preliminary
You can find a preliminary version of this book at:
c:\c60001day\ti\BSL Ref Guide - spru432.pdf
x TMS320C6000 DSP/BIOS Application Programming Interface (API) Reference Guide
This book is installed with Code Composer Studio 2.0 at:
C:\ti\docs\pdf\spru403c.pdf
2. Open peripheral
Reserves resource
Provides ‘handle’ to reference resource
3. Configure peripheral
Apply setup configuration to peripheral
4. Use peripheral
Some periph’s use functions to read/write them
To some this syntax will appear quite familiar. To those of use who spent most of our careers writing
assembly language, though, this may be a new method of programming.
Let’s see how the four parts of the timer example shown above correlate to these two ideas.
1. The first two lines of the example define the required data structures.
The data type called TIMER_Handle is defined in CSL. Essentially, it is used to point to one of
the timers (as we will see later). Not all CSL modules require the use of a handle (i.e. pointer),
only those peripherals where there is more than one resource. For example, timers, DMA, EDMA,
McBSP, etc. The handle is used to specify which one of the timers you are working with.
The second line defines a data structure. The variable name is myConfig and its data type is
TIMER_Config. Again, this data type is defined in the CSL. This variable represents a C data
structure that will be used to define a timer configuration. In other words, all the values you would
need to program the timer peripheral are stored in this structure.
Note: The myHandle and myConfig names are arbitrary. We could have called them julie and frank.
The choice is yours.
2. The third line of the example contains code that opens the peripheral. In this case, “open” means
two things:
x The CSL code checks to see if the specified resource has already been opened. In other
words, is the resource available? In this example, we have requested TIMER_DEVANY,
which means we are asking for any available timer.
x If it is available, the timer resource is marked as being used and a pointer to the specific timer
is returned as a TIMER_Handle. If the specific resource has already been opened, then the
function returns “INV” for invalid. Your code could check if the INV error code has been
returned. (We didn’t do that in our example since there wasn’t much room on the slide.
Where does the CSL keep track of opened resources? The CSL maintains a series of data
elements (you could think of them as flags) to keep track of this information. Could you have
done this? Yes, you probably could; but isn’t it nice to have this code already written for you?
Even further, if you later decide to use this code on another ‘C6000 processor, you won’t have to
find and change all the resource management code. You only need to indicate to the CSL that you
have switched CHIPs and the rest is done for you automatically.
3. The fourth line of the example configures the peripheral. In this case, the timer specified by
myHandle is configured with the myConfig data structure. The actual CSL code copies each of the
values in the myConfig data structure to the appropriate memory-mapped peripheral registers.
(How many times have I had to write this kind of code in assembly. I’d be pouring over the
reference guide trying to type in all the bits and memory addresses without making a typo mistake
– which, of course, happened too often.)
4. Finally, the last line of code is an example of how to use the peripheral. There are many functions
that allow you to easily use the peripheral. In the case of the timer, we can: start, stop, pause, etc.
With the McBSP serial port, you could: read, write, reset, etc.
Even if you have never written code along these lines before, you will find it quickly becomes second-
nature. And if ease-of-use wasn’t enough reason to use CSL, the reliability, portability, and
optimization features of CSL will make you never want to go back to the old ways.
Other Libraries
Texas Instruments provides other libraries along with CSL and BSL:
x Runtime Support Libraries – are included with the C/C++ compiler. These are referenced by the
CDB file within our lab projects and therefore do not have to be explicitly added by us. The CDB
file knows which version of the RTS library to include based upon the processor selected in the
Global Settings module of the CDB file.
x DSP/BIOS Libraries – as mentioned earlier, these provide a large number of APIs used in
scheduling, real-time analysis, and I/O. Again, they are automatically added to the project when
using a CDB file in your project.
x DSP and Imaging Libraries – provide a set of functions common to DSP and imaging
applications. Currently they support the ‘C62x set of devices. In the future they should be updated
to support the added features of the ‘C67x and ‘C64x devices. You must add these libraries to
your project if you use them.
x TMS320 Algorithm Standard – provides a methodology for application independent algorithm
creation and use. Please refer to the documentation included with Code Composer Studio, visit the
TI website (or http://www.dspvillage.com), or attend one of the TMS320 Algorithm Standard
workshops for more information.
Sine_float.c A
Generates a value
for each output
sample t
float
floaty[3]
y[3]=={0,
{0,0.7071,0};
0.7071,0};
float A = 1.4142;
float A = 1.4142;
short
shortsineGen()
sineGen(){{
y[0]
y[0] ==y[1]
y[1]**AA--y[2];
y[2];
y[2]
y[2] ==y[1];
y[1];
y[1]
y[1] ==y[0];
y[0];
return((short)(32000*y[0]);
return((short)(32000*y[0]);
}}
The diagram contains the floating point algorithm code. We chose floating point for two reasons:
x We are using the ‘C6711 floating point DSP.
x Floating point code is easier to develop. When using integers, extra care must be taken to
solve numerical overflow issues. These are minimized by the wide dynamic range of 32-bit
floating point. (ANSI C does not solve integer overflow, rather this issue must be handled by
the programmer.) One of the Lab 4 take-home exercises briefly examines this issue.
In the workshop appendix, we have included a brief discussion explaining the theory behind the
chosen sinewave algorithm. Also included, are the coefficients and initial data values required to
generate the DTMF (dual tone modulated frequency) values used for touch-tone dialing.
DAC
After creating the sine value using our sinewave algorithm, the CPU writes it to the McBSP
(serial port). This, in turn, is connected to the AD535 codec (digital to analog converter) which
transforms the number into a voltage. The voltage is driven through a connector and your patch
cable into the speaker.
Writing to the codec is simple when using the Board Support Library (BSL). The codec output
function can be accomplished with a single API function call:
codec_out(value)
{
AD535_write(handle, value);
}
Codec Details
Codec Interface
AD535
McBSP0 Voice Channel
DRR ADC gain
DXR DAC gain
CLKR
CLKX Fs = 8kHz
AD535:
Has two channels (voice & data), only the voice was used on DSK
Receives all commands and exchanges data serially via McBSP0
Driven by ext. 8kHz clock on DSK board.
It drives ‘C6711 serial port 0 (McBSP0) shift clocks.
8kHz sample rate allows maximum sine wave of ______ 4 kHz?
Looking closer at the McBSP ...
McBSP Details
Zooming-in once again, when the CPU (or DMA) writes a data value to the Data Transmit
Register (DXR), the serial port hardware moves this data across to another register where it is
serially shifted out the Data Transmit (DX) pin. DX is connected to the AD535 codec input.
CPU
D R
R Expand B RSR DR
(optional)
I R R 32
n
t D
e Compress
r X (optional) XSR DX
n R
a
l
B CLKR
u CLKX
s
McBSP Control CLKS
Registers
DMA FSR
FSX
McBSP Interrupts
DRR RBR
RRDY & XRDY in McBSP control register
RRDY=1 displays “status” of read and transmit ports:
“Ready to Read” 0: not ready
1: ready to read/write
DXR XSR
XRDY=1
“Ready to Write”
CPU In Lab 4:
RINT XRDY generates McBSP transmit interrupt (XINT0)
to CPU when the DXR is emptied (therefore ready for
XINT a new value)
An AD535 routine is used to write a new transmit value
DMA In Lab 5:
REVT XRDY generates transmit event to EDMA when the
XEVT DXR is ready for a new value
CLKR
CLKX Fs = 8kHz
AD535
AD535BSL
BSL
AD535_open()
AD535_open() reserves
reservesresource
resourceand
andreturns
returnshandle
handle
AD535_config()
AD535_config() configures
configuresMcBSP0
McBSP0and
andAD535
AD535
AD535_read()
AD535_read() reads
readsfrom
fromAD535
AD535ADC
ADCthru
thruMcBSP0
McBSP0receive
receive
AD535_write() writes to AD535 DAC thru McBSP0 transmit
AD535_write() writes to AD535 DAC thru McBSP0 transmit
As described above, you don’t really need to know all this detail to use the DSK codec. The
Board Support Library provides all the functions need to initialize, read, and write the codec via
McBSP0.
The above figure contains the four most common AD535 functions. Please refer to the BSL
documentation for a complete API listing. We described how to find the BSL documentation on
page 4-9.
Question: What happens when the ‘C6711 creates sinewave samples and outputs them faster than the
AD535 can convert them to analog?
Why does this happen? If you were to graph the sinewave values, they would appear correct? The
following quote seems to sum up the answer the best.
Since the DSK was designed to support only an 8kHz sample rate, thousands of samples would
be ignored by the codec if we let the CPU create and output samples as fast as it’s able.
Codec Interface
CPU McBSP0 AD535
8kHz
sample
clock
If the sinewave function isn’t synchronized with the 8KHz sample rate of our converter, only
noise (or clicks) will come out of the speaker. Using hardware interrupts can solve this dilemma.
XINT0 Interrupt
Codec Interface
CPU McBSP0 AD535
8kHz
sample
clock
main()
main()
{{ system
system
initialization
initialization
XINT0_HWI()
XINT0_HWI()
while(1);
while(1); {{ codecOut(sineGen());
codecOut(sineGen());
}} }}
When designing a hardware interrupt driven system, it is common practice to end the main()
function with an endless loop. The always-true while loop (above figure) serves this purpose. An
upcoming chapter describes a second (better) method for endlessly looping using the DSP/BIOS
IDL function. For now, though, the while loop will serve our purposes.
Code Composer Studio has simplified this process. (Oh, if you didn’t already know all those
steps, count yourself lucky you don’t have to figure it all out.) The DSP/BIOS configuration tool
will handle all these issues for you. You only need to select three options in the HWI graphical
interface.
XINT0_HWI()
XINT0_HWI() /*/* HWI
HWI */*/
{{ codecOut(sineGen());
codecOut(sineGen()); Last step:
}}
Initialization ...
The Configuration Tool can make any function into an interrupt service routine. In this case we
show our XINT_HWI() function being used as an interrupt service routine. Here are the steps
required:
1. Open the DSP/BIOS Configuration Tool, expand the HWI module by clicking on the +, and
select one of the available interrupts (HWI_INT4 thru HWI_INT15).
2. Choose the interrupt source you want associated with the HWI_INTx interrupt you have
selected. In this example, we set HWI_INT9 as McBSP0 transmit interrupt (XINT0).
The ‘C6000 devices give you an extra level of flexibility by allowing you to associate any
interrupt source with any interrupt flag. This is esp. useful since pending hardware interrupts
are serviced in priority INT4 (highest) to INT15 (lowest).
3. Enter the function name you want to use as an ISR into the Function textbox. Note, if the
function was created in C code, you must append an “_” underscore before the function
name.
4. Check the Use Dispatcher box. The interrupt dispatcher provides the context save/restore and
interrupt return to your function call. (Not shown, the dialog also allows you to specify which
interrupts can be nested within this interrupt service routine.)
When you save the configuration file (*.cdb), essentially, it will create:
x Creates the interrupt vector table (using the INT# and the function name you specify).
x Creates the initialization code needed to set the INT# to the specified interrupt condition
(in this case, INT9 as McBSP0 transmit interrupt (XINT0)).
x Provides context save/restore and return-from-interrupt for the specified function.
Note: There are other methods for creating interrupt service routines. If you prefer, you can still
create an ISR with assembly language. Due to the limited 1-day format, and this
method’s ease-of-use, we cannot cover the other methods today. The CPU reference
guide and the ‘C6000 4-day workshop covers interrupts in greater depth.
[Personally, the method we describe here is the one I always use. Ed.]
System Initialization
For our example, three items must be initialized:
x The Chip and Board Support Libraries
x AD535 codec (and associated McBSP0)
x Hardware Interrupts
CSL/BSL Initialization
DSK
‘C6711
HWI
sineGen McBSP
DAC
transmit interrupt
main()
main()
{{CSL_init();
CSL_init();
BSL_init();
BSL_init();
XINT0_HWI()
XINT0_HWI() /*/* HWI
HWI */*/
while(1);
while(1); {{ codecOut(sineGen());
codecOut(sineGen());
}} }}
Codec Initialization
The second initialization activity configures the AD535 codec.
Codec Initialization
DSK
AD535_Handle
AD535_HandlehAD535;
hAD535;
AD535_Config
AD535_ConfigmyAD535
‘C6711
myAD535=={{
AD535_LOOPBACK_DISABLE,
AD535_LOOPBACK_DISABLE,
HWI
sineGen
AD535_MICGAIN_OFF,
AD535_MICGAIN_OFF,
McBSP
AD535_GAIN_0DB,
AD535_GAIN_0DB, DAC
AD535_GAIN_0DB
AD535_GAIN_0DB};};
XINT0_HWI()
XINT0_HWI() /*/* HWI
HWI */*/
while(1);
while(1); {{ codecOut(sineGen());
codecOut(sineGen());
}} }}
We copied the code for this example directly out of the BSL documentation. It suited our needs
just fine.
Using the AD535 module simplifies using the codec. In the past, users were required to first
configure the McBSP0, then initialize the codec by sending commands through the McBSP. Of
course, this also required a thorough understanding of the AD535. The BSL provides these
services, all wrapped up in a simple API.
Enabling Interrupts
IFR IER CSRGIE
Interrupt “Individual “Master
Occurs Switch” Switch”
INT4 1
0 ‘C6000
CPU
INT15 1
Similar to most processors, three steps must occur before the ‘C6000 CPU can respond to an interrupt:
1. The interrupt must occur. When it does, a flag bit is set in the Interrupt Flag Register. (You
don’t really have to know this because the CPU hardware clears the associated flag bit when
it automatically responds to a given interrupt.)
2. An interrupt must be individually enabled before it can be recognized by the CPU. Again,
there is a register (IER) dedicated for this. In our case, rather than dealing specifically with
the register, we will use the IRQ functions from the Chip Support Library to enable
individual interrupts.
3. The global interrupt enable (GIE) bit within the Control Status Register must be set before the
CPU can recognize an interrupt. Think of it as a master switch for interrupts. Rather than
poking around in registers, we will again use the IRQ functions:
IRQ_globalEnable
IRQ_globalDisable
IRQ_globalRestore
In the upcoming lab, we will only need to use the IRQ_globalEnable() function.
Note: Those of you already familiar with the ‘C6000 might remember that a NMI (non-
maskable interrupt) exists. Uniquely, the NMI is not enabled at reset. This allows a
system designer to setup the NMI ISR before an NMI instance can occur; basically, this
saves hardware many designers have been required to include over the years.
Note (cont’d): When a configuration file (*.cdb) is included in your project, an extra DSP/BIOS
initialization step is included by the compiler. While there are no adverse affects to this
initialization, there is one benefit. Namely, the NMI enable (NMIE) bit is set for you.
Therefore, upon entering your main() function, you do not have to write your own code
to set the NMIE bit.
Enabling Interrupts
DSK
‘C6711
HWI
sineGen McBSP
init_HWI(){
init_HWI(){
//Enable
// Enableinterrupts
interruptsglobally
globally(this
(thissets
setsthe
theGIE
GIEbit
bitininCSR)
DAC
CSR)
IRQ
IRQ _globalEnable();
_globalEnable();
transmit interrupt
//Remember,
// Remember,we weused
usedMcBSP
McBSPtransmit
transmitint
int(XINT0)
(XINT0)
main()
main() IRQ
IRQ _enable(
_enable(IRQ IRQ_EV
_EVT_XINT0
T_XINT0););
{{CSL_init();
CSL_init(); }}
BSL_init();
BSL_init();
codec_init();
codec_init();
init_HWI();
init_HWI();
AD535_write(hAD535,
AD535_write(hAD535,0);
0); XINT0_HWI()
XINT0_HWI() /*/* HWI
HWI */*/
while(1);
while(1); {{ codecOut(sineGen());
codecOut(sineGen());
}} }}
Notice, these two functions provide the global and individual interrupt enables, respectively.
IRQ_globalEnable();
IRQ_enable(IRQ_EVT_XINT0);
The IRQ_enable() function knows which IER bit to set because the IRQ_EVT_XINT0 has been
mapped to IE9 by our choice in the HWI9 object in the configuration tool. If you had chosen not
to use the Configuration Tool or if you want to change this mapping at runtime, you can use the
IRQ_map(IRQ_EVT_XINT0, 9) function.
Lab 4
This lab exercise produces a sinewave output via the speaker. If you can hear the output, you’ve correctly
completed the exercise.
DSK
‘C6711
HWI AD535 BSL
sineGen McBSP
DAC
transmit interrupt
Lab 4
lab4.c #include’s sine_float.c sineGen()
global variables
main() {
CSL_init();
BSL_init(); lab4.cdb HWI_INT?
codec_init();
init_HWI(); XINT0 interrupt
AD535_write(hAD535, 0);
return;
}
// HWI routines
init_HWI(); You get to
XINT0_HWI; complete these
// Codec Routines
codec_init();
codec_out();
To make the lab easier, the next few pages contain a copy of LAB4.C.
/**************************************************************\
* This file contains all the functions for Lab4 except
* sineGen(). Most of it has already been written for you due
* to the limited time available in a one-day workshop.
*
* We have left a few "???" places, though, where you must enter
* the appropriate C code. Have fun!
\**************************************************************/
/**************************************************************\
* Prototypes
\**************************************************************/
void codec_out(void);
void codec_init(void);
void init_HWI(void);
void emif_init(void);
short sineGen(void);
/**************************************************************\
* Include files
\**************************************************************/
#include <c6x.h> // C6000 compiler definitions
/**************************************************************\
* Global Variables
\**************************************************************/
/**********************************************************\
* The following AD535 Handle and Config structure were
* entered verbatim from the BSL documentation. The config
* values are common to many applications; if nothing
* else, they make a good starting point.
\**********************************************************/
AD535_Handle hAD535;
AD535_Config my_AD535_Config = {
AD535_LOOPBACK_DISABLE,
AD535_MICGAIN_OFF,
AD535_GAIN_0DB,
AD535_GAIN_0DB
};
/**************************************************************\
* Main Routine
\**************************************************************/
void main()
{
CSL_init(); // Initialize CSL library
BSL_init(); // Initialize BSL library
emif_init(); // Dummy function - see note below
codec_init();
init_HWI();
/**************************************************\
/**************************************************************\
* Configure External Memory Interface (EMIF)
*
* We have a dummy function here to setup the EMIF. In a "real"
* system you would be required to setup the EMIF but in our
* development system CCS sets up the memory for us (refer to
* the DSK6211_6711.gel file for the CCS script that
* accomplishes this task.
\**************************************************************/
void emif_init(void){
}
/*************************************************************\
* Initialize hardware interrupts.
**************************************************************
* The AD535 codec is hardwired to McBSP0. Therefore,
* our system uses the McBSP0 transmit interrupt
* (XINT0) to signal when to write the next output sample.
*
* Enabling the CPU to recognize the XINT0 interrupt requires:
*
* 1. Map McBSP0 transmit interrupt (XINT0) to interrupt 9 (HWI9)
* using the Config Tool
* 2. Enable interrupts globally
* 3. Enable McBSP transmit interrupt
\*************************************************************/
void init_HWI(void)
{
IRQ_????????????(); // Enable ints globally
IRQ_enable(?????????????); // Enable McBSP0 interrupt
}
// Interrupt service routine you need to reference in HWI module of CDB file
void XINT0_HWI(void)
{
codec_out(); // Outputs sine sample for each XINT0 interrupt?
}
/**********************************************************\
* Codec Functions
\**********************************************************/
void codec_init()
{
/* Use the BSL routines to: Open, reset, & config the AD535 *\
* Part of the AD535_open() routine opens and configures the McBSP0, since *
\* all communications with the AD535 codec are handled via the McBSP0. */
hAD535 = AD535_????(AD535_localId); // Open AD535 and set hAD535 handle
AD535_reset(??????); // Reset AD535
AD535_??????(??????, &??????????????); // Configure AD535
/**************************************************\
* This sets a bit in a McBSP register thus
* allowing it to continue running even when the
* debugger is halted. This keeps the codec from
* being corrupted.
*
* We've put this function in the "bsl_suggestions"
\**************************************************/
MCBSP_setfree(0);
}
/******************************************************\
* Output a sine sample from the function SineGen()
* to the AD535 codec.
\******************************************************/
void codec_out(void)
{
AD535_HWI_write(hAD535, sineGen());
}
Open Project
1. Open the project LAB4.PJT within CCS. (Project:Open…)
In the interest of time, we have pre-built most of this project for you. The project should contain the
following files:
2. Set the project options. To make this easier, we have placed the compiler options in a text file
<lab4_compiler_options.txt> for you to cut-and-paste.
-iC:\ti\c6000\dsk\include
-iC:\c60001day\ti\preliminary_bsl\include
-dCHIP_6711
-dBOARD_6711DSK
While there are text entry boxes in the GUI to enter these items into, it’s much easier to paste
this into the GUI as shown:
void XINT0_HWI(void)
{
codec_out(); /* Outputs sine sample for each XINT0 interrupt? */
}
Open LAB4.C and examine the codec_out() function. What will it do in response to an XINT0
interrupt?
_________________________________________________________________________________
Note, the function AD535_HWI_write() is documented in the bsl_suggestions.h file. We’ll talk more
about how this works later (page 4-33).
4. How can you make the XINT0_HWI function into an interrupt service routine?
_________________________________________________________________________________
5. To implement the answers to the previous two steps, open LAB4.CDB and expand (open) the
HWI module (within the Scheduling folder). (We already created the CDB file for you and
added it to the project but other than that, we haven’t modified it.)
6. Examine HWI_INT4 through HWI_INT15, looking for the McBSP serial port transmit interrupt. This
is easiest if you click on HWI_INT4 as shown and look at the Interrupt Source field; then cursor down
the list …
7. Open the properties of the HWI_INT9 (step 6 answer) by right-clicking on HWI_INT9 and selecting
Properties.
a. Enter the name of the HWI service routine into the function textbox. Note, if the function was
defined in C (as in our case), you must append a leading underscore preceding the function name
you enter.
_FunctionName
b. Tell the Config Tool to use the interrupt dispatcher routine provided by CCS to handle all the
hardware interrupts context save/restore operations.
; Use Dispatcher
/*************************************************************\
* Initialize hardware interrupts.
**************************************************************
* The AD535 codec is hardwired to McBSP0. Therefore,
* our system uses the McBSP0 transmit interrupt
* (XINT0) to signal when to write the next output sample.
*
* Enabling the CPU to recognize the XINT0 interrupt requires:
*
* 1. Map McBSP0 transmit interrupt (XINT0) to interrupt 9 (HWI9)
* using the Config Tool
* 2. Enable interrupts globally
* 3. Enable McBSP transmit interrupt
\*************************************************************/
void init_HWI(void)
{
IRQ_????????????(); // Enable ints globally
IRQ_enable(?????????????); // Enable McBSP0 transmit interrupt
}
Hints:
To check on IRQ syntax, please refer the TMS320C6000 Chip Support Library API Reference Guide
Revision 2.0 (pages 11-16 and 11-14):
C:\ti\docs\pdf\spru401b.pdf
To make it easy to find, we have placed a shortcut to this book in the Lab 4 folder.
Codec Functions
There are two codec routines:
x Configure the codec – codec_init();
Step 10 asks you to complete this function.
x Write to the codec – codec_out();
This function has been written for you.
These routines use the Board Support Library (BSL). BSL is available in preliminary form, as it has not yet
been production released. It is included with the workshop lab files at
c:\c60001day\ti\preliminary_bsl\.
Codec Initialization
10. Scroll down through LAB4.C to find the codec_init() function. Replace the ??? entries with the
appropriate C code.
void codec_init()
{
// Use the BSL routines to: Open, reset, & config the AD535
The BSL simplifies the configuration; rather than having to write the code to initialize the McBSP and
AD535, we simply specify the needed settings and the BSL functions perform the configuration for
you.
Hint:
To check on AD535 syntax, please refer the TMS320C6000 DSK Board Support Library API User’s
Guide Preliminary (pages 2-9, 2-12, and 2-4 respectively). You can find this book at:
C:\c60001day\ti\ BSL Ref Guide - spru432.pdf
Codec Output
As mentioned, this function has already been written. It uses a special AD535 write function
well suited for use within an interrupt service routine.
/******************************************************\
* Output a sine sample from the function SineGen()
* to the AD535 codec.
\******************************************************/
void codec_out(void)
{
AD535_HWI_write(hAD535, sineGen());
}
The AD535_write function polls the McBSP transmit ready bit, waiting for it to become
ready. Waiting for ready ties up the processor. The HWI version, AD535_HWI_write
assumes the port is ready, and immediately writes the output value. If this function is
triggered by the transmit interrupt, this is a valid assumption. The benefit is that the processor
is free to perform other functions, rather than polling the ready bit, which is the whole idea
behind hardware interrupts.
Note: The AD535_HWI_read and AD535_HWI_write functions are not officially part of the
preliminary Board Support Library. They are recommendations and have been included
in the BSL_SUGGESTIONS.H file (located in the Lab 4 folder).
This is a known BSL bug and will not affect our program. Please go ahead and ignore it.
12. Run your program and listen for the sinewave tone.
If you didn’t hear it, first make sure all the hardware connections are solid. If the cabling is
OK, you need to debug your code.
Using IDL
13. In the main() function, comment out the while(1); loop and replace it with:
return;
When a CDB file is present in your project and your code returns from the main function, the
processor enters the DSP/BIOS idle (IDL) loop. In our case, nothing should change – after
rebuilding the code and running, it should sound the same. Later today, we’ll discuss the
benefits of using IDL versus a while loop.
14. Verify that code using IDL works the same as your previous code.
15. Halt the DSP when you are done.
x To display graph information, the DSP must be halted. We setup a breakpoint at the end of the for-
loop, which calls the sine routine.
void main()
{
block_sine(buffer, BUFF_SIZE);
o }
x In this project we modified the CDB template to put global variables into internal memory. We
describe how this can be done in Module 5.
This is the difficulty of integer processing. To correct for this, most engineers choose to use fractional
fixed-point math, often called Q-format math. Essentially, this method provides a simple means of scaling
numbers to prevent (or at least reduce) overflow. Unfortunately, there isn’t time in this workshop to discuss
these issues. Besides the fact, since you are using a ‘C6711 floating-point processor, you don’t have to be
as concerned as a fixed-point user would.
This take-home project briefly explores these issues. It calculates the sine wave in three ways: float,
standard fixed-point, and fractional fixed-point. Graphing all three of them, you’ll notice that both the float
and fractional solutions produce the expected sinewave.
Use switches to vary DTMF tones, LEDs to visualize the switch settings
Taking the lab a step further, use the DIP and LED modules from the Chip Support Library to
change (and indicate) the DTMF tones generated by your code.
Have Fun …
Chip Support
TI’s csl.lib
Layer
Today’s Agenda
Agenda
Overview Hello, TI DSP, ‘C6000
DSK Tour of ‘C6711 DSK
C Code Code Composer
System 1. McBSP, Interrupts
2. EDMA, Cache
DSP/BIOS Real-Time Tools
VAB Visual Design
Epilogue What Next?
T HE WORLD LEADER IN DSP SOLUTIONS
Chapter Outline
The goal of Chapter 5 is to make the DSP system more efficient by using the Enhanced DMA
(EDMA) peripheral. The EDMA moves blocks of memory around the system without CPU
intervention, therefore leaving the CPU free to work on algorithms.
Outline
What is Block Processing?
EDMA
Operation
Initialization
Interrupt to CPU
Block Processing Code
Cache
RISC vs. C6000 cache architecture
‘C6000 Double level cache
Configuring L2 cache
Lab
Use EDMA with block sineGen
Module Topics
Building a System (EDMA, Cache) .......................................................................................................... 5-1
HWI
CPU
McBSP
DAC
CPU
CPU must:
must:
Generate
Generatesine
sinewave
wavesamples
samples
Respond to McBSP interrupt
Respond to McBSP interrupt
Send
Senddata
datatotocodec
codec(via
(viaMcBSP)
McBSP)
How can we improve system performance?
Notice that the CPU not only generates the sine wave values but is also responsible for writing
them to the codec. You might remember from the last module that hardware interrupts were
required to trigger the CPU to create and write a new value.
The downside to interrupts, on any microprocessor, is that they use-up some of the processors
performance each time an interrupt is serviced.
Block processing (sometimes called vector processing) is a common solution to this problem.
CPU
Buffer McBSP
EDMA DAC
CPU
CPU
Generates
Generatesbuffer
bufferof
ofsamples
samplesat
ataatime
time
EDMA
EDMA
Handles
HandlesMcBSP
McBSPinterrupt,
interrupt,reduces
reducesCPU
CPUint.
int.overhead
overhead
Sends
Sendsdata
datato
tocodec
codec
If EDMA handles the McBSP event,
how does the CPU know when to run?
Workload Distribution
Distribute some of the workload to the EDMA; let it respond to the McBSP transmit event
(interrupt) and copy data from memory to the codec (via the McBSP). Rather than servicing each
individual sample request from the McBSP, the CPU creates an entire block (or vector) of
samples, storing them into the buffer where the EDMA will read them.
Use EDMA
DSK
CPU
Buffer McBSP0
EDMA DAC
EDMA XEVT0
interrupt event
8KHz y buffersize 8KHz
EDMA
EDMAinterrupt
interrupttells
tellsCPU
CPUwhen
whento torun
run
Reduces
Reduces CPU interrupts by factor ofbuffersize
CPU interrupts by factor of buffersize
How does the EDMA work?
A: The EDMA tells the CPU when to refill the buffer with data samples. You can program the
EDMA to generate an interrupt to the CPU after every so-many transfers.
Note: When the McBSP0 (serial port 0) is ready to receive a new value to transmit it generates
the XINT0 interrupt to the CPU and the XEVT0 event to the EDMA. In the Chapter 4 we
had the CPU respond to the interrupt. In this chapter we’ll let the EDMA handle it’s
counterpart (XEVT0); the CPU will not directly respond to the interrupt.
Code Efficiency
Block processing allows the compiler to generate more efficient code. Creating multiple sine
values can be performed in a highly optimized loop. On any processor, it’s hard to create the
same efficiency when only one value is calculated.
Bottom Line
Not only is the CPU freed from data movement responsibilities (by the EDMA) and can run more
efficient (block) code, its interrupt overhead is also reduced. All of these allows the CPU to spend
more cycles working on your algorithms.
What does this really mean? The ‘C6000 DMA and EDMA peripherals can move data from one
memory location (or set of memory locations) to another. More importantly, it can do this
independent of the CPU. Why waste the CPU performing load and store instructions when we
have a peripheral to do it for you?
Also, the EDMA has a wide variety of options that can be configured. You will select these
features with control (a.k.a. option) registers.
EDMA
mem1 A0 mem2
A1
A2
A3
A4
A5
Note, if a specific interrupt event is not required, that channel may be used for any
unsynchronized memory-to-memory transfer.
QDMA
Beyond the basic 16 channels, the ‘C6711 contains one other DMA channel:
x The single-channel QDMA (quick-DMA) is programmed in a similar fashion as the EDMA.
Unlike the EDMA, it does not allow synchronization or autoinitialization. On the other hand,
it takes fewer cycles to program and runs with higher priority than the EDMA.
28 27
Options
ESIZE
Source
Transfer Count
Destination
# Frames # Elements
Index
31 16 15 0
Cnt Reload Link Addr
31 0
In our case, we will transfer one sample per McBSP interrupt event. After the Transfer Count
reaches zero, the EDMA should be programmed to:
x Signal the CPU to refill the buffer; that is, the EDMA should generate an interrupt to the CPU
x Re-initialize itself without CPU intervention
Any reload set may be used with any channel. In fact, you can create a linked-list of EDMA
transfers. In our lab, we will only use one reload set, which will be used to reinitialize the EDMA
to do the same set of transfers over-and-over again.
Configuring EDMA
Configuring the EDMA using the Chip Support Library requires setting up three data structures
(two EDMA_HANDLEs, one EDMA_CONFIG) and writing an initialization function. The
function to configure the EDMA for our example consists of six steps:
EDMA Config
Options EDMA_Handle
EDMA_Handle myEDMA,
myEDMA, myLNK;
myLNK;
Source
Transfer Count EDMA_Config
EDMA_Config myConfig
myConfig == {{
options,
options,
Destination source,
source,
Index length,
length,
Count Reload Link Addr destination,
destination,
index,
index,
31 16 15 0
reload:link
reload:link
};
};
edma_init
edma_init ()() {{
1.
1. open
open XEVT0
XEVT0 EDMA
EDMA channel
channel //// McBSP0
McBSP0 transmit
transmit event
event
2. allocate LINK parameter location
2. allocate LINK parameter location
3.
3. update
update EDMA_Config
EDMA_Config with
with LINK
LINK location
location
4.
4. configure EDMA channel & link
configure EDMA channel & link location
location
5.
5. enable
enable EDMA EDMA channel
channel
6.
6. enable EDMA interrupt
enable EDMA interrupt to
to CPU
CPU
}}
Here is the code associated with the six steps above – each line of code represents a step,
respectively.
void
void edma_init
edma_init (void)
(void) {{
hEdma
hEdma = EDMA_open(EDMA_CHA_XEVT0,
= EDMA_open( EDMA_CHA_XEVT0,EDMA_OPEN_RESET
EDMA_OPEN_RESET););
hEdmaLINK
hEdmaLINK==EDMA_allocTable(
EDMA_allocTable(-1 -1););
myConfig.rld = EDMA_MK_RLD(myLNK,0);
myConfig.rld = EDMA_MK_RLD(myLNK,0);
EDMA_config(hEdma,
EDMA_config(hEdma, &my_edma_Config);
&my_edma_Config);
EDMA_config(hEdmaLINK,
EDMA_config(hEdmaLINK,&my_edma_Config);
&my_edma_Config);
EDMA_enableChannel(
EDMA_enableChannel(hEdmahEdma););
EDMA_intClear(5);
EDMA_intClear(5); EDMA_intEnable(5);
EDMA_intEnable(5); }}
Most of the EDMA functions should be obvious, here are a few notes for the less obvious:
x EDMA_allocTable(-1) reserves one of the 69 reload parameter sets. You can pass any
number between 0 and 66 (two are reserved by CSL). Using “-1” tells the CSL to select any
available parameter set. Notice, this function returns a ‘pointer’ to the myLNK handle.
x We run EDMA_config() twice, once to setup the XEVT0 channel itself (pointed to by the
hEdma handle), the other to setup the reload parameter set (pointed to by the myLNK
handle).
x Before a channel can run, it must be enabled; hence the EDMA_enableChannel().
x When the EDMA completes it transfer (when the element count is decremented to zero), it
can interrupt the CPU.
To do this, the EDMA channel sets a bit in the CIPR (Channel Interrupt Pending
Register)
You can choose which CIPR bit you want to use, this is done with the TCC field in
the Options register
For the CPU to receive the interrupt, the chosen CIPR bit must be enabled; this is
done by setting the appropriate bit in the Channel Interrupt Enable Register (CIER);
this is done with the EDMA_intEnable() function.
You can clear a bit in the CIPR register using EDMA_intClear()
edma_HWI
Buffer McBSP
EDMA DAC
//
// Interrupt
Interrupt Service
Service Routine
Routine
edma_HWI()
edma_HWI() {{
block_sine();
block_sine();
}}
Note: While the EDMA has 16 channels, it can only send one interrupt to the CPU. Actually,
this is nice design feature since it allows TI to include additional channels on future
processors. For example, the ‘C64x EDMA has 64 channels.
If you are using more than one channel to interrupt the CPU, the CPU’s interrupt service
routine will have to read the channel interrupt pending register in the EDMA to determine
which channel caused the CPU interrupt(s).
block_sine()
DSK
edma_HWI
Buffer McBSP
EDMA DAC
short
short buffer[1
buffer[1228]
8];;
main()
main()
{{ init_EDMA();
init_EDMA(); void
void block_sine()
block_sine() {{
init_HWI()
init_HWI() for
for (i
(i == 00;; ii << 11228;
8; i+
i+++)) {{
...
... buffer[i]
buffer[i] == sineGen();
sineGen();
}} }}
}}
Cache
‘C6711 Advantage vs. Typical RISC Architecture
RISC Cache Systems
Unlike ‘C6x11, in typical RISC systems you
find internal memory is cache only
Requires external storage of peripheral data
Enhanced
External DMA
EMIF
Memory (EDMA)
Cache
Peripheral Port
On-Chip Memory/Cache
Configure as cache and/or mapped-RAM
Allows peripheral data or critical code/data
storage on-chip
Mapped
as RAM
Enhanced
External DMA
EMIF
Memory (EDMA)
Cache
Peripheral Port
Level 1 Caches
L1 Single-cycle access
Program
Always enabled
(4KB)
L2 accessed on miss
L2
Program Level 2 Memory
CPU & Data Unified: Prog or Data
L2 o L1D delivers
32-bytes in 4 cyles
8/16/32/64 (64K Bytes)
L2 o L1P delivers
L1 16 instr’s in 5 cycles
Data Configure L2 as cache
(4KB) or RAM
As discussed in Chapter 1, here is an overview of the internal memory on the ‘C6711. Remember
we stated you could configure the Level 2 memory in one of five modes:
Level 2 Configurations
Note: The initial ‘C64x devices have the same dual-level memory system except for two
modifications: one, larger L1 and L2 memories; and two, Level 2 memory have both a
fixed (always RAM) segment and a configurable (cache/RAM) segment similar to the
‘C6711.
Configuring L2 Cache
In the upcoming lab we want to place our buffer into internal memory. This requires changing our
CDB file from the standard dsk6711.cdb template. We provide a complete procedure for this
in the following lab exercise.
There are three reasons for our putting the sine buffer into internal memory:
x Internal memory is faster
x As mentioned previously, placing the buffer on-chip reduces the potential for EDMA and
CPU conflict while accessing external memory
x For better performance, values written by the CPU may be cached into the Level 1 data
memory rather than being written back out to external memory. Since the EDMA is unaware
that the buffer values have changed, the old values could be sent to the codec. There are three
methods used to prevent mistakes:
1. Place the buffer in internal memory (the one we chose for the lab). If the EDMA goes to
access the buffer, but the L1 cache contains more recent values, the EDMA is notified by
the L1 cache so that the newer values are used.
2. After writing values to be used by the EDMA, you need to flush those values from the
cache. Refer to the ‘C6000 Peripherals Reference Guide for details.
3. Mark the part of external memory where the buffer resides as non-cacheable memory.
This is accomplished using the MAR registers. Once again, please refer to the peripherals
guide for details.
LAB 5
The object of this lab is to implement the block processing example described in this chapter.
This includes using the EDMA to transfer samples from a buffer filled with a block sine
algorithm.
DSK
CPU
Buffer McBSP0
DMA DAC
EDMA XEVT0
interrupt event
Much of the code in this system is similar to that in the last chapter. For this reason (and due to
limited time), we have written much of this for you. Here are the items you are left to finish:
lab5.c #include’s
Lab 5
global variables
main() { block_sine.c block_sine()
CSL_init();
BSL_init();
codec_init();
init_HWI(); lab5.cdb HWI_INT? (edma)
edma_init();
EDMA_setChannel(); 3-way Cache
return; }
// HWI routines
init_HWI();
edma_HWI(); You get to complete:
// Codec Routines Two config struct’s
codec_init(); Three functions
codec_out();
CDB file
// EDMA routines
edma_init();
block_sine.c
/*********************************************************
* The coefficient A and the three initial values
* generate a 3KHz tone (sine wave) when running
* at a sample rate of 8KHz.
*
* Even though the calculations are done in floating
* point, this function returns a short value since
* this is what's needed by a 16-bit codec (DAC).
*********************************************************/
float y[3] = {0,0.7071,0};
float A = 1.4142;
short sineGen(void) {
short temp;
y[0] *= 32000;
temp = (short)y[0] & 0xFFFE;
return(temp);
}
Lab5.c
/**************************************************************\
* This file contains all the functions for Lab4 except
* sineGen(). Most of it has already been written for you due
* to the limited time available in a one-day workshop.
*
* We have left a few "???" places, though, where you must enter
* the appropriate C code. Have fun!
\**************************************************************/
/**************************************************************\
* Prototypes
\**************************************************************/
//void codec_out(void);
void codec_init(void);
void init_HWI(void);
void emif_init(void);
void edma_init(void);
void myEdma_HWI(void);
/**************************************************************\
* Include files
\**************************************************************/
#include <c6x.h> // C6000 compiler definitions
#include <std.h>
#include <log.h>
extern far LOG_Obj myLog;
/**************************************************************\
* Declarations
\**************************************************************/
#define BUFF_SIZE 64
/**************************************************************\
* Global variables
\**************************************************************/
short buffer[BUFF_SIZE];
MCBSP_Handle hCodec_mcbsp; /* McBSP handle */
/**********************************************************\
* The following AD535 Handle and Config structure were
* entered verbatim from the BSL documentation. The config
* values are common to many applications; if nothing
* else, they make a good starting point.
\**********************************************************/
AD535_Handle hAD535;
AD535_Config my_AD535_Config = {
AD535_LOOPBACK_DISABLE,
AD535_MICGAIN_OFF,
AD535_GAIN_0DB,
AD535_GAIN_0DB
};
/**********************************************************\
* Handles act as pointers to the EDMA channel and its
* reload (i.e. link) parameters
\**********************************************************/
EDMA_Handle hEdma, hEdmaLINK;
/**********************************************************\
* The "EDMA Config" type data structure holds the
* parameters to be programmed into a EDMA channel.
* Register Make (RMK) macros build a 32-bit unsigned int;
* below it is used to build the Options (OPT) register.
* The OF macros provide the proper typecasting needed for
* the EDMA Config data structure.
\**********************************************************/
EDMA_Config my_edma_Config = {
EDMA_OPT_RMK(
EDMA_OPT_PRI_LOW,
EDMA_OPT_ESIZE_??BIT, // Hint, how many bits wide is the codec?
EDMA_OPT_2DS_NO,
EDMA_OPT_SUM_INC,
EDMA_OPT_2DD_NO,
EDMA_OPT_DUM_NONE,
EDMA_OPT_TCINT_YES,
EDMA_OPT_TCC_OF(5),
EDMA_OPT_LINK_YES,
EDMA_OPT_FS_NO
),
EDMA_SRC_OF(??????), // Where's the data come from?
EDMA_CNT_OF(BUFF_SIZE),
EDMA_DST_OF(0),
EDMA_IDX_OF(0),
EDMA_RLD_OF(0)
};
/**************************************************************\
* Main Routine
\**************************************************************/
void main()
{
CSL_init(); // Initialize CSL library
BSL_init(); // Initialize BSL library
emif_init(); // Dummy function - see below
block_sine(buffer, BUFF_SIZE); // Run once to init the buffer
codec_init();
init_HWI();
edma_init();
/**************************************************************\
* Configure External Memory Interface (EMIF)
*
* We have a dummy function here to setup the EMIF. In a "real"
* system you would be required to setup the EMIF but in our
* development system CCS sets up the memory for us (refer to
* the DSK6211_6711.gel file for the CCS script that
* accomplishes this task.
\**************************************************************/
void emif_init(void){
}
/*************************************************************\
* Initialize hardware interrupts.
**************************************************************
* Since the EDMA is writing to the McBSP, it will be triggered
* by the McBSP's event/interrupt.
*
* The CPU will be triggered by the EDMA. When the EDMA finishes
* writing a buffer of data, it will interrupt the CPU. In
* effect, telling the CPU to re-fill the buffer with sinewave data.
*
* By default, the CDB file already has HWI8 mapped to the
* EDMA interrupt. While you can change this, we recommend
* that you use the default.
*
* Enabling the CPU to recognize the EDMA interrupt requires:
*
* 1. Using the CDB file, map EDMA interrupt (IRQ_EVT_EDMAINT)
* to interrupt 8 (HWI8). Also, update the CDB file with the
* HWI function name "_myEdma_HWI"
* 2. Enable interrupts globally
* 3. Enable EDMA interrupt (IRQ_EVT_EDMAINT)
\*************************************************************/
void init_HWI(void)
{
IRQ_globalEnable(); // Enable ints globally
IRQ_enable(IRQ_EVT_???????); // Enable EDMA interrupt (to CPU)
}
void myEdma_HWI(void)
{
/* Clear the CPU interrupt pending bit in the EDMA */
EDMA_????????(5);
/**********************************************************\
* Initialization Functions
\**********************************************************/
void codec_init()
{
/* Use the BSL routines to: Open, reset, & config the AD535 *\
* Part of the AD535_open() routine opens and configures the McBSP0, since *
\* all communications with the AD535 codec are handled via the McBSP0. */
hAD535 = AD535_open(AD535_localId); // Open AD535 and set hAD535 handle
AD535_reset(hAD535); // Reset AD535
AD535_config(hAD535, &my_AD535_Config); // Configure AD535
/**************************************************\
* When writing to the McBSP using the EDMA you
* must supply a destination address.
*
* This is usually obvious, but in the case of using
* the AD535 BSL to choose and configure a McBSP, you
* are abstracted from the actual hardware registers.
*
* How can we access the destination register from
* whatever McBSP the AD535 routine is using?
*
* This is what the "get McBSP handle" function is
* used for. It returns the handle to the McBSP used
* by the AD535 codec. With the McBSP handle you may
* use the McBSP CSL functions.
\**************************************************/
hCodec_mcbsp = AD535_getMcbspHandle(hAD535);
/********************************************************************\
* The McBSP "FREE" bit allows it to continue running even
* when the debugger is halts the CPU.
*
* A take home lab has you explore the effect of this McBSP feature.
\********************************************************************/
// MCBSP_setfree(0);
}
void edma_init()
{
// Which EDMA event are we interested in?
// Hint 1: look up EDMA_open in CSL Reference Guide
// Hint 2: we want the Xmit EVenT 0 (XEVT0)
hEdma = EDMA_open( ????_???_?????, EDMA_OPEN_RESET );
hEdmaLINK = EDMA_allocTable( -1 );
my_edma_Config.dst = MCBSP_getXmtAddr(hCodec_mcbsp);
my_edma_Config.rld = (my_edma_Config.rld & 0xFFFF0000) | (EDMA_RLD_RMK(0,hEdmaLINK)) ;
Open Project
1. Open the project LAB5.PJT . within CCS.
In the interest of time we have pre-built most of this project for you. The project should
contain the following files:
2. Set the project options. To make this easier, we have placed the compiler options in the text
file <lab5_compiler_options.txt> found in your lab folder, for you to cut-and-paste.
Compiler: -iC:\ti\c6000\dsk\include (where to find DSK headers)
-iC:\c60001day\ti\preliminary_bsl\include (BSL headers)
-dCHIP_6711 (tells CSL which chip you’re using)
-dBOARD_6711DSK (tells BSL which board you’re using)
4. Open LAB5.CDB and open (expand) the HWI module in the Configuration Tool. (We
created the CDB file and added it to the project but other than that, we didn’t modify it.)
Once again, examine HWI_INT4 – HWI_INT15. This time, look for the EDMA interrupt.
_myEdma_HWI
b. Tell the Config Tool to use the interrupt dispatcher routine provided by CCS to handle all
the hardware interrupt context save/restore operations.
; Use Dispatcher
Click “Apply”
Space to “code/data”
8. Finally, make one last change to the MEM – Memory Section Manager dialog:
a. Right-click on MEM – Memory Section Manager and choose Properties.
b. Finally, tell the config tools to locate the C global variables (.bss) in internal memory
void init_HWI(void)
{
IRQ_globalEnable(); // Enable ints globally
IRQ_enable(IRQ_EVT_ ??????? ); // Enable EDMA interrupt
}
Hint: You may want to refer to the CSL API Reference Guide IRQ chapter (page 11-14).
For your convenience, the CSL Guide is available at:
C:\ti\docs\pdf\SPRU401b.pdf
EDMA Functions
Along with the edma_HWI() interrupt service routine (step 3), you also need to complete the
EDMA initialization routine.
EDMA Initialization
11. Scroll up to the global variable initialization in LAB5.C to find the global EDMA
configuration structures. Replace the ???.
The EDMA_OPT_RMK is a Register MaKe macro. This macro allows you to intuitively
define the settings for the Options register in an EDMA configuration. The various register
fields and their values are described in Appendix B of the CSL API Reference Guide. (Hint,
you want to look at the bottom of page B-23.)
EDMA_Config my_edma_Config = {
EDMA_OPT_RMK(
EDMA_OPT_PRI_LOW,
EDMA_OPT_ESIZE_ ?? BIT, // Hint, how wide is the data?
EDMA_OPT_2DS_NO,
EDMA_OPT_SUM_INC,
EDMA_OPT_2DD_NO,
EDMA_OPT_DUM_NONE,
EDMA_OPT_TCINT_YES,
EDMA_OPT_TCC_OF(5), // Í Notice, here’s the TCC value
EDMA_OPT_LINK_YES,
EDMA_OPT_FS_NO
),
EDMA_SRC_OF(??????), // Where does the EDMA move the data from?
EDMA_CNT_OF(BUFF_SIZE),
EDMA_DST_OF(0),
EDMA_IDX_OF(0),
EDMA_RLD_OF(0)
};
12. Finally scroll down to the edma_init() function to replace the ??? two code entries with the
appropriate C code.
a. Open channel:
/******************************************************\
* Initialize the EDMA to transfer the next buffer
* of sinewave samples to the AD535 codec.
\******************************************************/
void edma_init()
{
// Which EDMA event are we interested in?
// Hint 1: look up EDMA_open in CSL Reference Guide
// Hint 2: we want the Xmit EVenT 0 (XEVT0)
hEdma = EDMA_open( ????_???_????? , EDMA_OPEN_RESET );
The EDMA initialization makes extensive use of the CSL libraries. While there are still a few
steps to initialize synchronized EDMA transactions, this is much easier than hand-coding the
various register bits required to enact the EDMA.
If you only want to move a block of data from one location to another with the DMA, try
using the CSL’s DAT module, which provides a simple non-synchronized transfer.
End of Exercise
// MCBSP_setfree(0);
Optional Topics
Chip Support Library - DAT Module
The CSL’s DAT module is unique to the CSL. It’s a device independent method of copying or
filling memory. The device independence makes is easily portable from ‘C6711 to ‘C6201, or
even to a ‘C5000 device.
CSL: DAT
Functions
DAT_Close
DAT_Copy
DAT_Fill
DAT_Open
DAT_Wait
DAT_Copy2D
Features
High-level API for non-sync’d block move
Processor independent (DMA or EDMA)
When you specify to CSL which chip you are using (with the –dCHIP compiler option), the
correct CSL library code is used to make the transfer/fill. It might use the DMA or EDMA,
whichever peripheral is on a given device.
Single Buffer
DSK
CPU
Buffer McBSP0
DMA DAC
EDMA XEVT0
interrupt event
8KHz y buffersize 8KHz
Used
Usedin
inthis
thischapter
chapterand
andlab
labexercise
exercise
Reduces
ReducesCPU
CPUinterrupts
interruptsby
byfactor
factorof
ofbuffersize
buffersize
What might be better?
While this worked well in this simple application, it does have its drawbacks. Namely, if the CPU
cannot respond to the interrupt quickly enough to fill the single buffer before the EDMA starts to
copy new values to the codec, a real-time error will occur.
This error can often be eliminated by adding a second buffer to the system. In this way, the CPU
can fill one, while the EDMA is using the other. This is shown below:
Double Buffer
DSK
Buffer
McBSP
DMA DAC
EDMA XEVT0
interrupt event
Why
Whyuse
usedouble
doublebuffers?
buffers?
Allows
AllowsCPU
CPUto tobe
bebusy
busydoing
doingother
otherprocessing
processingandanddelay
delay
servicing
servicingthe
theEDMA
EDMArequest
request
Very
Veryuseful
usefulfor
forcomputationally
computationallyintensive
intensivealgorithms
algorithms
During ISR, CPU switches its pointers
During ISR, CPU switches its pointers
EDMA
EDMAhandles
handlesitsitsown
ownpointer
pointerswitch
switchwith
withLINKing
LINKing
Creating a double-buffered system would be a good next challenge for you to try at home.
E1 Line ‘C6000
Tx DX
Tx Line I/F Unit
Framer Rx DR
Rx (LIU) Clk CLKX
FS CLKR
- surge suppression - error condition FSR
- analog “stuff” - frame sync gen FSX
- clock extraction
FSR/X
Multi-channel Operation
F
r
a Frame 3 Frame 2 Frame 1
m 4 3 2 1 4 3 2 1 4 3 2 1
e
r Memory
1
3
M
c
1
B 3
S ..
Allows multiple channels (words) to be P .
independently selected for transmit and 1
receive
3
Combined with the DMA’s flexibility ...
F
r
a Frame 3 Frame 2 Frame 1
m 4 3 2 1 4 3 2 1 4 3 2 1
e
r Memory
1
1
M
c
E 1
D ..
B
S
M .
A
P
3
EDMA’s flexible (indexed) addressing 3
allows it to sort each channel into
separate buffers! 3
Learning Objectives
DSP/BIOS
Real-time Scheduling
Simple example of real-time problem
HWI, SWI, and TSK
Scheduler
DSP/BIOS II adds multi-tasking
Real-time analysis (RTA)
Module Topics
Introduction to DSP/BIOS ........................................................................................................................ 6-1
Real-Time Scheduling
The Challenge
To: Engineering
From: Marketing
Re: Design Spec Change
Due to customer request, we
need to add DTMF functions to
the Audio Player ASAP!!!
Cannot increase system cost !!!
Previous Requirement
Filter
DSP filters audio signal
Traditional Solutions
System Implementation Considerations
Timer1_ISR running
{ A
idle
A
}
B
Timer2_ISR
{ Time 0 1 2 3 4 5 6 7
B
}
TI DSP Only one can run at a time...
{ A y1 y2 y3 y4
idle
A
}
B
Timer2_ISR
{ Time 0 1 2 3 4 5 6 7
B
}
TI DSP There are two elements of CPU loading:
average & instantaneous
Nested Interrupts
A common solution is to allow hardware
interrupts to preempt each other - called
main 'nesting' interrupts
{ running
while(1); A
} idle
Timer1_ISR B
{
A Time 0 1 2 3 4 5 6 7
}
Problem is, the user must handle all context
Timer2_ISR save and restore
{ While reasonable for 1-2 interrupts, it
B becomes tedious and trouble-prone for more
} Can become near impossible when using
TI DSP object-coded algorithms or libraries
(thus, making it difficult to purchase algo's)
DSP/BIOS handles this for you with simple
drag -n- drop editing
if … A y1 y2 y3 y4
idle
A
B B1 B2 B3
else if
if …
B (part 1) Time 0 1 2 3 4 5 6 7
else if ...
B (part 2) Difficult and tedious to write - Need to keep
else … track of various execution times and paths
through software
B (part 3)
Difficult to maintain - Code is too tightly coupled
... to allow any changes or updates
} Can be slow and large - Conditional
statements lead to branching operations and
disruptions in normal software flow
DSP/BIOS Solution
The DSP/BIOS Solution
DSP/BIOS provides scheduling:
You needn’t build a custom (inflexible)
main state-machine for each DSP design
{
Instead, you can leverage 1000’s of hours
return; of development, proven in 100’s of systems!
}
running
ªDSP/BIOS A
idle
A
B
B
Time 0 1 2 3 4 5 6 7
h/w INT
HWI and SWI
HWI:
urgent code
post SWI
SWI (or TSK)
SWI 2
return
SWI 1
return interrupt
main()
IDL
interrupt
SWI Properties
Task’s (TSK)
DSP/BIOS Thread Types
HWI Used to implement 'urgent' part of real-time event
Triggered by hardware interrupt
Hardware Interrupts HWI priorities set by hardware
start
SEM_pend Pause
“run to (blocked
completion” state)
start
end end
SWI 2
return
TSK 1
interrupt interrupt
main()
return
IDL
Real-Time Analysis
Background
Why is printf() used?
printf
printf (“
(“I'mm aa wasteful
I' wasteful function
function == %%
d\n”
d\ ,i+
n” ++
,i+);
);
USER CODE
EMU H/W
IEEE
RTDX
User
JTAG
CCS TI
3rd Party
MS
Third COM
Party
Display
LOG_printf (LOG)
LOG_printf
Call LOG_printf
#include External reference
#include <<
std.h>
std.h> to LOG object
#include <log.h>
#include <log.h> defined using the
configuration tool
extern
extern far
far LOG_Obj
LOG_Obj myLog;
myLog;
Call the function
LOG_printf(&myLog,
LOG_printf(&myLog,“New
“Newload
load==%d000
%d000instructions”,
instructions”,loadVal);
loadVal);
Run-time display of
user-defined LOG
Statistics (STS)
Built-in Statistics Tools
Execution Graph is useful for visualization of thread scheduling
Statistics give you finer detail to profile thread execution
Is the thread meeting its real-time deadline?
#include
#include <<
std.h>
std.h> Reference the STS
#include
#include <<
sts.h>
sts.h> object
extern
extern far
far STS_Obj
STS_Obj myStat;
myStat;
Monitor the variable
STS_add(&myStat,
STS_add(&myStat, your_variable);
your_variable); “amplitude”
Run-time display of
user-defined LOG
Visual Instrumentation
Viewing System Events
PRD_Ticks
PRD_Ticksis
isbased
basedon
on aa
‘C6211
‘C6211timer.
timer.
(hence
(henceit’s
it’stime
timebased)
based)
Each
Each tick
tick represents
representsan
an
event
event has
has occurred.
occurred.
(not
(nottime
timebased)
based)
Features Benefits
Small Footprint (<2Kw) Easily fits in limited memory systems
Fast Execution Ideal for real time systems
Real-Time Analysis View system parameters
while system is executing without
breakpoints and without additional
overhead - “Test what you fly and fly
what you test”
Set of Library Functions Use only what you need to minimize
footprint
Extensible Full featured kernel allows additional
OS functions in future
Lab 6
This exercise adds a SWI to the results of Lab 4. This involves creating a SWI object using the
Configuration Tool, referencing it at the beginning of Lab 6, then posting the SWI in the McBSP
hardware interrupt service routine.
Lab 6
lab6.c #include’s sine_float.c sineGen( )
extern far SWI_Obj
global variables
main( ) {
CSL_Init(); lab6.cdb HWI
BSL_init(); 9: _XINT0_HWI
codec_init();
init_HWI(); SWI
AD535_write(hAD535, 0); codec_swi: _codec_out
return;
}
// HWI routines
init_HWI();
XINT0_HWI;
You get to
// Codec Routines
complete these
codec_init();
codec_out();
A second exercise, Lab 6a, uses LOG_printf to output the sine values to CCS in real-time.
lab6.c
/**************************************************************\
* This file contains the main function for Lab6. Most of it
* has already been written for you due to the limited time
* available in a one-day workshop.
*
* We have a few "???" places, though, where you must enter
* the appropriate C code. Have fun!
\**************************************************************/
/**************************************************************\
* Prototypes
\**************************************************************/
void codec_out(void);
void codec_init(void);
void init_HWI(void);
void emif_init(void);
short sineGen(void);
/**************************************************************\
* Include files
\**************************************************************/
#include <c6x.h> // C6000 compiler definitions
#include <std.h>
#include <log.h>
#include <???.h> /* What DSP/BIOS module are we using? */
/**************************************************************\
* Global Variables
\**************************************************************/
/**********************************************************\
* The following AD535 Handle and Config structure were
* entered verbatim from the BSL documentation. The config
* values are common to many applications; if nothing
* else, they make a good starting point.
\**********************************************************/
AD535_Handle hAD535;
AD535_Config my_AD535_Config = {
AD535_LOOPBACK_DISABLE,
AD535_MICGAIN_OFF,
AD535_GAIN_0DB,
AD535_GAIN_0DB
};
/**************************************************************\
* Main Routine
\**************************************************************/
void main()
{
CSL_init(); // Initialize CSL library
BSL_init(); // Initialize BSL library
emif_init(); // Dummy function - see note below
codec_init();
init_HWI();
/**************************************************\
* Rather than creating an infinite loop in main,
* DSP/BIOS provides an infinite idle (IDL) loop.
* All you need to do is return from main.
*
* // while(1) {};
\**************************************************/
return;
}
/**************************************************************\
* Configure External Memory Interface (EMIF)
*
* We have a dummy function here to setup the EMIF. In a "real"
* system you would be required to setup the EMIF but in our
* development system CCS sets up the memory for us (refer to
* the dsk6xinit.gel file for the CCS script that accomplishes
* this task.
\**************************************************************/
void emif_init(void)
{
}
/*************************************************************\
* Initialize hardware interrupts.
**************************************************************
* The AD535 codec is hardwired to McBSP0. Therefore,
* our system uses the McBSP0 transmit interrupt
* (XINT0) to signal when to write the next output sample.
*
* Enabling the CPU to recognize the XINT0 interrupt requires:
*
* 1. Map McBSP0 transmit interrupt (XINT0) to interrupt 9 (HWI9)
* using the Config Tool
* 2. Enable interrupts globally
* 3. Enable McBSP transmit interrupt
\*************************************************************/
void init_HWI(void)
{
IRQ_globalEnable(); // Enable ints globally with BIOS function
IRQ_enable(IRQ_EVT_XINT0); // Enable McBSP0 using CSL function
}
/**************************************************************
* Interrupt service routine you need to reference in HWI
* module of CDB file
**************************************************************/
void XINT0_HWI(void)
{
/**************************************************************
* In past labs we called codec_out() from this ISR function.
* (codec_out() creates sine sample for each XINT0 interrupt?
* Here we replace the codec_out() function call with a
* SWI post to the codec_out() function. The SWI object is
* (or, at least, should be) setup in the LAB6.CDB file.
* When posted and run, the SWI calls the codec_out() function.
**************************************************************/
SWI_????(&codec_swi); // What function triggers an SWI to run?
}
/**********************************************************\
* Codec Functions
\**********************************************************/
void codec_init()
{
/* Use the BSL routines to: Open, reset, & config the AD535 */
/* First, open AD535 and set hAD535 handle */
hAD535 = AD535_open(AD535_localId);
/* Reset AD535 */
AD535_reset(hAD535);
/* Configure AD535 */
AD535_config(hAD535, &my_AD535_Config);
}
/******************************************************\
* Output a sine sample from the function SineGen()
* to the AD535 codec.
\******************************************************/
void codec_out(void)
{
AD535_HWI_write(hAD535, sineGen());
}
lab6.c
lab6.cdb
lab6cfg.cmd
sine_float.c
Create SWI
As discussed in Chapter 6, rather than running the whole algorithm inside the HWI (interrupt
service routine), we’ll change the HWI to post a SWI. Before we modify the HWI, though, let’s
create the SWI with the Configuration Tool.
4. Now that you’ve created the SWI you need to change the function called by it. Right-click on
the new codec_swi and choose Properties. Change the function name to _codec_out.
5. Close the SWI properties dialog box. Save and close the CDB file.
void XINT0_HWI(void)
{
Again, replace the ??? so that the HWI routine post’s the SWI you made earlier.
10. Similar to the CPU Load Graph, open the DSP/BIOS, then Execution Graph. When it
appears, you can reposition, resize, and/or undock it as desired.
11. Before the Execution graph displays results, though, we must tell the processor to send CCS
real-time analysis data. This can be done using the RTA
control panel.
12. Once open, select enable SWI logging and global host
enable.
Once enabled, you should begin to see the Execution Graph
begin updating.
13. Halt the processor.
For Lab 6a, it’s OK to continue using the same Lab 6 project files. (For easier reference, though,
we have created separate solution folders for each lab.)
sine_float.c
//#include <stdio.h>
short sineGen(void) {
y[0] = (short)(32000*y[0]);
return((short)y[0]);
}
14. Open sine_float.c and remove the comments (the // marks) from the two lines
associated with printf.
15. Rebuild, reload program, and run the program.
Using LOG_prinf
With the real-time limitations of printf demonstrated, let’s replace it with the LOG_printf. First,
create the LOG object, then edit the sine_float.c.
16. Open LAB6.CDB (in the DSP/BIOS Config folder) and right-click
on LOG – Event Log Manager and choose Insert Log.
17. Rename the new LOG to sine_log.
sine_float.c
//#include <stdio.h>
/* DSP/BIOS headers */
#include <std.h>
#include <log.h>
short sineGen(void) {
y[0] = (short)(32000*y[0]);
return((short)y[0]);
}
// #include <stdio.h>
// printf("Sine Output = %f\n", y[0]);
Then add the LOG_printf statements and references. As shown above in bold, add these four
lines of code:
#include <std.h>
#include <log.h>
extern far LOG_Obj sine_log; */
x When the Message Log window opens, select sine_log (if it’s not already showing).
Note: You can open the Message Log window before or after you have started the program
running.
22. Start running the program. In a few seconds you should see sine values displayed in the
Message Log window.
23. Halt the processor.
29. Add the load.c file to your project. Open it to see the _myLoad function we have created.
32. Notice that loadFactor equals 15. This is a multiplier in our load.c program.
38. Rebuild, reload program, and run again. Does it sound OK? __________________________
Notice that now the Execution Graph shows the codec_out function preempting the
PRD_swi. (In our example, we have loadFactor = 25.)
39. When you’re finished experimenting, close Code Composer Studio and power-cycle your DSK.
Lab 6c
1. Open Code Composer Studio, if it’s not already open.
2. Load the program LAB6C.OUT from C:\C60001day\labs\lab6c\Debug.
File:Load Program…
File:Workspace:Load Workspace…
Navigate to C:\C60001day\labs\lab6c and open LAB6C.WKS.
The workspace loads the project and sets up the necessary RTA windows.
Excel
RTDX transfer of filter
coefficients from Excel
spreadsheet to running
RTDXlab.xls ‘C6000 program
DSK
in C6000 out
buffer buffer
5. When the next dialog box comes up, change the install directory to C:\C60001day\keypad.
Ҏ
6. Click on the following icon to install the plugin.
File:Load Program…
C:\C60001day\labs\lab6d_rtdx\Lab6d\lab6d.out
Tools:DTMF Keypad
Note: Your .out file needs to be loaded on the target before you open the plugin. Otherwise,
you will get an error.
Setting Up RTA
10. Open a message log window to see the output of the logTrace buffer.
11. In addition to the LOG and STS information that you have seen so far, RTA also provides
some inherent or embedded information gathering that you can use to understand your
system. One of these capabilities calculates the load on the CPU, the CPU Load Graph.
Running Code
12. Skip to the main function.
Debug:Go Main
Note: It is nice to hear the digits, but it is hard for most people to tell if it is really the correct
digit, or just some random tones. You will be able to tell if the encoder is actually
working when we add a DTMF Decoder as well. I bet you can’t wait for that!
15. What is the load on the CPU while running the audio application with a DTMF Encoder?
___________________________________________________________________________
Setting Up RTDX
16. Now that we have everything setup and loaded onto the target, you need to enable the RTDX
server on the PC, inside CCS. Enable the RTDX server:
Tools:RTDX:Configuration Control
This should bring up the following dialog box:
18. Open the channel configuration to to enable the input channel that you created.
19. Click in the checkbox next to ichan to enable the input channel.
22. Click Enable Macros in the following dialog box when it comes up.
23. The spreadsheet that comes up has five columns of coefficients that you can send to the DSP
and an on/off switch for the filter. The yellow colum is the currently selected column. Try
clicking on the on/off switch to see what happens.
Do you hear anything different? ________________________
Notice that the currently selected column of coefficients is for an all pass filter, so you
shouldn't hear any difference. So, how do you know if RTDX is even working?
24. To truly test the application, try clicking on the High Pass column heading, which looks like a
grey button. After a slight delay while the data is being sent to the DSP, you should definitely
hear a difference in the music.
25. Click on some of the other filter coefficients to hear the difference among them. Pretty cool,
huh!
26. If you still have some time left, you can take a look at the Visual Basic for Applications code
that is being run from Excel. In Excel, do the following to see the code.
Note: If you are still interested in more RTDX info, there is a great RTDX tutorial included in
CCS. Choose Tutorial under Help for more information.
Shut down
27. Close Excel and when prompted to save your changes, click No.
Background Info
RTDX - How It All Works
Real-Time Data Exchange (RTDXTM) is a standard, real-time data transfer technology that
provides continuous visibility into the way target applications operate. RTDX provides significant
benefits over alternative methods of system debugging by providing standard, open, real-time
communications, without consuming target system peripheral resources. Target and Host
Application Program Interfaces (APIs) provide a rich set of communication tools to enable
seamless bi-directional communications.
#include <rtdx.h>
Next we build the RTDX channel data structure by using the Create Input Channel Macro (in the
data declaration section of the application):
RTDX_CreateInputChannel(ichan);
We enable the channel as an input to the DSP from the host (from within main() ):
RTDX_enableInput(&ichan);
Finally, in the background task loop we read the input channel without blocking (waiting for the
result) and then we loop to see if the data has arrived, polling the RTDX interface, via
RTDX_Poll, in the interrupt service routine.
while ( RTDX_channelBusy(&ichan) )
For a more detailed discussion of the RTDX Target API, see Help Æ Tools Æ RTDX from
within Code Composer Studio.
and from a client program. The RTDX lab uses the continuous mode of operation to send data
from Excel, a host COM client application, to the target DSP.
To enable communications from within Code Composer Studio, you need to define the channel
and communications protocol via the RTDX plug-in as we did earlier in the lab instructions.
Excel Client
For this RTDX lab we have used Excel as a host client application. With the introduction of
Visual Basic for Applications (VBA) Microsoft has enabled all Microsoft Office applications
programmable and COM capable. Excel provides an excellent demonstration platform as we can
use the spreadsheet and graphics capabilities to view the frequency response of the FIR filter and
we can use the Macro (VBA) facilities to communicate with RTDX.
Excel stores applications as workbooks with individual worksheets available within the
workbooks. This example uses the RTDX lab worksheet to communicate with the RTDX target
application. Other worksheets are provided to graph the frequency responses of the filters. (Click
on the tabs in the lower left to navigate through the worksheets.)
The RTDX COM interface is handled via a VBA macro. To access the macro capability of Excel
select:
This brings up a dialog box with the names of the macros associated with this workbook. To view
the RTDX communications macro, select the ‘host write’ (h_write) macro and click edit. [Note:
double clicking on the macro executes the macro.] This brings up the VBA project environment,
with the h_write macro in the editor.
VBA is an object oriented language and requires familiarity with Object Oriented Programming
practices. (See Visual Basic help for more information.)
To access RTDX with VBA we use the following process: first, we declare an RTDX input
channel object: (We are using rtdx_ichan as the name to help us remember the target channel
name and avoid confusion with other potential host RTDX channel input or output objects.)
Next, we create the input channel rtdx_ichan. (Input is from the DSP’s perspective):
We open the channel, ichan, for writing, W, and verify that we opened a valid channel
(VerifyStatus is another VBA macro used to check the status of RTDX return codes. You can
view the VerifyStatus macro by scrolling down in the editor as it is the next macro in the list):
We build the message here. (View the macro to see the data).
status = rtdx_ichan.StatusOfWrite(bufferstate)
status = rtdx_ichan.Close()
For more information on VBA application development view Help Æ Tools Æ RTDX in
Code Composer Studio.
Excel Buttons
Excel provides the ability to create objects and connect these objects to Macros. The buttons in
the RTDX lab were created by right clicking on any of the tool bars, selecting ‘Forms’ and
clicking the ‘Button’ icon. A cross hair cursor lets you click and hold on the screen to start
drawing the button and then drag and release the box at the desired size The Macro list is then
displayed, where you can assign any available macro to the button.
Summary
RTDX provides a simple, proven, standard interface for sending data to and from the DSP
application, in real-time, without stopping the target. This capability is provided with Code
Composer Studio and requires no additional support.
As you can see, Excel, as one of many RTDX capable host side applications, provides a powerful
and flexible client application to develop RTDX clients quickly and easily.
Today’s Agenda
Agenda
Overview Hello, TI DSP, ‘C6000
DSK Tour of ‘C6711 DSK
C Code Code Composer
System 1. McBSP, Interrupts
2. EDMA, Cache
DSP/BIOS Real-Time Tools
VAB Visual Design
Epilogue What Next?
T HE WORLD LEADER IN DSP SOLUTIONS
Module Topics
Visual Design.............................................................................................................................................. 7-1
Sets Frequency
Sets Frequency
PC
PC and
and DSP (Real-Time)
(Real-Time) component blocks
blocks
PC
PC (white)
(white)
DSP
DSP (yellow)
(yellow)
PC
PC blocks
blocks aid
aid in rapid
rapid system
system design
design
Current
Current value
value used
used when
when generating
generating .out
.out file
file
Other Features
Hierarchical
One worksheet can become a block in a second worksheet
Block Wizard
Create your own block, if you can’t find a pre-built one that
meets your needs
Creates C template for coding in CCS
Also creates PC icons for VAB
Optional Feature:
If you want the PC components in your design, a stand-alone
(.EXE) application can be generated from Hyperception tools
VAB Details
VAB for ‘C6000
VAB for ‘C6000
$1495 US, P/N HSWN1060
VAB also available for other TI DSP families
Workshop CD-ROM contains VAB demo
Same version installed on workshop computers
Some capabilities have been disabled (incl Save/Print)
Purchase KEY to full version by phone
Lab 7
Lab 7
Build a simple sine output (5 mins)
Build a DTMF output (> 5 mins)
Examine included examples
Go ahead and select OK. (Note, you cannot turn-off the tips with the demo version of VAB.)
Note: If you do not see the toolbars (as in the above figure) and/or the examples do not appear
in the dialog box (as in step 2), then the VAB installation is incomplete. This most often
occurs when VAB is installed by an administrator on a Windows NT machine. The
toolbars and example features are added to the administrators profile, by the user’s profile
is left unchanged.
If this has happened to your lab workstation, you can fix this quickly.
a. Close VAB.
b. Open c:\c60001day\labs\lab7 and double-click on VAB6000.reg.
(If it asks you if you really want to modify the registry, say OK. This file only adds the
necessary items to the Hyperception key. Nothing else is modified or deleted.)
c. Begin with step 1 of the lab, again.
2. Next you will see the Examples dialog. Select Cancel as shown below.
First we will build a simple example on our own. Afterwards, we will show you how to get
back to this dialog.
3. Now click the New Worksheet toolbar button.
New Worksheet
5. It’s easiest if you arrange the two icons in left to right data-flow fashion.
Data Connector
Go Stop
8. You should hear the sinewave.
9. If not, the frequency may need changing. Right-click on the sine block to open it.
If the Frequency isn’t in the 500 to 3500 KHz range, try changing it to something like 1300
KHz as shown above.
You can even change frequencies on-the-fly – without stopping VAB.
13. Next, using the connect tool, connect both SINE blocks (outputs) to the ADD block (inputs).
(Remember, you need to click in the middle of the block to make a connection.)
14. Then connect from the ADD to the DSK D/A block.
15. Hit GO again and you should hear a Dual Tone.
(We’ll look at a more advanced example of this in a minute.)
Control
Connector
Note, to connect to the KNOB block, click between the circle and outer box of the block.
When you make the control connection, VAB asks which variable you want to control.
This contains an Arbitrary Filter block that allows you to configure a filter clicking-and-dragging
the filter line with your mouse.
20. DTMF is another interesting example. You can find it under the DSP tab in the same dialog
where the arbitrary filter example was found.
21. When you are finished, you can close Visual Application Builder.
The full version of VAB includes the ability to create your own blocks using Code Composer
Studio and either Hyperceptions Block Wizard or eXpressDSP Component Wizard.
Note: The VAB installation adds a convenient desktop toolbar. This is an easy way to start
VAB. If you find the toolbar in your way though, you can easily close it and/or remove it
from your startup folder by right-clicking on the toolbar and choosing the from the popup
menu.
Introduction
Workshop Agenda
Learning Objectives
Outline
‘C6000 Family and New Devices
Imaging TDK
eXpress DSP Software Platform
Where to get more info
K-Base (FAQ), PIC
Workshops
DSP Village
Where to get printed literature
DSP textbooks
Wrap Up
Module Topics
Epilog - Where to go From Here .............................................................................................................. 8-1
‘C6000 Devices
‘C6000 Roadmap
Software Compatible
Floating
Floating Point
Point
Multi-core
Multi-core C64x™
C64x ™ DSP
DSP
1.1
1.1 GHz
GHz
Performance
2nd Generation
C64x™
C64x ™ DSP
DSP
General
Purpose C6414
C6414 C6415
C6415 C6416
C6416
t ce Media 3G Wireless
1st Generation es an Gateway Infrastructure
i gh orm
H rf
C6203 Pe
C6204 C62x™
C6202
C6201 C6205
C6211 C67x™
C6701 C6711 C6712
Time
‘C6414
‘C6415
TMS320C6415 Adds New Networking
Interfaces to the World’s Highest Perf. DSP
TMS320C6415 DSP
PCI Flexible PCI or HPI32
or host connection
L1P Cache Direct Mapped
HPI32 16K Bytes Total z 33 MHz/32-bit
GPIO8 connectivity for
L2 Cache/Memory
or Instruction Dispatch
Registers communications
Interrupt Control
McBSP 2 In-Circuit
Instruction Decode Emulation
Data Path 1 Data Path 2
EMIF 64 Utopia 2 ATM
A Register File B Register File
connection
EMIF 16
L1 S1 M1 D1 D2 M2 S2 L2
z 50 MHz wide area
McBSP 0 network connectivity
McBSP 1
GPIO16 L1D Cache 2-Way Set Associative Pin compatible with
16K Bytes Total C6414 DSP
Timer 0 z Object code
Timer 1 compatible with all
JTAG Power PLL C6000TM DSPs
Timer 2 RTDX Down
Logic
‘C6416
TMS320C6416 DSP: Customized
For 3G Wireless Infrastructure
TMS320C6416 DSP Viterbi Coprocessor
(VCP)
VCP
L1P Cache Direct Mapped Supports >500 voice
16K Bytes Total channels at 8 kbps
Programmable
TCP decoder parameters
TM
C64x DSP Core include constraint
Instruction Fetch Control length, code rate, and
4 Banks/1M Byte Total
Registers
Enhanced
frame length
L2 Cache/Memory
Instruction Dispatch
Interrupt Control
PCI In-Circuit
Instruction Decode Emulation
or Turbo Coprocessor (TCP)
Enhanced
coder
Utopia 2
or Minimal processor
McBSP 2 delay
L1D Cache 2-Way Set Associative Programmable
EMIF 64 16K Bytes Total parameters include
mode, rate and frame
EMIF 16 Power PLL length
Timer 0
Down
McBSP 0 JTAG Timer 1 Logic
RTDX Pin compatible with
McBSP 1 GPIO8 Timer 2 C6414/C6415 DSPs
‘C6712
TMS320C6712 DSP
600 MFLOPS/100 MHz for $9.95
(Volume)
External Level 1 Dual-level cache memory
Memory Program architecture (same as
Interface Cache C6711 DSP) enables systems
16
4K Bytes
savings
Enhanced DMA (EDMA) is
Enhanced optimized for efficiency in small
DMA RAM devices
(EDMA) Level 2 Cache/
Controller Memory C67xTM
64K Bytes DSP Core
Code compatibility with C6000TM
fixed and floating- point DSPs
speeds development
256-pin BGA allows easy
2 McBSPs
manufacturing and board design
Level 1
Data (same package as C6711)
2 32-Bit Cache
Timers 4K Bytes
TMS320C6712 Digital Signal Processor
‘C33
'C33: New $5 Chip Extends Industry’s
Most Popular Floating-Point DSP Family
Imaging TDK
Complete Imaging Developer’s Kit
DSP board
Hardware
TM
z 150 MHz C6000 DSP
z 16 MB on-board memory
z TI data converter and power
management solutions
Capture/display daughter-board
z Composite/S-Video I/O
z Monitor display
Software
Application Demos
z H.263 encoder+decoder
W z JPEG encoder+decoder
NE C6000 TM
DSP Platform z Wavelet, edge detection,
Imaging Developer’s Kit convolution..
Foundation software
z Chip support library
z Imaging source library
Order-Entry open NOW z DMA memory streaming utilities
Development tools software
Americas part number TMDX320026711 TM
z Code Composer Studio IDE
TM
z DSP/BIOS II RTOS
Europe part number TMDX320026711E
z Compiler,
assembler, linker
DSP Hardware
eXpress DSP
eXpressDSP
A premier, open
DSP software strategy
for TI’s Leadership
TMS320 DSP Family
eXpressDSP Components
TMS320™ DSP
Algorithm
Standard
Algorithm Specification
Application
eXpressDSP
DSP Algo
DSP/BIOS
TI DSP
Other Resources
Software Registration/Upgrades: 972-293-5050
Hardware Repair/Upgrades: 281-274-2285
Enroll in Technical Training: www.ti.com/sc/training
(choose Design Workshops)
Email: epic@ti.com
Literature Requests
SW registration/upgrades, HW repair/upgrades
Information and support for all TI Semiconductor products/tools
Submit suggestions and errata for tools, silicon and documents
Workshops
What’s The Next Step ?
Complete the Compiler Tutorial
Download app notes from DSP Village
DSP Village
DSP Village - Online Discussion Groups
Hardware
SPRU189 - CPU and Instruction Set Ref. Guide
SPRU190 - Peripherals Ref. Guide
SPRU401 - Peripherals Chip Support Lib. Ref.
Software
SPRU198 - Programmer’s Guide
SPRU303 - C6000 DSP/BIOS User’s Guide
Code Generation
SPRU186 - Assembly Language Tools User’s Guide
SPRU187 - Optimizing C Compiler User’s Guide
revised 06/15/2001
DSP Textbooks
Looking for Literature on DSP?
Wrap - Up
Wrap -Up
Introduction
A1. DTMF tones
A2. Installations
• DSK
• CCS
• Acrobat
• Lab Exercises
• VAB
• Desktop Configuration
• CCS Test and Configuration
A3. Data-Converter Plug-in (DCP)
A1 = 2 * r * Cos x A1 = 2 * Cos x
A2 = -(r)^2 A2 = -1
r = filter gain = 1
x = phase angle between adjacent samples = ( (fg) / (fs) ) * 360°
The initial conditions of y[0] = 0, y[1] = some value and y[2] = 0, represents the impulse. When
calculating the value used for y[1], you may want to consider the DSP itself. Taking this number
directly can cause an overflow condition. If you are generating a single tone. Taking 80% of this
number is safe to prevent overflow and still create a nice tone. Since DTMF tones are 2 tones
summed, we need to take <50% of that number. You will see this reflected in the coefficient and
initial condition table we’ve included below.
So, your “C” Code to implement this oscillator would look like this.
The last thing you need to consider is the actual numbers that the DSP can use. We are using
signed 16-bit fixed point numbers here. Therefore our number range from –32767 to +32768. To
create the coefficient and impulse numbers refer to this equations.
Row 1 1 2 3 A
697 Hz
Row 2 4 5 6 B
770 Hz
Row 3 7 8 9 C
852 Hz
Row 4 * 0 # D
941 Hz
Based on an 8KHz Sample Rate, the below table gives you the A1 Coefficient and y[1] impulse.
You can modify these in the SineFilter lab to modify the tones generated.
Frequency A y[1]
697 Hz 27980 6774
770 Hz 26956 7399
852 Hz 25701 8073
941 Hz 24219 8766
1209 Hz 19073 13323
1336 Hz 16325 14206
1477 Hz 13085 15021
1633 Hz 9315 15708
References:
1. Email message from P. Dent.
2. Digital Signal Processing Applications with the TMS320 Family: Theory, Algorithms, and
Implementations, Volume 1. TI Literature number: SPRA012A.
Texas Instruments, Dallas, TX.
Workshop Supplies
‘C6711 One-Day Workshop Notes
Installation Checklist
Some workshops locations will require all the software to be installed
Workshop Files
Table of Contents
'C6711 One-Day Workshop Installation.................................................................................................. 1-1
Workshop Supplies ............................................................................................................................. 1-1
Installation Checklist........................................................................................................................... 1-1
Table of Contents..................................................................................................................................... 1-2
Specifications........................................................................................................................................... 1-3
PC Requirements................................................................................................................................. 1-3
Install ‘C6711 DSK Hardware ................................................................................................................ 1-4
Preparing PC Parallel Port .................................................................................................................. 1-4
DSK Hardware and Workshop Supplies ............................................................................................. 1-5
Connecting the DSK to Your PC ........................................................................................................ 1-6
Install ‘C6711 DSK Software Tools (CCS) ............................................................................................. 1-7
Install Code Composer Studio............................................................................................................. 1-7
Install Acrobat Reader .......................................................................................................................... 1-12
Install ‘C6000 Workshop Files.............................................................................................................. 1-13
Install Workshop Files ...................................................................................................................... 1-14
Install VAB ....................................................................................................................................... 1-15
Desktop Configuration .......................................................................................................................... 1-17
Configure CCS Icon.......................................................................................................................... 1-17
Configure Windows Explorer ........................................................................................................... 1-18
Test ‘C6000 DSK Installation and Configure CCS ............................................................................... 1-20
DSK Confidence Test ....................................................................................................................... 1-20
Run/Configure Code Composer Studio............................................................................................. 1-21
Installation Appendix............................................................................................................................. 1-23
Configure Code Composer Studio .................................................................................................... 1-23
Specifications
PC Requirements
Hardware
• 17” Monitor (or better) set at 1024 x 768 resolution and 16-bit color
• Operating System: Windows 98, WinNT, or Windows 2000
(Windows ME is not supported)
• Pentium II 266 MHz (or better)
• 64MB RAM (or better)
• 600 megabytes of hard-disk space
• Read/Write access to C:\ drive
• 3.5” Floppy disk drive
• CD-ROM drive
• Open Parallel Port (EPP preferred)
• Amplified external mono speaker w/mini plug
• A/C power at each station – need A/C power for TI DSP board (DSK)
Software/Other
• Microsoft Excel 97 (or later)
• Audio source (PC sound card, portable audio player, etc.)
• Windows Media Player (or some other midi player)
• Internet access to each PC (for VAB installation)
• Internet Explorer 3.0 (or Netscape Navigator 3.0) or later
• Cables to connect to Speaker and Audio source
If EPP is not available, either ECP Printer Port or Standard (SPP) Printer Port will also
work, though EPP is preferred due to its greater bandwidth.
d. If a printer port is not displayed, you must restart your PC and follow the manufacturer’s
instructions for BIOS setup. This step can also be followed if EPP was not displayed in
the previous step, but you believe the computer is capable of EPP mode.
e. Once you confirm the parallel (printer) port is available, display the properties for that
port. Find the printer address setting and write it down below – it is normally 0x378.
3. Find, if necessary, the other workshop supplies. These are the additional items needed within
the workshop:
• Speaker
In most cases, you will use the external speakers already connected to the PC. These will
be disconnected and re-connected to the DSK audio output. If your PCs do not have
speakers, you will need to provide an external, powered speaker.
• Audio Input Cable
− TI or you should supply an audio input cable. This will be connected between the
audio source (usually the PC soundcard) to the DSK input.
− Again, this is not part of the DSK kit itself, rather, if supplied by TI it will be shipped
in along with the other supplies.
• Workshop CD-ROM
− This is separate from the CD-ROM shipped with the C6711 DSK.
− The workshop (2nd) CD-ROM will be used later for installing the lab exercises and
Visual Application Builder (VAB).
Parallel
Port I/F
TMS320C6711
TMS320C6711
Power
Jack
Power
LED
Reset Switches
Audio Out Audio In LEDs
4. While no switches or jumpers affect the operation of the board, the Power-On-Self-Test
(POST) routine does read switch 2 to decide if a short or long POST should be executed.
To this end, we suggest you set all the switches UP, indicating the long POST should be run.
5. Shut down and power off the PC.
6. Connect the supplied parallel port (printer) cable to the board. Connect the other end of the
cable to the parallel (printer) port of your PC.
7. Connect the speaker cable.
In most cases you will use the external speakers supplied with the classroom machines. Find
the cable that connects the external speakers to PC you’re using. Remove the speakers mini-
jack from the back of the computer and plug it into the AUDIO OUT connector on the DSK.
8. Install an audio cable from the PCs sound-card output to the DSK audio input.
You may or may not have audio input cables available. If you do, then connect it. During the
Power On Self-Test (POST) and board confidence test (run later) you will hear the audio
input passed through to the speaker if an audio input is connected.
9. Finally, plug the DSK power supply into the wall and the DSK.
When you connect the power, a 'Power-On-Self-Test' (POST) will boot-load from the DSK
flash memory and execute.
• The DSK LEDs will count as it sequences through the test.
• If audio is connected to the MIC input, audio pass-through should be heard first …
… followed by a tone.
• The test completes with all LEDs flashing, then all OFF.
• If the test sequence does not begin or complete successfully, try 'cycling' the power by
plugging and unplugging the power cord. (If this doesn’t work, then either the flash
memory must be reprogrammed or the DSK hardware is defective.)
10. Power up the PC.
Note: If you have the full version of CCS version 2.x, you can install this rather than the limited
version of CCS version 2.x that comes with the C6711 DSK.
<CD-ROM path>\setup.exe
15. When the CCS Installation menu appears, select Code Composer Studio.
16. Once Code Composer Studio’s setup begins, you’ll have to respond to a number of questions.
You can choose the default response for most choices; we’ll indicate when you need to select
something different.
17. The next two dialogs deal with the End User License.
18. Again, take the default to install both CCS and the online PDF manuals.
20. Next you’ll run into the summary of current settings and installation plans. Go ahead and
click Next.
21. CCS setup program will remind you to connect the DSK. You should have already done this
as described on page A2-4. Go ahead and click OK.
22. You should see the installation progressing. At one point, a DOS window will open while the
parallel port is configured.
If a DSK was not connected, you will see the DOS window pause with a message indicating
how to configure the DSK once it is connected.
23. When installation is completed, you should see the following dialog.
We suggest you deselect both checkboxes.
24. If requested, go ahead and let the computer reboot. If a reboot is not required, the CCS
installation program won’t request it.
25. Upon completing CCS installation successfully, you should see the following window.
Note: If you have a version of Acrobat prior to 4.0, we suggest you upgrade to version 4.0.
26. Similar to steps 13 – 14, open Windows Explorer to the <CD-ROM path> and run setup.
<CD-ROM path>\setup.exe
27. When the CCS Installation menu appears, select Adobe Acrobat Reader.
28. You can go ahead and accept all the defaults while installing Adobe Acrobat 4.0.
This screen won’t appear automatically if you’re not installing from the computer’s CDROM
drive (such as when installing from the a networked CDROM or hard drive) or if autoplay is
disabled. In this case you need to navigate to the install file directly.
Using Run from the Start menu (Start > Run) and run the file:
34. When the file installation is complete, you’ll see the following notice. Click OK.
(Note, the number of files shown in the example above may be different from what you see.)
35. Now you can Close the C60001day.exe dialog.
36. Go ahead and hit the F5 key. This will force Windows Explorer to refresh its windows. After
refreshing, you should see the C:\c60001day subdirectory.
Install VAB
37. Choose the Launch VAB for C6000 Installation from the Workshop CD-ROM. (If this screen
doesn’t appear when you place the CD-ROM in your drive, see step 31.)
39. Once VAB installation has begun, it will ask you for a KEY number.
This key should be located on the Workshop files CD-ROM (or CD-ROM jewel case). Each
CD-ROM should have its own KEY number. A couple of points about the VAB CD KEY:
• If you did not receive a KEY number or you cannot find it, please contact Hyperception
and they will provide one via the phone or email. They can be reached at:
Hyperception, Incorporated
Voice: 214-343-8525 … Fax: 214-343-2457
info@hyperception.com
www.hyperception.com
• Each user should have their own KEY number (unless you have purchased a site license
from Hyperception).
• A specific KEY is not tied to the installation CD, rather, once installed it’s tied to a
specific installation on a computer.
40. If you encounter any dialogs that VAB displays, take the default options.
− When asked if changes should be made to the autoexec.bat file, choose “yes”.
− Note, when installing the full version of VAB, you’ll want to choose the appropriate driver –
say ‘C6711 DSK. Using the demonstration version, you only have the choice of the DSK
driver.
41. When all the components of VAB have been installed you will be returned to the main
workshop files CDROM menu. You may now choose Exit.
42. After VAB installation has completed (and you have exited the main installation dialog),
run VAB from the Start menu.
43. When VAB is run for the first time you will be requested to authorize your installation.
• It’s easiest to choose the Authorize via Internet option. If your computer is connected to
the internet, just select the button on the dialog box that appears. This takes you to a
webpage for you to enter your name and address. Upon completion, the webpage
provides your copy of VAB with an authorization number.
• If you do not have internet access, when the authorization screen appears, please call (or
email) Hyperception at the number above. Using the ID number provided in the
Authorization Request dialog, Hyperception will provide you with an Authorization
number.
• Note, should you need to uninstall VAB, you may be asked to unauthorize the software.
This is particularly important if you have purchased the full version. This is easily
accomplished from the Help menu within VAB.
44. Once VAB is running, all workshop software installation has been completed.
Note: When installing VAB on a WinNT machine, only the user performing the install will have the proper setup
(specifically, the toolbars). Therefore, you must install VAB for each NT user to properly setup the registry.
This only presents a problem when an administrator sets up VAB for use by another WinNT user.
To solve this problem, double-click on the *.reg files located in the c:\c60001day\lab7 folder.
Desktop Configuration
Configure CCS Icon
45. Next, let’s modify the desktop icon.
Right-click on the CCS icon on the desktop
and choose Properties.
46. In the CCS icon properties, change the Run line to Maximized.
Tools:Folder Options…
49. Select the View tab in the Folder Options dialog box:
51. Then, uncheck the Hide file extensions for all known file types checkbox.
Test Run Time: 09:39:39 PM Test Run Date: Dec 14, 1999
Command=ISRAM...........................Result=> PASSED!
Command=SDRAM...........................Result=> PASSED!
Command=FLASH...........................Result=> PASSED!
Command=MCBSP...........................Result=> PASSED!
Command=TIMER...........................Result=> PASSED!
Command=QDMA............................Result=> PASSED!
Command=LEDS...Are They Flashing?.......Result=> PASSED!
Command=CODEC..Is Tone/Music Playing?...Result=> PASSED!
• The SDRAM may take a while due to the large amount of SDRAM on the ‘C6711 DSK.
• The CODEC test performs two operations: 1KHz tone output, and an audio input-to-
output loopback. To hear these tests the speaker and audio source must be connected.
Note: If the DSK fails the Confidence Test, please assure that you have properly connected all wires and that
none of them are loose.
If the wiring is OK, did the POST run when power was applied? Try unplugging and plugging back in
the power jack to test this again?
Note:
If you see the following dialog:
It usually means that a previous version of CCS wasn’t completely uninstalled. The CCS
uninstall does not always remove all the registry entries. This should only occur once.
Note:
If you see this dialog:
CCS is not able to connect to the DSK. In fact, the Confidence Test you ran earlier also
should have failed. If it did not fail, then either CCSetup needs to be run (see page A2-23), or
CCS must be reinstalled. If both the Confidence Test and CCS connection have failed, then
you most likely are encountering a physical and/or Windows parallel port driver connection
problem.
57. Click OK to save the change and close the Customize dialog.
Installation Appendix
Configure Code Composer Studio
Code Composer Studio (CCS) can be used with various TI processors – such as the C6000 and
C5000 families – and each of these has various target-boards (simulators, EVMs, DSKs, and
XDS emulators). Code Composer Studio must be properly configured using the CCS_Setup
application.
In this workshop, you should initially configure CCS to use the C6x11 DSK 378 EPP Mode.
Procedure
1. Start the CCS Setup utility using its desktop icon:
Note: Be aware there are two CCS icons, one for setup, the other to start the main CCS
application. You want the Setup CCS C6000 icon.
If you cannot find the desktop icon shortcut, try looking for it under the Windows START
menu (Start→Programs→Texas Instruments→Code Composer Studio 2 (‘C6000)→Setup
Code Composer Studio).
If all else fails, you should be able to find the program itself at: c:\ti\cc\bin\cc_setup.exe
2. When you open CC_Setup you should see a screen similar to this:
Note:If you don’t see the Import Configuration dialog box, you should open it from the menu
using FILE:IMPORT…
4. Select a new configuration from the list and click “Add to system configuration
button”.
Select the C6x11 DSK 378 EPP Mode configuration as shown below and click Import.
Port 378 is the most commonly used option. The port required will depend upon which port is
enabled and supported on your PC. Please refer to step 1 (page A2-2).
5. Save and Quit the Import Configuration dialog box.
Introduction
This appendix chapter was added for those specific versions of the one-day workshop which have
analog plug-in cards available. For all others classes, this material provides an interesting follow-
up to earlier discussions.
Module Topics
Appendix 3 - Data Converter Plug-in ................................................................................................... A3-1
ADC DAC
In I/O DSP I/O Out
Math
Codecs:
Codecs:
TLV320AIC10EVM 16-bit, 22 kSPS low-power DSPcodec Common Connector
TLV320AIC27EVM 18-bit, AC97 compliant AudioCodec Common Connector
Special Functions:
MULTI-CNVTR-EVM TLV254x/TLC255x ADC & TLV56xx DAC
Created Files
The data converter plug-in will create
the following files and add it to the
project:
One C source file for each type of data
converter (several converters of the same type
will use the same file)
One header file for each data converter
dc_conf.h: Initialization values
tidc_api.c: Common API file for all
converters
tidc_api.h: Header file for tidc_api.c
Summary
Advantages
Ease of use
No need to read software library documentation
Standard graphical user interface (GUI)
Automatic code and data generation
Full on-line help (containing details on the
converters, software and the plug-in)
Ease of learning
Quick way to explore data converter options
Less data sheet reading
Generated software driver fully tested
Source code may be optimized or enhanced
This all leaves more time for the designer to work on his
algorithms instead of poking around with the data
converter
Supported Converters
ADC: DAC
THS1206 TLC5617/18
TLV5617/18
THS10064/12082/
10082 TLV5623/24/25/26
THS14F01/03 TLV5636/37/38
THS1401/03/08 TLV5606/16
TLV1504/08
TLV1514/18 CODECs
TLV320AIC10
TLV2544/48
TLV320AIC11
TLV320AIC27
Example Code
For all data converters supported by the
data converter plug-in, sample code is
available from the WWW
URL: http://www.ti.com/sc/dcplug-in
Lab
This optional lab requires an extra DSK hardware plug-in board which is not part of the standard
C6000 One-Day Workshop.