Create a new model and configure it for NXP Hardware
1
Table of Contents
• Introduction
• Prerequisites
• Creating a New Simulink Model
• Configure the Model for NXP Hardware
• Add Simulink Blocks
• Build the Model
• Flash and Run on Hardware
• References
• Conclusion
2
Introduction
Developing embedded applications for NXP microcontrollers—especially platforms like the S32K series—involves using tools such as MATLAB/Simulink (MBDT – Model-Based Design Toolbox), S32 Design Studio (S32DS), and EB tresos. This article walks through the key steps involved in creating a new model and configuring it properly for NXP hardware, focusing on a practical workflow used in automotive and embedded systems projects.
3
Prerequisites
Before starting, ensure the following tools are installed and correctly configured:
MATLAB & Simulink
NXP MBDT
S32 Design Studio / EB tresos
NXP RTD drivers
USB / JTAG debugger (e.g., PEMicro)
Target hardware (e.g., S32K344, S32K358)
In addition to having the required tools installed, it is important to ensure that all components are properly integrated and compatible with each other. This includes matching the MATLAB/Simulink version with the supported release of the NXP MBDT, as well as aligning the RTD package with the selected microcontroller and AUTOSAR version. Environment variables, compiler paths, and licensing (for MATLAB, Simulink, and EB tresos) should also be verified prior to starting development.
From a hardware perspective, make sure that the evaluation board or target ECU is correctly powered and that the debug interface (such as PEMicro) is functioning. Installing the appropriate USB drivers and checking connection through debug tools can prevent communication issues later in the workflow.
Finally, it is recommended to validate the toolchain setup by running a simple example, such as a GPIO toggle or LED blink application, either directly in S32DS or through an existing Simulink example provided by MBDT. This step helps confirm that code generation, compilation, flashing, and execution on the target hardware are all working correctly before moving on to a more complex development.
4
Creating a New Simulink Model
Step 1: Launch Simulink
Open MATLAB
Type simulink in the command window
Select Blank Model
Step 2: Save the Model
Save with a clear naming convention, e.g. s32k344_led_blink.mdl
5
Configure the Model for NXP Hardware
Step 3: Open Model Configuration Parameters
Navigate to Model Settings ( Ctrl + E ) → Hardware Implementation
Step 4: Select Hardware Board
Set Hardware board to the appropriate NXP target
For example, NXP S32Kxx
Step 5: Select a Configuration Template
Set Configuration Project Template to the appropriate NXP target
For example, S32K344-Q172 S32 Config Tool
If the board is not visible, ensure MBDT is properly installed.
6
Add Simulink Blocks
Using the Library Browser, configure hardware peripherals.
Step 6: Configure GPIO for LED
Add a Dio block
Configure:
Function: Dio_FlipChannel
Channel: e.g. DioLed0
Step 7: Add Level Variable
Add Data Store Memory and Data Store Write blocks
Connect the Dio block to the Data Store Write
This will blink an LED because the Dio_FlipChannel function toggles the logical state of the selected GPIO pin every time it is executed. By connecting it to a Data Store Write, you are effectively allowing the system to store or propagate the updated state within the model. The blinking frequency is directly controlled by the task rate of your model, which makes it easy to adjust the LED behavior simply by changing the sample time, without modifying the core logic.
In the Library Browser you will find numerous example projects that may be helpful (for example, s32k3xx_dio_s32ct ).
7
Build the Model
Step 8: Generate Code
Click Build Model ( Ctrl + B )
When you press the build button, Simulink automatically translates your model into C code and prepares it for execution on the target microcontroller. The generated files can be found in the project folder, where you can explore how each block was converted into embedded code. After generation, the toolchain creates an executable file and attempts to deploy it directly to the target board.
8
Flash and Run on Hardware
Step 9: Connect Target Board
Connect via debugger (USB / JTAG)
Step 10: Deploy
From Simulink (External Mode or Build & Deploy)
Or manually via S32 Design Studio
9
References
Quick Start Guide for S32K3X4EVB Board
Model-Based Design Toolbox (MBDT) – How To
10
Conclusion
Creating a new model and configuring it for NXP hardware involves:
Setting up the Simulink model
Configuring hardware-specific parameters
Adding peripheral blocks
Generating and deploying embedded code
This workflow enables rapid prototyping and production-ready embedded development, especially in automotive systems leveraging AUTOSAR and NXP platforms.
Developing embedded applications for NXP microcontrollers—especially platforms like the S32K series—often involves using tools such as MATLAB/Simulink (MBDT – Model-Based Design Toolbox), S32 Design Studio (S32DS), and AUTOSAR tools like EB tresos. This article walks through the key steps involved in creating a new model and configuring it properly for NXP hardware, focusing on a practical workflow used in automotive and embedded systems projects.
記事全体を表示