Вы находитесь на странице: 1из 9

E E 2 7 5 Lab

March 30, 2012

Lab 1. DSK6713 Audio Delay


Introduction
A PC is required to run Code Composer Studio which is required to compile and download code to (run on) the DSP. (Note: This is the same Lab. as Lab.1 in the Real-Time set of Labs.)

Figure 1: Typical lab setup c 2012GM

DSP Board Highlights

Figure 2: C6713 DSK block diagram Texas Instruments TMS320C6713 DSP operating at 225 MHz An AIC23 stereo codec 8 MB of synchronous DRAM 512 KB of non-volatile Flash memory 4 user accessible LEDs and DIP switches Congurable boot options Standard expansion connectors for daughter card use JTAG emulation through on-board JTAG emulator with USB host interface or external emulator Single voltage power supply (+5V)

Functional Overview of DSP Board

The DSP on the 6713 DSK interfaces to on-board peripherals through a 32-bit wide EMIF (External Memory Interface). The SDRAM, Flash and CPLD are all connected to the bus. EMIF signals are also used for daughter cards. The DSP interfaces to analog audio signals through an on-board AIC23 codec and four 3.5 mm audio jacks (microphone input, line input, line output, and headphone output). The codec can select the microphone or the line input as the active input. The analog output is sent to both the line out and headphone out connectors. The line out has a xed gain, while the headphone out allows for an adjustable gain. connectors. A programmable logic device called a CPLD (Complex Programmable Logic Device)is used to implement logic that ties the board components together. The DSK includes 4 LEDs and a 4 position DIP switch which allow for interactive feedback. Simulink communicates with Code Composer Studio through Real-Time Workshop.Code Composer Studio communicates with the DSK through an embedded JTAG emulator with a USB host interface. Matlab communicates with CCS via Link for Code composer Studio. The DSK can also be used with an external emulator through the external JTAG connector.

Figure 3: Real-Time Workshop

Simple Audio Systems

In this Lab 1 you will build a simple audio system that can run on a Texas Instruments digital signal processor IC. First, you will create a model of the system in Matlab/Simulink, then you will use tools to compile the model, download it, and run it on the DSK7613 board, which contains a TI TMS320C6713 DSP IC. Software tools used: Matlab (r2009a) Simulink Code Composer Studio v3.3 (from TI) Code Composer Studio (CCS) includes a compiler for the C6713 DSP. Matlab/Simulink starts CCS when you tell it to generate code for the model, and CCS will automatically compile and download the code to the DSK6713 and start it running on the DSP.

Create the Simulink Model


1. Log in to the PC and bring up Matlab r2009a. 2. Change the working directory to M:\matlab\work\ 3. Bring up the Simulink library browser by typing simulink at the Matlab prompt. 4. Start a new model by clicking on the blank document icon in the Simulink library browser. 5. Save the model using the File/Save As pulldown. You can name it audio delay or another descriptive name. Save it in the M:/matlab/work/ directory on your network drive. 6. In the Simulink library browser, open the Target Support Package TC6 library group and select C6000 Target Preferences 7. From the C6000 Target Preferences library, drag C6713DSK to your empty model. 8. A window will pop up. Click Yes in the pop-up, to initialize the model conguration parameters to the default values. 9. In the Simulink library browser, Target Support Package TC6 library group, select the C6713 DSK Board Support library.

10. From the C6713 DSK Board Support library, drag an ADC block and a DAC block into the model youre building. 11. Go to the Signal Processing Blockset library group and select Signal Operations. 12. From the Signal Operations library, drag the Delay block into the model. 13. Open the Simulink library group and select Commonly Used Blocks. 14. From the Commonly Used Blocks library, drag the Sum block into the model. Now you should have ve blocks in your model. You need to connect them and set some parameters in some of the blocks. The C6713DSK block (Target Preferences) doesnt have any connections, it just denes the settings for the DSP board. 15. Put the ADC, Delay, Sum, and DAC blocks in a line from left to right. This order is the signal ow for the model. 16. Double-click on the ADC block. 17. Change the ADC source from Line In to Mic In. 18. Note the sampling rate (8 KHz) and the word length (16-bit), then click OK on the ADC Source Block Parameters. Youll see the block in your model now says Mic In. 19. Highlight the ADC block by clicking once on it. 20. Hold the Ctrl key down and click on the Delay block. You should see an arrow connect the two blocks. 21. Hold the Ctrl key down and click on the Sum block, then click on the DAC block. There should be arrows connecting all the blocks. 22. Right-click on the second input to the Sum block, hold the mouse button down, and move the mouse to create a line about an inch long. The line is dashed red because it isnt connected to anything. 23. Release the mouse button, then click again at the unattached end of the arrow, hold the button down, then drag over to the arrow between the ADC and the delay and release the mouse button. Now there is a path from the ADC to the summing block. (If you have to delete a line, highlight it by clicking on it, then use the delete key.) 24. Double-click on the delay block. Set the delay to 2048 samples. Leave all other settings alone and click OK. Youll see the notation on the block change to z 2048 . 25. You can double-click on the DAC block to see that the settings for sample rate and word length match the ADC block. Dont change the settings. 26. Save the model.

Connect the Hardware


Youll need the following hardware in order to continue with the lab: DSK6713 DSP board microphone speakers USB cable to connect the PC to the DSK6713 The DSK6713 has to be powered and connected to the PC in order to invoke Code Composer Studio.

Use caution when handling the DSP board; the ICs can easily be damaged by static charge that you cannot sense. Handle the board as little as possible, and dont let anything fall on or brush against the board.
Once the USB cable is connected between the PC and the DSK6713, if you have to touch the board, you can ground yourself on the metal shroud on the USB connector on the board. Hold the board by the metal shroud while connecting the microphone and speakers to the DSK6713. If that isnt sucient, try to touch just the edge of the board. The functions of the four jacks are silkscreened onto the board, but the font is small, so look carefully near the jacks to see which jack has which function. 27. Orient the board so that the power connection and USB connection are toward the back of the bench. 28. Connect the USB cable between the PC and the DSK6713. 29. Connect the microphone to the MIC IN jack. 30. Connect the speakers to the LINE OUT jack. Make sure the speakers are powered, but set the volume low. 31. Plug in the power supply and connect the power cable to the DSK6713. 32. Keep the microphone away from the speakers, to avoid acoustic feedback once the program is running on the DSK7613.

Compile, Link, and Run the Model for the DSP Hardware
Now you should be ready to run the model. 33. In the Simulink window, click on the Simulation pulldown, and select Conguration Parameters. (a) On the left side of the Conguration Parameters window, there is a Select browser; use it to go to the Solver section and set the Stop time to inf (innite). (b) Use the browser to go to the Real-Time Workshop section and select Embedded IDE Link CC. Under Project Options, make sure that the System stack size (MAUs) is set to 8192. 34. Use the browser pane to go to the Real-Time Workshop section and nd the Generate code button on the right side of the right-hand pane. Click on it. 35. If a window pops up notifying you of unapplied changes, accept the changes. 36. Look in the main Matlab Command Window. You should see a message like ### Connecting to Code Composer Studio(tm) ... 37. It will be at least two full minutes before anything appears to happen in the Matlab command window; be patient. (Note that once CCS is running and authenticated, future use will be much faster.) Check for the animated CCS icon in the system tray while you wait. Eventually you should see these messages (among others) in Matlab: TLC code generation complete. Building project... Download done. then CCS will start up. 38. Bring the CCS window to the front so you can see messages there. 39. If you get an error, you might have to power-cycle the DSK board and close CCS, then click on the Generate code button to re-start the process. You should see a window pop up briey saying that it is downloading the compiled program to the DSK6713. 40. Once you see **starting the model** in the CCS message pane, and a green light and the message RUNNING in the border at the lower left of the CCS window, you should be able to try the model. In the command window you should see Download done. Snap your ngers or tap the microphone and listen for the output. Q1: About how long is the delay? Q2: How long would you expect it to be given the sample rate and the delay block parameter settings?

41. This very small project required a lot of code. In CCS, you can see the C code that the system has generated from the Simulink model. You can also see the disassembled code that runs on the DSP chip. (a) In the main CCS area, youl see a window labeled Disassembly (followed by an identier). Make the window bigger and take a look at the disassembled machine code. (b) Look at the le browser (the left pane) in CCS. (c) Expand the Projects selection, then the audio delay.pjt selection, then Source. (d) Double-click on audio delay.c and an editor window will open so you can look through it. (e) Take a look at some of the other les made available in the Source directory. (f) Look at some of the other selections under audio delay.pjt, for example in the Include directory. 42. To show that the code is running on the DSP and not on the PC, close CCS and Matlab. The program will still be running on the DSP board. Test the board using the microphone and speakers. (Note that the program will be lost once the power is removed from the board.) Q3: Describe in a few lines, the purpose of Code Composer Studio.

Building the audio reveberation model


1. Open Simulink. 2. Create a new model by selecting File New Model from the Simulink menu bar. 3. Use Simulink blocks to create the following model. 4. The Integer Delay block is in Discrete library of the Simulink blockset. The Gain block is in the Commonly Used library of the simulink blockset. The Line In and Line Out block for the C6713 DSK are in the C6713 Board Support library of the Embedded Target for TIC6000 blockset. 5. From the TI C6000 Target Preferences block library, add the C6713DSK target preferences block. This block is not connected to any other block in the model. 6. Click the C6713 DSK ADC block to select it. Select Block Parameters from the Simulink Edit menu. Set the following parameters for the block: Select the +20 dB mic gain boost check box

Figure 4: Real time reveberation lter For Output data type, select Double from the list Set Scaling to Normalize Set Source gain to 0.0 Enter 64 for Samples per frame 7. For ADC source, select Mic In. 8. Click OK to close the Block Parameters: ADC dialog. 9. Now set the options for the C6713 DSK DAC block. Set Scaling to Normalize For DAC attenuation, enter 0.0 Set Overow mode to Saturate. 10. Click OK to close the dialog. 11. Open the Conguration Parameters dialog, select Solver on the Select tree, and set the appropriate options on the Solver pane for your model and for the target. Under Solver options, select the xed-step and discrete settings from the lists. Set the Fixed step size to auto and select Single Tasking for the Tasking mode. 12. Build and run the model (using the Incremental Build button on the model toolbar). 13. Speak into the microphone connected to the board. The model should generate a reverberation eect out of the speakers, delaying and echoing the words you speak into the mike. The rst version of this Lab was by Paul Beliveau. Revised 3/29/2012 by GM.

Вам также может понравиться