Getting Started with Embedded Coder Support Package for Infineon AURIX TC4x Microcontrollers
This example shows how to use Embedded Coder® Support Package for Infineon® AURIX™ TC4x Microcontrollers to run a Simulink® model on Infineon AURIX TC4x board.
Introduction
Embedded Coder® Support Package for Infineon® AURIX™ TC4x Microcontrollers enables you to generate a real-time executable file and download it to your Infineon AURIX TC4x Microcontroller. The support package includes a library of Simulink blocks that you can use to configure and access Infineon AURIX TC4x Microcontrollers peripherals and communication interfaces.
In this example you will learn how to configure a simple Simulink model to generate code for Infineon AURIX TC4x and to run the generated code on the board to periodically turn an LED on and off in different patterns based on pressing a user button (black button).
Supported Hardware
Infineon AURIX TC4x - TriBoards
Required Software
Launch hardware setup and install the following third-party tools. For more information, see Supported Hardware and Required Software.
iLLD for TC4x family
TASKING® SmartCode for TriCore
Infineon DAS
Required Hardware
To run this example, you will need the following hardware:
Supported Infineon AURIX TC4x board (STD or COM)
USB cable
Available Models
Simulink Model
This example demonstrates how to make an LED light blink in two patterns. The two patterns are controlled by an input switch, switch P33.11
connected to the board.
The different patterns can be observed on the eight LEDs connected to the onboard (P33.0, P33.1, P33.4, P33.5, P13.0, P13.1, P13.2, P13.3). When the switch detects a leading edge, the output of the D Flip-Flop block toggles between 0
and 1
.
The model generates Pattern 1, when the D flip-flop outputs 0
and Pattern 2 when it outputs 1
.
Pattern 1: LEDs blink from right to left and vice versa.
Pattern 2: LEDs on the alternate pins blink.
Review Infineon Block Library
Embedded Coder Support Package for Infineon AURIX TC4x Microcontrollers enables you to create algorithms by using the blocks that you can add to your Simulink® model. The blocks are used to configure the associated sensors and actuators, as well as to read and write data to sensors and actuators.
1. Enter slLibraryBrowser
at the MATLAB® prompt. This opens the Simulink Library Browser.
2. In the Simulink Library Browser, navigate to Embedded Coder Support Package for Infineon AURIX TC4x Microcontrollers > AURIX TC4x.
3. Double-click the Digital Port Read and Digital Port Write blocks. Review the block mask, which contains a description of the block and parameters for configuring the associated Infineon digital output pin.
Configure and Run the Model on Supported Infineon Hardware
In this task, you will configure and run your model on the supported Infineon AURIX™ board.
1. Connect the Infineon board to your computer with a USB cable.
2. In your Simulink model, press Ctrl+E or click Modeling > Model Settings to open Configuration Parameters dialog box.
3. Select the Hardware Implementation pane and select your required Infineon hardware from the Hardware board parameter list. Do not change any other settings.
4. Enter the following command in the MATLAB® prompt:
For Virtual Prototyping(VP) simulation:
Ts = 1e-3
For hardware deployment:
Ts = 1
5. Click OK.
Generate Code for Microcontroller
1. Open the tc4x_8ledsBlinky model.
2. Click Build, Deploy & Start on the Hardware tab to deploy the target model to the hardware.
3. Follow the build process by opening the diagnostic viewer using the link provided at the bottom of the model canvas.
Note: If you are trying to debug the genrated code using Lauterbach (Trace32) debugger or PLS UDE Microcontroller debugger, refer to their respective documentation.
Other Things to Try
Run the example in virtual prototyping (VP) to build and test your model without using the Infineon AURIX hardware board.
Run the example on different Infineon AURIX TC4x Microcontrollers by changing the package class and pinout options and analyze the results.