You are on page 1of 49

EdGate Technologies

V1.0

MATLAB SIMULINK INTERFACE WITH TI DSK C6713(CCSTUDIO) USER MANUAL

EdGate Technologies #68,15th Cross, 1st Block, R.T.Nagar, Bangalore: 560 032 PH: 080 23535125 /8. www.edgate.in

Page 1

EdGate Technologies

V1.0

Contents
Requirement verification System requirements Mathworks software requirements Texas instruments software requirements Hardware set up Procedure to run demo program Procedure for creating new model

Page 2

EdGate Technologies

V1.0

MATLAB And DSP


INTRODUCTION
The Embedded Target for TI C6000 DSP integrates MATLAB and Simulink with Texas Instruments eXpressDSP tools and C6000 DSPs. Together, these products enable you to perform automatic code generation, prototyping, and embedded system deployment of signal processing applications on TI C6000 processors. By using the Embedded Target for TI C6000 DSP and your TI development tools with Real-Time Workshop and Real-Time Workshop Embedded Coder (both available separately), you can generate a real-time C language

implementation of your Simulink model TheEmbedded Target for TI C6000 DSP supports TI C67x loating-point DSPs and C64x and C62x fixed-point DSPs, including onboard and onchip DSP peripherals. It automates the creation of Code Composer Studio projects and supports several evaluation boards, including the DM642EVM, C64 I 6DSK, C671 3DSK, C6711DSK, and C670IEVM.

Page 3

EdGate Technologies

V1.0

KEY FEATURES
Generates documented, readable C code in Code Composer Studio project

format using Real time Workshop (RTW). This generated code can be edited for further changes. The Embedded Target for C6000 DSP Platform integrates Simulink and MATLAB with TI's eXpressDSP tools and C6000 DSP processors. It consists of Simulink libraries for designing and simulating DSP applications. These libraries include key operations such as Multirate, and adaptiveiltering transforms matrix manipulation and linear algebra statistics spectral analysis Using these libraries you can develop digital signal processing applications that have any of the following characteristics:
Single rate

Multirate Multistage Adaptive

Page 4

EdGate Technologies

V1.0

Matlab used must be compatible with ccstudi oversion (for example matlab2007A compatible with ccs3.1 and ccs3.3, matlab2008A and B are also compatible with ccs3.1,for more information on compatibility check matworks website)

Page 5

EdGate Technologies

V1.0

Page 6

EdGate Technologies

V1.0

Hardware setup
We will make use of function generator and an oscilloscope. Both will be connected to the TI C6713 on line-in and line-out connectors. Frequency of Carrier Signal is fixed at 15 kHz while the message signal is varried from the function generator. Since DSK C6713 ensures realtime simulation, once the message signal is varied we will see on oscilloscope that modulated signal is also varying. Lets discuss different steps involved.

c6713 Simulink Mode


Page 7

EdGate Technologies

V1.0

Procedure to run demo program


To run demo program
1)install ccstudio v3.1or 3.3 and also install compatible matlab2007A(7.4) 2)configure ccstudio according to your external target board 3)close down the ccstudio window 4)open up the matlab window

1. type ccstutorial press enter


The 'Link for Code Composer Studio' provides a direct connection between MATLAB and a DSP in Code Composer. This provides a mechanism for controlling and manipulating an

embedded application using the full computational power of MATLAB. This can be used to assist DSP debugging and development.Another possible use is for creation of MATLAB scripts forverification and testing of algorithms that exist in their final implementation on an actual DSP target.Before discussing the methods available with the link object,it's necessary to select a DSP target. When the link is created, it is specific to a particular CPU, (i.e. a DSP processor) so selection is required before proceeding. In general, the selection process is only necessary for multiprocessor configurations of Code Composer Studio

2. Press any key to continue


The 'Link for Code Composer Studio' provides two tools for selecting a DSP board and processor in multiprocessorconfigurations. First, a command line version called: 'ccsboardinfo' which generates a list of the available boards and processors.For scripting, this command can return a structure, which can be applied programmatically to select a particular DSP chip.

3. Press any key to continue: ccsboardinfo


ccsboardinfo Board Board Num Name 0 C6713 DSK Proc Processor Num Name 0 CPU_1 Processor Type TMS320C6x1x

Page 8

EdGate Technologies

V1.0

echo off; Another selection option is a GUI tool called 'boardprocsel'. Please Note - the CPU that is selected in the GUI will be used for the rest of this tutorial. For single processor installations, of Code Composer Studio, simply select 'OK' from the message box to continue.

4. Press any key to continue, then select aDSP from the GUI (or click OK): boardprocsel
[boardNum,procNum] = boardprocsel boardNum = procNum =0 drawnow; 0

echo off The goal of this selection process is a board numberand processor number that uniquely identify a particulartarget DSP. These values are then applied during the link creation.You selected board number = 0, and processor number = 0Next, the actual connection between the MATLAB command line and Code Composer will be established. This link is represented by a MATLAB

Page 9

EdGate Technologies

V1.0

object, which for this session will be saved in variable 'cc'. The link object is created with the 'ccsdsp' command, which accepts the board number and processor number as input parameters. Other properties can also be defined during the object creation; refer to the 'ccsdsp' documentation for more information on these properties.The generated 'cc' object will be used to direct actions to the designated DSP chip. Therefore, it will appear in all commands that follow the object creation. Naturally, in multiprocessor implementations it is possible to have more than one link object. NOTE: Before proceeding, your DSP hardware should be reset and configured as needed for operation by Code Code Composer.

5. Press any key to continue: ccsdsp


cc = ccsdsp('boardnum',boardNum,'procnum',procNum) CCSDSP Object: Processor type : TMS320C6713 Processor name : CPU_1 Running? Board number : No :0

Processor number : 0 Default timeout : 10.00 secs RTDX channels :0

timeoutValue = 10; % time-out value in seconds set(cc,'timeout',timeoutValue); % Set CCSDSP default time-out value echo off You may have noticed Code Composer appear briefly when 'ccsdsp' was called. If Code

Composer was not running before the link is established, it is started and then placed in the background.In most cases, you will need to interact with Code Composer, so the first method that will be introduced (called 'visible')controls the state of Code Composer on the desktop. This accepts a Boolean input that makes Code Composer visible (1) or invisible (0) on the desktop. For the rest of this tutorial, we will need to interact with Code Composer, so we'll use 'visible' to bring it up to the desktop.

Page 10

EdGate Technologies

V1.0

ERROR1:

Solution: make sure that your dsp board is correctly connect. remove power supply and reconnect it and try the above comments ie ccsdsp ERROR2:

cc = ccsdsp('boardnum',boardNum,'procnum',procNum)catch echo off Error using ==> ccs.ccsdsp.initializeCcsdsp>DetectConfigErrors at 173

Page 11

EdGate Technologies

V1.0

Could not connect to CCS. Please ensure your CCS installation is set up properly. Exiting CCSTUTORIAL demo... Solution: Make sure that your usb cable is connect properly,remove and reconnect and try Make sure that your matlab version support your ccs version(2007A is compatible with ccs3.1 and ccs3.3) IF stil giving ths same error then uninstall all ccstudio files and TI drivers from your PC also uninstall matlab and its related files.then again install ccstudio and matlab

6. Press any key to continue


visible(cc,1) % Force Code Composer to be visible on the desktop echo off With the link in place, it is now possible from MATLAB touery Code Composer for status on the specified DSP.Four methods are available to get status information: 'info' 'display' 'isrunning' - returns a structure of testable Target conditions. - prints a list of information about the target CPU. - returns the state (running or halted) of the CPU.

'isrtdxcapable' - reports CPUs ability to perform RTDX(tm) transfers. The next segment will demonstrate these methods.

7. Press any key to continue: display


display(cc) CCSDSP Object: Processor type : TMS320C6713 Processor name : CPU_1 Running? : No

Page 12

EdGate Technologies

V1.0

Board number

:0

Processor number : 0 Default timeout : 10.00 secs RTDX channels :0

8. Press any key to continue: info, isrunning


linkinfo = info(cc) linkinfo = procname: 'CPU_1' isbigendian: 0 isrtdxcapable: 1 family: 320 subfamily: 103 revfamily: 13 targettype: 'emulator' siliconrev: 16973824 timeout: 10 boardname: 'C6713 DSK' cpurunstatus = isrunning(cc) cpurunstatus = 0 isrtdxcapable(cc) ans = 1 echo off From the 'subfamily' and 'revfamily' members of the structure returned by the 'info' method, it was determined that you selecteda TMS320C6713.Please note - In some cases, the values reported by Code Composer do not match the physical device numbering scheme.Now that a connection has been established, the target CPU needs something to do! Therefore, the next step

Page 13

EdGate Technologies

V1.0

is to create executable code for the target DSP with Code Composer. For this tutorial, a Code Composer project file and a board specific executable were created and included with MATLAB. We will first attempt to load the included executable directly, and if the load fails (could be because it is a different board or processor), we will build the included project. The following set of commands will locate the tutorial project and load it into Code Composer. This will use the 'open' method, which can direct Code Composer to load a project file or a program file.

9. Press any key to continue: open,cd


% Open the CCS Project demoPjt = getDemoProject(cc,'ccstutorial') demoPjt = isLibProj: 0 TemplateProject: 'C:\ProgramFiles\MATLAB\R2007a\work\LinkForCCSDemos_v3.0\template\c6x\c67x.pjt' DemoDir 'C:\Program Files\MATLAB\R2007a\work\LinkForCCSDemos_v3.0\ccstutorial\c6x\c67x' ProjectFile: 'C:\ProgramFiles\MATLAB\R2007a\work\LinkForCCSDemos_v3.0\ccstutorial\c6x\c67x\ccstut. pjt' ProgramFile: ' C:\ProgramFiles\MATLAB\R2007a\work\LinkForCCSDemos_v3.0\ccstutorial\c6x\c67x\ccstut. out' SrcFile: {2x1 cell} LibFile: '' CmdFile: {'C:\Program Files\MATLAB\R2007a\toolbox\ccslink\ccsdemos\shared\c6x\c6x.cmd'} HdrFile: ''

Page 14

EdGate Technologies

V1.0

BuildOpts: [1x1 struct] ProjectAction: 'upToDateProj-upToDateProg' RebuildDemo: 0 demoPjt.ProjectFile ans = C:\ProgramFiles\MATLAB\R2007a\work\LinkForCCSDemos_v3.0\ccstutorial\c6x\c67x\ccstut. pjt demoPjt.DemoDir ans = C:\Program Files\MATLAB\R2007a\work\LinkForCCSDemos_v3.0\ccstutorial\c6x\c67x

cd(cc,demoPjt.DemoDir) echo off

% Change working directory of Code Composer(only)

You should notice the tutorial's project loaded in Code Composer.Examine the files in Code Composer that comprise this project the main source file used by this tutorial is 'ccstut.c', a linker command file (*.cmd) and vector table source file (*.asm), which will be different, depending on the DSP family you are using. Before building this project, we will attempt to load the included executable. This will use the 'load' method, which should only be used for program files.The 'Link for Code Composer Studio' includes methods for reading the target's symbol table to give direct access to data in the DSP memory. NOTE: The symbol table is only available after the program file is built and then loaded into the DSP. Notice the results of checking the symbol table for the variable 'ddat' before and after the load.

Page 15

EdGate Technologies

V1.0

10. Press any key to continue: load,address,dec2he


% Before loading target execution file: warnState = warning('on'); % Enable warnings to demonstrate the next command address(cc,'ddat') % Note - This may (correctly) issue a warning before the executable file is loaded. Warning: Address: Failed to locate symbol 'ddat' in symbol table in C:\Program Files\MATLAB\R2007a\toolbox\ccslink\ccslink\@ccs\@ccsdsp\address.p>address ccstutorial at 274 ans =[] warning(warnState); % Reinstate warning state % Load the target execution file load(cc,demoPjt.ProgramFile,30) echo off % Assume that the target execution file has been loaded by the user ddatA = address(cc,'ddat') % Read the address of global: ddat ddatA = 38848 dec2hex(ddatA) ans =97C0 0000 echo off After the target code loaded, it is possible to examine and modify data values in the DSP target from MATLAB.For static data values, it is possible to read them immediately after loading a program file. However, the more interesting case is to manipulate data values at intermediate points during program execution.To facilitate this operation, there are methods to insert (and delete) breakpoints in the DSP program. The method 'insert' creates a new breakpoint, which can 0 % in hexadecimal (address and page) at 51 In

Page 16

EdGate Technologies

V1.0

be specified by either a source file location or a physical memory address.For this tutorial, we need to insert a breakpoint at line 64 of the 'ccstut.c' source file.To assist your visibility of this action, the method 'open' is used to display the source file in Code Composer. Furthermore, the 'activate' method will force this file to the front.(Although it is not demonstrated here, 'delete' can be used to remove a breakpoint.)

11. Press any key to continue: activate, insert and open


cd(cc,demoPjt.DemoDir); % Restore back working directory for Code Composer brkpt = 64; demoPjt.SrcFile{1} ans = C:\Program Files\MATLAB\R2007a\toolbox\ccslink\ccsdemos\ccstutorial\ccstut.c [srcpath,srcfile,ext] = fileparts(demoPjt.SrcFile{1}); srcfile = [srcfile ext]; cc.cd(srcpath); open(cc,srcfile,'text') % Be sure this file is open for viewing in CCS

activate(cc,srcfile,'text') % Bring the source file forward insert(cc,srcfile,brkpt) echo off Examine the source file 'ccstut.c' in the Code Composer Studio source editor area. There should be a breakpoint on line 64 (indicated by a red dot). Next, locate the two global data arrays: 'ddat' and 'idat', which are located at lines 44 and 45 in this file. These DSP memory arrays can be accessed directly from MATLAB command line using the 'read' and 'write' methods.To control target execution, use the 'run','halt' and 'reload' methods. The following section will demonstrate these methods. Note: This approach to access DSP memory is powerful but rudimentary. Later in the tutorial, we'll introduce an easier method based on C variables (supports C6x, C54x, C55x, R2x, R1x, OMAP % Insert breakpoint at line 64

Page 17

EdGate Technologies

V1.0

12. Press any key to continue: halt,reset,reload,run,read


ddat_addr = address(cc,'ddat'); % Get address of symbols idat_addr = address(cc,'idat'); echo off ddat_type = 'double'; idat_type = 'int16'; ddat_value = double([pi 12.3 exp(-1) sin(pi/4)]); idat_value = int16(1:4); echo off halt(cc) echo off reset(cc); echo off reload(cc) ans = C:\ProgramFiles\MATLAB\R2007a\work\LinkForCCSDemos_v3.0\ccstutorial\c6x\c67x\ccstut. out run(cc,'runtohalt',30); % Wait for program execution to stop at breakpoint! (timeout = 20 seconds) ddatV = read(cc,address(cc,'ddat'),ddat_type,4) % Should equal initialized value from C-Code ddatV =16.3000 -2.1300 5.1000 11.8000 idatV = read(cc,address(cc,'idat'),idat_type,4) % reload the .out file and set the PC to start of the program % Reset the CPU (if necessary) % Halt the CPU (if necessary) % Set values to use

Page 18

EdGate Technologies

V1.0

idatV = -1 508 647 7000 Compare Data: idat, ddat with Code Composer, then press return write(cc,address(cc,'ddat'),ddat_value) % Modify memory values write(cc,address(cc,'idat'),idat_value) run(cc,'runtohalt',20); % Resume execution from breakpoint, then modify % Read memory values

ddatV = read(cc,address(cc,'ddat'),ddat_type,4) ddatV =3.1416 12.3000 0.3679 0.7071 idatV = read(cc,address(cc,'idat'),idat_type,4) idatV = 1 restart(cc); 2 3 4

% Reset the PC to start of program

For Assembly language programmers, there are also methods to access CPU registers: 'regread' and 'regwrite'.Press any key to continue: regread,regwrite tReg = regread(cc,'A0','2scomp') tReg = 0 regread(cc,'B2','binary') ans = 0 regwrite(cc,'A2',tReg,'2scomp') regread(cc,'A2','2scomp') ans =0 % verify the value previously written % unsigned version of B2 % 2's complement version of A0

Page 19

EdGate Technologies

V1.0

echo off Direct access to DSP memory is powerful, but for C programmers it is more convenient to manipulate memory in ways consistent with the defined C variables. This type of access is implemented using MATLAB objects as representations of embedded entities. First, let's take a look at the same data values that we explored above but now we'll manipulate them using objects. First, we'll restart the program and apply the 'list' method, which queries Code Composerfor information, on 'idat', i.e. the global C variable of intere

13. Press any key to continue: list, goto, run


restart(cc) % Restart program

goto(cc,'main') % Open file where 'main' is found and set the CCS cursor to the start of 'main' run(cc,'main') % Run to start of 'main' - ensured Embedded C variables get initialized listI = list(cc,'variable','idat') % Returns structure of information about global variable: 'idat'listI = idat: [1x1 struct] listI.ida ans = name: 'idat' isglobal: 0 address: [38836 0] size: 4 bitsize: 16 type: 'short'

Page 20

EdGate Technologies

V1.0

14. Press any key to continue


'List' generates lots of information about the embedded 'idat' variable.However, an even more useful method is 'createobj', which generates a MATLAB object to represent the C variable. This object acquires the properties of the C variable. Applying the object returned by

'createobj',you can directly read the entire variable or access individual elements of an array. Note: Up to this point all methods were applied to the original 'cc' object that was created with 'ccsdsp'. The 'cc' object represents communication with a particular embedded processor in Code Composer Studio.However, for the remainder of this tutorial, methods are applied to many different objects. In typical object-oriented fashion, the action performed by a method will depend on it's object. The relevant object is always the first parameter passed to the method. For example, in thefollowing section, 'cvar' is an object representing the embedded 'idat' variable.

15. Press any key to continue: createobj, read, write


cvar = createobj(cc,'idat') % Creates a MATLAB object 'cvar' to manipulate embedded 'idat' NUMERIC Object stored in memory: Symbol name Address Data type Word size : idat : [ 38836 0] : short : 16 bits

Address units per value : 2 au Representation Size : signed :[4] : 8 au : row-major : little

Total address units Array ordering Endianness

Page 21

EdGate Technologies

V1.0

read(cvar) % Reads the entire embedded array into the MATLAB workspace ans = -1 508 647 7000

read(cvar,2) % Reads only the second element ans = 508 write(cvar,4,7001) % Modifies the fourth element to 7001 read(cvar) % See changes ans = -1 508 647 7001

read(cvar,[1 cvar.size]) % Read only first and last elements ans = -1 echo off The previous 'read' takes the raw memory values and converts theminto equivalent MATLAB numeric values. The conversion that gets applied is controlled by the properties of the object, which were initially configured in 'createobj' to settings appropriate for your DSP architecture and C representation. In some cases, it is useful to alter these default conversion properties. Several properties such as 'endianness', 'arrayorder' and 'size' canbe directly modified using 'set'. More complex changes are possible using methods such as 'convert' and 'cast', which adjust multiple properties simultaneously. 7001

16. Press any key to continue: cast, convert, size


set(cvar,'size',2) % Reduce size of 'idat' to first 2 elements read(cvar) ans =-1 508 uicvar = cast(cvar,'unsigned short') % Creates new object with specified data type (butotherwise identical)

Page 22

EdGate Technologies

V1.0

NUMERIC Object stored in memory: Symbol name Address Data type Word size : idat : [ 38836 0] : unsigned short : 16 bits

Address units per value : 2 au Representation Size : unsigned :[2] : 4 au : row-major : little

Total address units Array ordering Endianness

read(uicvar) % Note - first value is no longer -1, but unsigned equivalent ans = 65535 508

convert(cvar,'unsigned short') % Same as Cast, but alters properties of existing class NUMERIC Object stored in memory: Symbol name Address Data type Word size : idat : [ 38836 0] : unsigned short : 16 bits

Address units per value : 2 au Representation Size : unsigned :[2] : 4 au : row-major

Total address units Array ordering

Page 23

EdGate Technologies

V1.0

Endianness read(cvar) ans =65535 echo off

: little % Remember - the size of cvar was set to 2! 508

DSP variables such as strings, structures, bitfields, enumerated typesand pointers can be manipulated just as easily. The following demonstrates some common manipulations on

structures, strings and enumerated types. In particular, note the 'getmember' method,which extracts a single field from a structure as a new MATLAB object.

17. Press any key to continue: getmember


cvar = createobj(cc,'myStruct') % Object that represents an embedded C structure STRUCTURE Object stored in memory: Symbol name Address : myStruct : [ 38808 0]

Address units per value : 28 au Size :[1] : 28 au : row-major : 'iy', 'iz'

Total Address Units Array ordering Members read(cvar) ans = iy: [2x3 double] iz: 'MatlabLink'

write(cvar,'iz', 'Simulink') % Modify 'iz' field using actual enumerated name

Page 24

EdGate Technologies

V1.0

cfield = getmember(cvar,'iz') % Extract object from structure ENUM Object stored in memory: Symbol name Address Word size : iz : [ 38832 0] : 32 bits

Address units per value : 4 au Representation Size : signed :[1] : 4 au : row-major : little

Total address units Array ordering Endianness Labels & values

: MATLAB=0, Simulink=1, SignalToolbox=2, MatlabLink=3, EmbeddedTargetC6x=4 write(cfield,4) % Write to same enumerated variable by value read(cvar) ans = iy: [2x3 double] iz: 'EmbeddedTargetC6x'

Page 25

EdGate Technologies

V1.0

18. Press any key to continue


cstring = createobj(cc,'myString') % Object that represents an embedded C structure STRING Object stored in memory: Symbol name Address Word size : myString : [ 38880 0] : 8 bits

Address units per value : 1 au Representation Size : signed : [ 29 ] : 29 au : row-major : little : ASCII

Total address units Array ordering Endianness

Char conversion type read(cstring)

ans =Treat me like an ANSI String write(cstring,7,'ME') read(cstring) ans =Treat ME like an ANSI String write(cstring,1,127) % Set first location to numeric value 127 (a non-printable ASCII character) readnumeric(cstring) % Read equivalent numeric values ans =Columns 1 through 18

Page 26

EdGate Technologies

V1.0

127 114 101 97 116 32 77 69 32 108 105 107 101 32 97 110 32 65 Columns 19 through 29 78 83 73 32 83 116 114 105 110 103 echo off To learn more about data manipulation and function calls,please run 0

'FUNCTIONCALLTUTORIAL'.

19. Press any key to continue


Finally, the objects created during this tutorial have COM handles to Code Composer Studio. Until these handles are deleted, the Code Composer Studio process will remain in memory. Exiting MATLAB will automatically remove these handles, but in some cases it might be useful to manually delete them. Use 'clear' to remove objects from the MATLAB workspace and delete any handles they contain. 'Clear all' will delete everything. Alternatively, to retain your

MATLAB data use 'clear' on the objects derived from 'ccsdsp' (including all objects returnedby 'createobj'). In addition, 'close' is performed on the tutorial project to remove it from Code Composer.

20. Press any key to continue: close, clear


Finally, the objects created during this tutorial have COM handles to Code Composer Studio. Until these handles are deleted, theCode Composer Studio process will remain in memory. ExitingMATLAB will automatically remove these handles, but in some cases it might be useful to manually delete them. Use 'clear' to remove objects from the MATLAB workspace and delete any handles they contain. 'Clear all' will delete everything. Alternatively, to retain your

MATLAB data use 'clear' on the objects derived from 'ccsdsp' (including all objects returned by 'createobj'). In addition, 'close' is performed on the tutorial project to remove it from Code Composer. % Clean-up Code Composer close(cc,demoPjt.ProjectFile,'project') % close the project file

Page 27

EdGate Technologies

V1.0

visible(cc,0); srcfile srcfile = ccstut.c

% Delete breakpoint introduced earlier

delete(cc,srcfile,brkpt) % Remove breakpoint at line 64 close(cc,srcfile,'text') % Close source file % Clear data objects clear cc cvar cfield uicvar cstring

**************** Demo complete. ****************

Page 28

EdGate Technologies

V1.0

Procedure for creating newsimulink model model


1) Make sure that ccstudio v3.1or 3.3 and compatible matlab2007A(7.4) are installed 2) hardware connection I. II. III. connect a c6713 DSK board to the pc through USB connect +5v power supply to the board run the diagnostics

3) configure ccstudio according to your external target board 4) close down the ccstudio window 5) open up the matlab window 6) Type the following comments to make sure that correct board is selected and link is made with ccstudio and matlab a)ccsboardinfo

Page 29

EdGate Technologies

V1.0

b)boardprocsel [boardNum,procNum] = boardprocsel boardNum = procNum =0 drawnow; 0

Click on ok c) type ccsdsp (establish connection between ccstudio and matlab)

cc = ccsdsp('boardnum',boardNum,'procnum',procNum) CCSDSP Object: Processor type : TMS320C6713

Page 30

EdGate Technologies

V1.0

Processor name : CPU_1 Running? Board number : No :0

Processor number : 0 Default timeout : 10.00 secs RTDX channels :0

timeoutValue = 10; % time-out value in seconds set(cc,'timeout',timeoutValue); % Set CCSDSP default time-out value

7) library verification
type c6000lib on comments window of matlab

Page 31

EdGate Technologies

V1.0

Fig1

a)c6000 dsp core support lib To get below window click on c6000dsp core support block shown above

Page 32

EdGate Technologies

V1.0

a)hostcommunication library
To get below window click on hostcommunication library block shown Fig1

c)RTDX instrumentation To get below window click on RTDX instrumentation block shown Fig1

Page 33

EdGate Technologies

V1.0

Board support library

Page 34

EdGate Technologies

V1.0

Target reference block

8) click on simulink icon on matlab window to open simulink library browser

Page 35

EdGate Technologies

V1.0

9) click on target for ti c6000c6000 target references

Page 36

EdGate Technologies

V1.0

10) To create new model FILenewmodel or click on below shon icon

11) Select c6713dsk drag and place in the new model window(untitled)

Click on yes

Page 37

EdGate Technologies

V1.0

12) Similarly drag and place all the required block on new model window As shown bellow

Fig simple audio loop back

13)

Make all neccessory interconnection between the blocks

Page 38

EdGate Technologies

V1.0

14) Save the model:file save (give any name with .mdl extension)click on save

15) Check and change the property of your simulink block placed on model window by double clicking on particular block
a)Target reference property setting

Page 39

EdGate Technologies

V1.0

Change the Operating system dsp/bios to none and click on apply

Make sure that cpu clock speed (MHZ) is same as target cpu clock speed(for c6713 its 225Mhz)

Page 40

EdGate Technologies

V1.0

Memory /section

Use default memory (no change required in below window)

Page 41

EdGate Technologies

V1.0

b) ADC/DAC property ADC

Double click on LINE in c6713dsk ADC block as shown above

Chage ADC source to line in or mic in as you want If line in is selected input must be given to the line in port (line in of aic23 codec) of dsk board If mic inis selected input must be given to the mic in port(mic in of aic23 codec) of dsk board

Page 42

EdGate Technologies

V1.0

Select sampling rate between 8khz to 96khz(in case of audio select 44.1khz)

Select appropriate data type(for above example select single)

Then click on ok

Page 43

EdGate Technologies

V1.0

DAC property

Double click on c6713dsk DAC block as shown above

Word length=16-bit Sampling rate=44.1kHz(same as ADC sampling rate) Over flow mode=wrap

Click on Applyok 16) Click on save icon on model window

Page 44

EdGate Technologies

V1.0

17) Realtime workshop configuration

Simulationconfiguration parameters(ctrl+E)

Solver
Type= fixed step solver=discrete(no continue state) All others field are used as default

Page 45

EdGate Technologies

V1.0

Real time workshoplink to CCS

Project option=custom Built action=built_and_execute Interrupt over notification method=no Click on applyok

Page 46

EdGate Technologies

V1.0

18) Click on incremental built icon as shown in bellow diagram

19) Now observe the flowing changes on matlab and ccs window

Page 47

EdGate Technologies

V1.0

Page 48

EdGate Technologies

V1.0

20)

Hardware connection

Page 49

You might also like