HIL Verification of IIR Filter via SCI
This example shows HIL verification of an IIR filter using serial communication interface between a host simulation and generated code on a TI C28x processor.
Required hardware:
- Spectrum Digital F2808 eZdsp
- Spectrum Digital F2812 eZdsp
- Spectrum Digital F28044 eZdsp
- Spectrum Digital F28335 eZdsp
On the following boards the embedded xds100 JTAG can be used as a serial connection over USB. Jumper and switch settings with appropriate FTDI drivers are required to use this serial communication technique.
- Texas Instruments™ F2808/F28027/F28035/F28044/F28069/F28335/F28343/F28346 ControlCARD with docking station
- Texas Instruments™ F28027/F28069 ControlSTICK
Available versions of this example:
This example model c2000scitest.mdl can be used for all boards.
Contents
Host Model
The following figure shows the host model:
Target Model
The following figure shows the target model:
Description
This example shows HIL verification of an IIR filter using serial communication interface between a host simulation and generated code on an c28x processor-based target board.
Based on the position of the manual switch, either a saw-tooth or sine waveform is passed to the Host-side SCI Transmit block and sent to the target. The stream of data is received from the target the via Host-side SCI Receive block and sent to the Simulink® scope block.
The same algorithm runs on the target and the host side at the same time. The scope displays three signals showing the result of the simulation compared with the result of the algorithm running on the target. Because the algorithm uses an IIR filter, its output is therefore dependent on every sample time that occurs from the beginning of the simulation. Using an IIR filter clearly shows the time consistency between the simulation and the generated code.
You can add a delay in the simulation by using the "Show Delayed Output" switch. This delay can be used to verify the time consistency between both models.
Hardware Connections
- Connect the RS232 connector of your computer to the RS232 connector of the F28xx chip-based board.
- F2812 eZdsp is not equipped with RS232 transceivers. You must add RS232 transceivers to this board to run this example.
- ControlCARDs with Docking Stations, ControlSTICK boards can support serial over the xds100 USB JTAG connection. Jumper and switch settings with appropriate FTDI drivers are required to use this serial communication technique.
How to Run the Example
The following sections explain how to configure, build, and deploy the executable.
Note: the host model is set to use "COM1". The "SCI Setup", "SCI Transmit" and "SCI Receive" blocks have to be configured to a different COM port if needed.
With Code Composer Studio v3.3 (CCSv3.3) - Default
- Open the model c2000scitest.mdl
- Double-Click on "Open Target-Side Model Default F28335". This opens the target model.
- The model is configured by default for the F28335 processor. Open the Model Configuration Parameters dialog and select "Coder Target" under "Code Generation". Next, click "Target Hardware Resources" dialog to select a different processor.
- Go to "Peripherals" > "SCI_A", and change the "Communication mode" to "Protocol".
- Click "OK".
- Click "Build Model" button or press "Ctrl+B" to generate, build, load and run the program on the target.
- Click "Run" to simulate the model c2000scitest.mdl
Change the manual switch position to select a different input signal.
With Code Composer Studio v4 (CCSv4)
CCSv4 support is provided via a makefile based approach. This requires running xmakefilesetup to set the environment. You can ignore the following if you have already gone through these steps. For more information, please refer to the Xmakefile Documentation
- Run XMakefile User Configuration.
- Set the Template parameter to "gmake".
- Uncheck the "Display operational configuration only" checkbox.
- Set the Configuration parameter to "ticcs_c2000_ccsv4", click "Apply", if you haven't used this tool before, a dialog will ask you to browse to your CCSv4 installation folder. Pick the right folder and click "OK".
- Click on the "Tool Directories" and make sure that the paths are pointing to directories matching your installation. For example:
- C:\Program Files\Texas Instruments\ccsv4\ for "CCS Installation".
- C:\Program Files\Texas Instruments\ccsv4\tools\compiler\C2000\ for "Code Generation Tools".
- C:\Program Files\Texas Instruments\bios_5_41_10_36\ for "DSP/BIOS Installation".
Code Generation and Creation of an .out file using CCSv4:
- Open the model c2000scitest.mdl.
- Double-Click on "Open Target-Side Model Default F28335". This opens the target model.
- Open the "Target Hardware Resources" dialog and set the IDE/Tool chain parameter to "Texas Instruments Code Composer Studio v4 (makefile generation only)".
- Change the selected board and processor to match your hardware.
- Go to "Peripherals" > "SCI_A", and change the "Communication mode" to "Protocol".
- Click "OK".
- Click "Build Model" button or press "Ctrl+B" to generate and build an .out executable file.
- Using CCSv4, connect to the Hardware and load and run the .out file.
- Now simulate the model c2000scitest.mdl.
Change the manual switch position to select a different input signal.
With Code Composer Studio v5 (CCSv5)
CCSv5 support is provided via a makefile based approach. This requires running xmakefilesetup to set the environment. You can ignore the following if you have already gone through these steps. For more information, please refer to the Xmakefile Documentation
- Run XMakefile User Configuration.
- Set the Template parameter to "gmake".
- Uncheck the "Display operational configuration only" checkbox.
- Set the Configuration parameter to "ticcs_c2000_ccsv5", click "Apply", if you haven't used this tool before, a dialog will ask you to browse to your CCSv5 installation folder. Pick the right folder and click "OK".
- Click on the "Tool Directories" and make sure that the paths are pointing to directories matching your installation. For example:
- C:\ti\ccsv5\ for "CCS Installation".
- C:\ti\ccsv5\tools\compiler\c2000\ for "Code Generation Tools".
- C:\ti\bios_5_41_11_38\ for "DSP/BIOS Installation".
Code Generation and Creation of an .out file using CCSv5:
- Open the model c2000scitest.mdl.
- Double-Click on "Open Target-Side Model Default F28335". This opens the target model.
- Open the Model Configuration Parameters dialog and select "Coder Target" under "Code Generation". Next, click "Target Hardware Resources" dialog and set the IDE/Tool chain parameter to "Texas Instruments Code Composer Studio v4 (makefile generation only)".
- Change the selected board and processor to match your hardware.
- Go to "Peripherals" > "SCI_A", and change the "Communication mode" to "Protocol".
- Click "OK".
- Click "Build Model" button or press "Ctrl+B" to generate and build an .out executable file.
- Using CCSv5, connect to the Hardware and load and run the .out file.
- Now simulate the model c2000scitest.mdl.
Change the manual switch position to select a different input signal.