NXP S32K1xx MATLAB & Simulink Developer Environment Setup
The following documentation details how to set up MATLAB and Simulink for NXP S32K1xx embedded development.
Table of Contents
1 Initial Software Installs / Setup
1.1 MATLAB* and Add-ons*
MATLAB + Add-ons* only for Windows.
- Some MATLAB packages are only supported for Windows:
- Simulink.
- Embedded Coder.
- Simulink Coder.
- Stateflow.
- NXP Support Package S32K1xx.
2 Step-by-Step Setup
2.1 Opening NXP Support Package S32K1xx
2.1.1 Finding the Add-on
Open up MATLAB Add-Ons → Add-On Manager.
- Right-click on the previously installed
NXP Support Package S32K1xx
and select Open Folder.
2.1.2 Running the MATLAB Script
Run the NXP_Support_Package_S32K1xx.m
file.
- If you're new to MATLAB, it's under EDITOR → Run.
2.1.3 Script GUI
The Support Package window should open.
- After completing each sub-step, the clickable buttons should turn green.
- The web page for both download
Files
andLicense Keys
pages (NXP Model-Based Design Toolbox for S32Kxx Automotive Microprocessors Family
) should look something like this:
2.2 S32Kxx Model-Based Design (MBT) Toolbox Install
2.2.1 Download
Download the newest version of the MBT Toolbox.
- As of writing (
2024-01-28
), the window for setting up version4.3.0
:
Use the recommend link options below (in order of highest to least recommended):
You can use the newly opened window, but it and NXP's website is super buggy!
- Embedded Software Shared Google Drive Copy
- NXP's Software Portal
"Download button" ↓ Automotive SW - Model-Based Design Toolbox ↓ NXP Model-Based Design Toolbox for S32Kxx Automotive Microprocessors Family ↓ NXP_MBDToolbox_S32K1xx_?.?.?_????????.mltbx
- NXP Product Page
Automotive SW - Model-Based Design Toolbox ↓ NXP Model-Based Design Toolbox for S32Kxx Automotive Microprocessors Family ↓ NXP_MBDToolbox_S32K1xx_?.?.?_????????.mltbx
2.2.2 Install
Go back to the NXP Support Package S32K1xx
GUI and click
the Install MLTBX File as Add-On
button, direct to the installed /
extracted .mltbx
file.
2.2.3 Verify Install
You should now see NXP_MBDToolbox_S32K1xx
on your Add-On manager.
2.3 S32Kxx Model-Based Design (MBT) Toolbox License
2.3.1 Obtain Host ID
You will be promoted for a Host ID later on. The Host ID is either a Volume Serial Number or a MAC address that restricts your license to 1 computer.
- Note: The license is removable / reversible.
To get your Host ID follow the terminal commands bellow:
2.3.1.1 Windows
Host ID is either the Volume Serial Number of MAC address.
vol c:
getmac -v
2.3.1.2 macOS
Host ID is the MAC address of the en0 device.
ifconfig en0 | grep ether
2.3.1.3 Linux
Host ID is the MAC address any interface. If interfaces are enumerated, use the lowest-enumerated interface.
/sbin/ifconfig <interfaceName>
2.3.2 Generate License File
Go to NXP Software Portal for Downloads and Licenses.
Use the recommend link options below (in order of highest to least recommended):
- NXP's Software Portal
"Download button" ↓ Automotive SW - Model-Based Design Toolbox ↓ NXP Model-Based Design Toolbox for S32Kxx Automotive Microprocessors Family ↓ License Keys ↓ Add with Host ID
- NXP Product Page
Automotive SW - Model-Based Design Toolbox ↓ NXP Model-Based Design Toolbox for S32Kxx Automotive Microprocessors Family ↓ License Keys ↓ Add with Host ID
2.3.3 Download License File
The license file might auto download (does not most of the time).
Copy the contents of the license key generated and save it to a file called
license.dat
.
- If you're on windows create a
license.txt
file with Notepad. Paste the file contents, save the file, close, and then rename the filelicense.dat
.
The final result should be a .dat
file with the license key information.
2.3.4 Activate License File
Go back to the NXP Support Package S32K1xx
GUI and click
the Activate NXP MBD Toolbox
button, direct to the license .dat
file.
2.4 Verify Complete Setup
Verify the setup on the NXP Support Package S32K1xx
GUI. All "verify" sub-step
buttons should now be Green.
- Note: Convert
ZIP to MLTBX
may not be required depending on the download process.
3 Step-by-Step Initial setup
- Open up MATLAB and Simulink.
- Open up the
NXP Model-Based Design Toolbox for S32K1xx MCUs
tool box tab. - Open the
Embedded Coder
app. - Build your model, in this example the "GPIO on S32K144 LED & Button" block is used.
Generate Code
orBuild
(generate and flash) to generate code and/or flash the generated code to a connected MCU.