An Overview of Application specific Programming of the Texas Instruments TMS320C6711 using Simulink<br />Amit Prakash Singh<br />IDD V E&C (Wireless Communications)<br />Introduction<br />The TMS320C67x DSPs (including the TMS320C6711, TMS320C6711B, TMS320C6711C, TMS320C6711D devices) compose the floating-point DSP family in the TMS320C6000 DSP platform. The C6711, C6711B, C6711C, and C6711D devices are based on the high-performance, advanced very-long-instruction-word (VLIW) architecture developed by Texas Instruments (TI), making these DSPs an excellent choice for multichannel and multifunction applications. The steep learning curve one needs to go through, before any significant use of this instrument can be made, makes it desirable for me to share the knowledge acquired in this area, in course of my Masters Project. The C6711 DSK has been discontinued and now C6713 DSK with more advanced capabilities has taken its place but the same principles apply and this document can be used with the newer DSK as well.<br />About the DSK 6711<br />The Texas instruments TMS320C6711 DSP kit provides an extremely sophisticated set of hardware and software support tools for the real time signal processing. The DSK board includes the 6711 floating point digital signal processor and a 32 bit codec AD 535 for input and output. The basic system consists of an analog-to-digital converter (ADC) to capture an input signal. The resulting digital representation of the captured signal is then processed by DSP and output through a digital-to-analog converter. Code Composer Studio software provided by Texas Instruments is used for writing into 6711 kit.<br />1.8V Power Supply16M SDRAM128K FLASHDaughter Card I/F(EMIF Connector)ParallelPort I/FPowerJackPowerLED3.3V Power SupplyJTAG HeaderEmulationJTAG HeaderResetLine Level Output (speakers)Line Level Input (microphone)16-bit codec (A/D & D/A)Three User LEDsUser DIPswitches‘C6711DSPD. Card I/F(Periph Con.)TMS320C6711<br />Figure 1: A block diagram of the DSK<br />Figure 2: DSK Connections<br />Power on Self Test<br />
There are three LEDs to provide the user with feedback from the test procedure.
The test program (stored in the FLASH memory, code available on the DSK CD-ROM) runs every time DSK is powered on and reset.
B L I N K A L L All tests completed successfully
Resetting the DSK<br />TMS320C6711 Apply PowerPOST runsCCS ResetMenu selection:DebugDSP ResetResets ‘C6711 DSPCauses bootloadfrom FLASH which overwrites internal memoryAbsolute ResetOn rare occasions you might have to:Pull power jackPull parallel portReset PushbuttonDon’t push when CCSis runningDoes not force FULLsystem resetTo fully reset board, pull power plugPower On Self Test (POST)Counts 1 - 74: mic input spkr out5: sinewave spkr outDon’t start CCS until end (all 3 LEDs flash at the end)If switches are set to 0100, a fast version of POST is run<br />Figure 3: Various Modes of resetting the DSK<br />Programming the DSK with Simulink <br />Target for TI C6000 integrates Simulink® and MATLAB® with Texas Instruments eXpressDSP™ tools. The software collection helps to develop and validate digital signal processing designs from concept through code. Target for TI C6000 consists of the TI C6000 target that automates rapid prototyping on theC6000 hardware targets. Target for TI C6000 uses C code generated by Real-Time Workshop® and the TI development tools to build an executable file for your intended processor.<br />The Real-Time Workshop build process loads the specified machine code to the board and runs the executable file on the digital signal processor. Target for TI C6000 uses Simulink to model digital signal processing algorithms from blocks in the Signal Processing Blockset, and then uses Real-Time Workshop to generate (or build) ANSI C code targeted to the Texas Instruments DSP development boards or Texas Instruments Code Composer Studio Integrated Development Environment (CCS IDE). Target for TI C6000 takes the generated C code and uses Texas Instruments (TI) tools to build specific machine code depending on the TI board used.<br />The build process downloads the targeted machine code to the selected hardware and runs the executable on the digital signal processor. After downloading the code to the board, the digital signal processing (DSP) application runs automatically on your target. <br />All the features provided by Code Composer Studio (CCS), such as tools for editing, building, debugging, code profiling, and project management, work to help develop applications using MATLAB, Simulink, Real-Time Workshop, and the supported hardware. When this target is used, the build process creates a new project in Code Composer Studio and populates the project with the files the project requires.<br />An Example with Simulink: Audio Reverberation Model <br />The demonstration model name is c6711dskafxr.mdl (already available in MATLAB) as shown in the next figure. Open this model by entering c6711dskafxr at the MATLAB prompt. To run this model you need a microphone connected to the Mic In connector on your C6711 DSK, and speakers and an oscilloscope connected to the Line Out connector on your C6711 DSK. To test the model, speak into the microphone and listen to the output from the speakers. You can observe the output on the oscilloscope as well. To download and run your model on your C6711 DSK, complete the following tasks:<br />
Use Simulink blocks, Signal Processing Blockset blocks, and blocks from other blocksets to create your model application.
Add Target for TI C6000 blocks that let your signal sources and output devices communicate with your C6711 DSK—the C6711 DSK ADC and C6711 DSK DAC blocks that you find in Target for TI C6000 c6000lib blockset.
Add the C6711DSK target preferences block from the Target Preferences library to your model. Verify and set the block parameters for your hardware. In most cases, the default settings work fine.
Set the configuration parameters for your model, including Solver parameters such as simulation start and solver options. Real-Time Workshop options such as target configuration and target compiler selection
Build your model to the selected target .Test your model running on the target by changing the input to the target and observing the output from the target. The target for this tutorial is your C6711 DSK installed on your PC.
Building the Audio Reverberation Model<br />To build the model for audio reverberation, follow these steps:<br />
Create a new model by selecting File > New > Model from the Simulink menu bar.
Use Simulink blocks and Signal Processing Blockset blocks to create the following model.
Figure 4: Simulink Model<br />Now add the C6711 DSK blocks to the model<br />Figure 5: Simulink Model with C6711/13 blocks<br />Configuring Target for TI C6000 Blocks<br />To configure Target for TI C6000 blocks in your model, follow these steps:<br />1 Click the C6711 DSK ADC block to select it.<br />2 Select Block Parameters from the Simulink Edit menu.<br />3 Set the following parameters for the block:<br />
7 Click OK to close the dialog box.<br />8 Click the C6711DSK Target Preferences block.<br />9 Select Block Parameters from the Simulink Edit menu.<br />10 Verify the parameter settings for the C6711 DSK target. <br />Setting Simulink Configuration Parameters<br />After you have designed and implemented your digital signal processing model in Simulink, complete the following steps to set the configuration parameters for the model:<br />1 Open the Configuration Parameters dialog box and set the appropriate options on the Solver category for your model and for Target for TI C6000.<br />
Set Start time to 0.0 and Stop time to inf (model runs without stopping). Generated code does not honor this setting if you set a stop time. Set this to inf for completeness.
Under Solver options, select the fixed-step and discrete settings from the lists
Set the Fixed step size to Auto and the Tasking Mode to Single Tasking
Ignore the Data Import/Export, Diagnostics, and Optimization categories in the Configuration Parameters dialog box. The default settings are correct for your new model.<br />Setting Real-Time Workshop Target Build Options<br />To configure Real-Time Workshop to use the correct target files and to compile and run your model executable file, you set the options in the Real-Time Workshop category of the Configuration Parameters dialog box. Follow these steps to set the Real-Time Workshop options to target your C6711 DSK:<br />1 Select Real-Time Workshop on the Select tree.<br />2 In Target selection, click Browse to select the system target file for C6000 targets—ccslink_grt.tlc. It may already be the selected target. Clicking Browse opens the System Target File Browser.<br />3 On the System Target File Browser, select the system target file ccslink_grt.tlc and click OK to close the browser. Real-Time Workshop updates the Template makefile and Makecommand options with the appropriate files based on your system target file selection. <br />4 From the Select tree, choose Link for CCS to specify code generation options that apply to the C6711 DSK target.<br />5 Under Code Generation, select the Inline run-time library functions option. Clear the other options.<br />6 Keep the default setting for the options in Project options.<br />7 Under Target Selection, verify that Export IDE link handle to base workspace is selected and provide a name for the handle (optional).<br />8 Change the category on the Select tree to Hardware Implementation.<br />9 Check that Byte ordering is set to Little endian.<br />10 Change the category again to Link for CCS.<br />11 Set the following Real-Time Workshop run-time options:<br />
Building and Executing Your Model on Your C6711 DSK<br />After you set the configuration parameters and configure Real-Time Workshop to create the files you need, you direct Real-Time Workshop to build, download, and run your model executable on your target:<br />1 Change the category to Real-Time Workshop on the Configuration Parameters dialog box.<br />2 Clear Generate code only and click Build to generate and build an executable file targeted to your C6711 DSK.<br />When you click Build with Build_and_execute selected for Build action, the automatic build process creates an executable file that can be run by the C6711 DSP on your C6711 DSK, and then downloads the executable file to the target and runs the file.<br />3 To stop model execution, click the Reset C6711 DSK block or use the Halt option in CCS. You could type halt from the MATLAB command prompt as well.<br />Another Example: Finding an Unknown Frequency<br />There are 2 parts to this example. <br />Part 1 : Setting up the circuit and executing the algorithm on DSP. <br />Part 2 : Exchanging values between DSP and PC. <br />The Signal generator is tuned to generate a sine wave of any frequency between 500 and 1000 Hz. Then this signal of unknown frequency is fed into the DSP through its’ Audio In port. The algorithm is executed on the DSP board. The frequency calculated by the board will be found to exactly match the frequency of the Signal.<br />There are quite a few ways to find the time-period / frequency of an unknown signal. We shall show the DSP implementation of one such technique. <br />Suppose the guessing range is within 500 to 1000 Hz. This would correspond to a range in time-period (1/fs) of (1/1000 = ) 1 msec to ( 1/500 = ) 2 msec. Since DSK 6711 supports a sampling frequency of 8000 Hz, the range in time-period would correspond to: -<br />
Now, Auto-correlation function (ACF) gives values of the correlation at different values of lag (τ). So if a signal of unknown frequency, is present its’ ACF plot looks like Figure below, <br />Figure 6: Auto Correlation Function of Input Signal<br />This process of guessing the unknown time-period / frequency by using the signal’s ACF is exactly what is done using the DSP. <br />Figure 7: Simulink Model<br />Note that the Sub-Matrix block is required to override the presence of a maxima at lag = 0. The maxima within the range of 8 to 16 samples is what is of interest. <br />By the above process, the value of the unknown frequency is calculated. The value remains calculated and sits pretty within the DSP. However, as the DSP does not have a monitor/output screen, there is no way of accessing the calculated value! RTDX or Real Time Data Exchange can be used to access this value.<br />Troubleshooting the DSK<br />
Connect the power and observe the Power On Self-Test (POST). If the POST sequence (as given in a previous section ) is OK it means that the DSK is working properly.
Check the Parallel Port cable from the DSK to Computer. A loose cable can cause the DSK to not be detected correctly.
If working on Older Computers remember to set your parallel port to SPP or EPP. Failure to do this will cause the DSK not to be detected.
If the while running the Code CCS hangs, be patient and wait for an error message to appear. Do not attempt to forcibly close CCS as if CCS is forcibly closed the board will not run unless the Computer is restarted.
If you get memory Map errors reset the DSK (through CCS) and try again. If this fails turn the power to the DSK off and then on (This may cause CCS to hang for a while).
Always remember to close CCS before switching off the DSK.
Similarly the DSK should be switched on first and then the code should be generated from Simulink (CCS will open automatically during the process).