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.
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).
Infineon AURIX TC4x - TriBoards
Complete the following tutorial:
Launch hardware setup and install the following third-party tools. For more information, see .
iLLD for TC4x family
TASKING SmartCode for TriCore
To run this example, you will need the following hardware:
Supported Infineon AURIX TC4x board (STD or COM)
To open the model, enter the following command in the MATLAB prompt:
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
The model generates Pattern 1, when the D flip-flop outputs
0 and Pattern 2 when it outputs
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.
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. To generate the code for the model tc4x_8ledsBlinky, press Ctrl+B or click Build.
2. Follow the build process by opening the diagnostic viewer using the link provided at the bottom of the model canvas.
If you are trying to deploy the code on the hardware board using Lauterbach (Trace32) debugger or PLS UDE Microcontroller debugger, refer to their respective documentation.
The support package includes a pre-configured model model that you can start off with.
Other Things to Try
Run the example in virtual platform (VP) environment. For more information on installation and set-up procedures for the VDK for IFX TC49x VP product family, refer to VDK for IFX TC49x VP Installation Guide.
Run the example on different Infineon AURIX TC4x Microcontrollers by changing the package class and pinout options and analyze the results.