otr_logo_grey OntarioTechRacing.github.io

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.


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.

2.1.2 Running the MATLAB Script

Run the NXP_Support_Package_S32K1xx.m file.

2.1.3 Script GUI

The Support Package window should open.

MATLAB NXP Opened install guide.png

2.2 S32Kxx Model-Based Design (MBT) Toolbox Install

2.2.1 Download

Download the newest version of the MBT Toolbox.

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!

  1. Embedded Software Shared Google Drive Copy
  2. 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
    
  3. 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.

MATLAB NXP MBD Installed.png

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.

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):

  1. 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
    
  2. 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.

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.

MATLAB NXP Completed install guide.png


3 Step-by-Step Initial setup

  1. Open up MATLAB and Simulink.
  2. Open up the NXP Model-Based Design Toolbox for S32K1xx MCUs tool box tab.
  3. Open the Embedded Coder app. MATLAB NXP Toolbox Example.png
  4. Build your model, in this example the "GPIO on S32K144 LED & Button" block is used.
  5. Generate Code or Build (generate and flash) to generate code and/or flash the generated code to a connected MCU. MATLAB NXP Embedded Coder Build Example.png