TI+Lab+2 Intro to Model Based Design With Simulink Manual

March 29, 2018 | Author: Sashikanth Betha | Category: Digital Signal Processor, Matlab, Embedded System, Real Time Computing, C (Programming Language)


Comments



Description

DSP Programming Lab 2 for TI 6713 DSP Eval BoardIntroduction to Model-based Design Using MATLAB/Simulink, Code Composer Studio, and the TI 6713 DSK This lab is mostly based on the Mathworks webinar, “Implementation and Verification on TI DSPs with Link for Code Composer Studio++ 3.0" located at: http://www.mathworks.com/cmspro/webconf15055.html The webinar takes approximately 1 hr to watch uninterrupted. Watch this prior to performing this lab if possible. Not all parts of the webinar can be performed in the lab, such as the Processor in the Loop function, without Real Time Workshop Embedder Coder. Additional procedures are described not included in the webinar. Hardware Requirements: TI 6713 DSK PC Software Requirements: Mathworks Products - MATLAB R2007a - Simulink - Signal Processing Toolbox - Signal Processing Blockset for Simulink - Real Time Workshop (w/o Embedder Coder) - Link for Code Composer Studio - Embedded Target for TI C6000 DSP Texas Instruments Products - Code Composer Studio 3.1 (available with the TI 6713 DSK) NOTE: MATLAB 2007b products are not compatible with Code Composer Studio (CCS) 3.1 which is what we have available. You must instead use version 2007a. Installation: 1. Ensure that all of the software products are installed. They should be. Hardware Setup 1. Connect the TI 6713 eval board to the PC using the USB cable. 2. Connect power to the board. 3. Don’t press any buttons on the board. PART 1: CREATE A CCS PROJECT FROM A SIMULINK MODEL 1. Make sure that the 6713 Simulator is setup in CCS a. Close CCS if open b. Clear MATLAB workspace variables c. Go to Start Programs Texas Instruments Code Composer Studio 3.1 Setup Code Composer Studio v3.1 d. Ensure that “C6713 Device Cycle Accurate Simulator” is included in your System Configuration tree on the left. If not, find it in the center window on the Factory Under Link to IDE. When the parallel Debug Manager appears. 2. Figure 1 4. ii. Double-click on the Custom Board block a. b. You can find the Chirp block under the Signal Processing Blockset within the DSP Sources group. and connect them as shown above. A Simulink model similar to Figure 1 below should appear. Under Board Properties. Click the play button and then double click on the Time Scope to ensure that the model runs in Simulink and that an output signal is generated. Go back to the MATLAB command window. and type ‘dspafxr’ to open up the example reverb model in Simulink. Go to Target Preferences c. and the Time Scope is located in the DSP Sinks group. this will open the Simulink Library Browser. and go back to the example reverb model. double click on the TMS3206713 and this will open up the CCS main window for this device.cmd file (Memory map settings) which is generated by Link for CSS when the project is built. and drop these into the model if they don’t already exist. . The Custom Board will automatically set many of the Real Time Workshop settings. Notes: The Memory Tab settings will determine the content of the . 3. Go to the Link for Code Composer blockset b. 5. 6. drag. The Sections tab allows you to specify which sections of code get placed in which sections of memory. select the C6713 in the Processor field. You should adjust the model to look Figure 1 above. select Yes. Click OK to accept the changes. or type ‘simulink’ in the Matlab command window. If you click on the colorful button shown in the top right of Figure 1. select “C6713 Device Cycle Accurate Simulator” i. You may have to delete some of the other junk in the model. add the Chirp source and Time Scope sink.Boards tab and select Add at the bottom. Drag the ‘Custom Board’ block into the model. c. 7. Click. Then select ‘Save and Quit’. Check the Simulator check box. Open up the Simulink Library Browser a. When you asked if you would like to open CCS. 8. 13. This is the Mathworks version of Chip Support Library ii. Go back again to Start Programs Texas Instruments Code Composer Studio 3.h files to implement the algorithms described by the Simulink model Created by Link for Code Composer Studio . . Close CCS. 9. 5. Go back to the CCS window and look at the generated code. It also defines local I/O variables. Within the C6713 DSK Board Support group. o Memory Map .c file i. always clear your MATLAB workspace variables.1 4. 7. Note: In general. Under the Source folder. Summary of Generated Files in the CCS Project Created by Real Time Workshop . go to Real Time Workshop Link for CCS a. Find the MW_c6XXX_csl.c file. In the Parallel Debug Manager window. b. 2. 12. Find the <model name>_Project Generator. double-click on the ‘CPU_1’ processor and the CCS window for that device will open. 10. In the Select tree on the left. every time want to rebuild a project from Simulink to CCS. and go back to your model.c and . Press F7 to build the code. Go back to your reverb example model. This should include the Model Step function which is the main function for the primary algorithm.e. i. find the <model name>.1 Setup Code Composer Studio v3.cmd i. Press Ctrl+B to create the project in CCS... a. It contains all interrupt service routines (if any) and time code/config d. a. Open the Simulink Library Browser and go the Embedded Target for C6000 DSP blockset. set Build Action to ‘Create Project’ 11. 8. 1. 3. Go to Simulation Configuration Parameters. you will use the Embedded Target for C6000 DSP blockset to implement an audio processing algorithm on the target processor using the audio inputs and output on the board. c. Delete the Chirp source and Time Scope sink from the model.LED . Press ‘Save and Quit’ and choose to open up CCS.Reset.The processor specific files (i. This contains the memory map settings generated by Link for CCS 14. those required to implement the algorithm specifically on the TI 6713 processor) that the designer would normally have to write manually. DAC . The ADC and DAC blocks can be used in your Simulink model for your inputs and outputs and will provide generated code to configure the codec and 6713 peripherals. you will find several blocks including the ADC . 6. or just type Ctrl+E. Clear your MATLAB workspace variables a. Drag an ADC block into your reverb model and place it as the Source where the Chirp was previously.CMD files o Real Time scheduler and timer code o Interrupt handling code PART 2: BUILD AND EXECUTE A SIMULINK MODEL ON THE TARGET PROCESSOR In this part of the lab. Find the <model name> data. Accept the settings. and DIP Switch.9. close Configuration Parameters. This contains all of the parameters set in the Simulink model. Click on the C6713 Device Cycle Accurate Simulator and click Remove to remove it from your System Configuration on the left. Under ’Runtime’ .c file i. build the project code. At the command prompt. One can repeatedly Connect and Disconnect the target by pressing Alt + C . go back to your model. Note the other possible settings. Under Runtime. Make ‘Simulator’ unchecked b. Press Ctrl+B . press Ctrl + B to build and execute. Notice that a drop down allows you to select between the Line In or Mic In. Go back to MATLAB to the command window. although nothing should need to be changed for this example. d. Under ‘Code Generation’. a. 4. b. and listen through speakers connected to the Line Out port. ‘CCS_Obj’ b. Double-click on the ADC block. keeping in mind that this affects the reverb time constant. Press Ctrl – E to access Configuration Parameters. a. 13. In the Select tree under Real Time Workshop Link for CCS. 20. go back to Code Composer Studio and make sure that the target is connected. This target preferences block is already configured for the TI 6713 DSK. . because the Build Action was set to Build and Execute in your Configuration Parameters settings. 16. a. No additional changes to this block are needed for this example. Let it run for a few seconds and then press Shift + F5 to halt the program. Test the algorithm by sending line level audio into the Line In port. 12. and the default settings should be fine. Drag a DAC block into the model and connect it at the reverb output where the Time Scope was located. Go to CCS. After the target it connected. ensure that under Runtime the ‘Build Action:’ is set to Build and Execute. Set ‘Operating System’ to none d. The other options are pretty much self explanatory. Double-click on the DAC block. Find the C6713DSK block and drag it into the model. At your Simulink model. Double click on the Target Preferences block. Click OK to save changes and close the window. ensure that the Build and Execute is selected. An indicator is in the bottom left corner of the window. Go to Simulink Library Browser Target for TI C6000 C6000 Target Preferences 15. Click on the Custom Board block and delete it. 19. Press Ctrl+E to access the Configuration Parameters. An HTML report will be generated that describes some of the performance stats. this action will sequentially create the CCS project. 21. 17. Notice in the workspace . check the box for ‘Profile real-time task execution’ c.10. Set it to Line in for this example. type: profile_execution(CCS_Obj) 5. 11. click on :Real Time Workshop Link for CCS b. It will generate a project in CCS and begin running. Prior to building the model. Set the input sampling rate to any option for this example. In the Select tree on the left. a. c. 18. Make ‘High Speed RTDX’ checked c. a. 6. and the begin running the algorithm on the target board. 3. 14. The Figure generated will also illustrate the used/remaining time for the clock rate. Brief Intro to Profiling 1. Click OK to save changes and close out target preferences window 2. In this case. The trick here is use the switch to increment through a range of values. delay. Use another DIP Switch to adjust one or more of these other parameters. This can all be done with the same Simulink model.e. Once your new algorithm is performing properly. This is shown in Figure 2 below. The top port is an indexing port. 7.PART III: CREATE YOUR OWN AUDIO SIGNAL PROCESSING ALGORITHM In this part of the lab you will create your own signal processing algorithm and use the DIP Switch and LED blocks located with the Target for TI C6000 Library to enable use of the DIP Switches and LEDs on the 6713 board to control your algorithm in real time. In order to do this.wav out. read the description of the DIP Switch block located in the Target for TI C6000 library and also see the help for ‘C6713 DSK DIP Switch’. You can do this by cutting the reverb model and pasting it into a new Subsystem block. Furthermore. While the top port is given a 1 it will select the 1st input port and when given a 2 it will select the 2nd. or the wet/dry mix. or . the delay time. 2. you will have to use a combination of other simulink blocks such that when the DIP Switch is toggled. 3. etc) 4. your reverb model in Figure 1 contains a few different parameters that you might want to change in real-time such as the feedback gain. you want to use the LEDs on the eval board to indicate which algorithm is running. To figure out how to use the DIP Switch. 6. Figure 2 5. Create a new subsystem performing an audio signal processing algorithm of your choice. Contain this within an additional Subsystem block as you did with the reverb. setup the model so that you can switch between the reverb subsystem and your new algorithm in real time using one of the DIP Switchs. A signal sent into the input port should be reverberated at the output port. The goal is to push a momentary DIP Switch on the eval board and switch between your algorithm and the reverb. a Time Scope. Examples might include a simple tremolo. Both may be running simultaneously. etc) and monitoring it with a sink (i. Use the LED block from the same library in your model to accomplish this task. One possible method is use a counter. Use the Subsystem block under the Common blockset and place the reverb model into it’s own system. etc. Test your new algorithm by feeding it will a source (i. a filter. . One possible method is use a counter. You might want to have one LED lit for one algorithm and a different LED for the other.e. Furthermore. a . distortion. You’ll need to use a Multi-port Switch located in the Signal Routing library. You can change the number of inputs and use the same scheme for any desired number of input ports.wav file or chirp. either a constant 1 or a constant 2 is provided to the index port of the Multi-port switch. but only the output of one is sent to the DAC. So far you’ve created a simple reverb model. while the bottom two are the selectable input ports. 1.
Copyright © 2024 DOKUMEN.SITE Inc.