Getting Started with AWS Libraries for S32K3 | NXP Semiconductors

Getting Started with AWS Libraries for S32K3

Last Modified: Aug 9, 2023Supports AWS Libraries for S32K3

Contents of this document

  • 1

    Out of the Box
  • 2

    Get Software
  • 3

    Install Software
  • 4

    Setup Your AWS Account
  • 5

    Build, Run
  • 6

    Verify Messages in AWS IoT Core
  • 7

    Debugging

1. Out of the Box

The S32K3X4EVB-T172, an evaluation and development board for general-purpose industrial and automotive applications, is needed for starting this demo.

Note: The +12 V power supply and micro USB cable are not part of the package. The +12 V connector is a center-positive barrel type with outer 5.5 mm and inner 2.1 mm diameter. Additionally, all demos require Internet connection and in order to test them, an Ethernet Media Converter is required. The following NXP product can be used: RDDRONE-T1ADAPT.

For information on how to get started with the S32K3X4EVB-T172 please refer to Getting Started with the S32K3X4EVB-T172 Evaluation Board for Automotive General Purpose.

1.1 Ethernet Connection

100BASE-T1 2-Wire Automotive Ethernet provides 100 Mbps connections over simple twisted 2-wires for a distance of up to 15 meters. The line signaling on the wire is not directly compatible with traditional 100BASE-TX (RJ45) connections, but a physical adapter may be used. Otherwise it is the same as traditional Ethernet. The picture below describes the setup.

S32K3X4EVB-T172 Ethernet Connection

S32K3X4EVB-T172 Ethernet Connection

2. Get Software

The AWS Libraries for S32K3 product has the following dependencies:

  • S32 Design Studio for S32 Platform
  • S32 Design Studio for S32 Platform v.3.4 Update 3 with support for S32K3 devices
  • S32K3 Real-Time Drivers Version 2.0.1
  • FreeRTOS version 2.0.1 release for S32K3 platforms
  • SW32K3 TCPIP Stack version 1.0.1 HF1
  • S32K3 AWS IoT Core Version 1.0.0

2.1 Get the Integrated Development Environment

AWS Libraries for S32K3 package is compatible with NXP's S32 Design Studio for S32 Platform v3.4 Update 3 IDE.

S32 Design Studio platform executable can be found by navigating to Automotive SW → S32K3 → S32 Design Studio, going to the Previous tab and selecting S32 Design Studio for S32 Platform v.3.4 with support for S32K3 devices, then downloading S32DS.3.4_b201217_win32.x86_64.exe.

DOWNLOAD S32 DESIGN STUDIO IDE

S32K3X4EVB-T172 S32DS v3.4 Download

S32K3X4EVB-T172 S32DS v3.4 Download

S32K3X4EVB-T172 S32DS v3.4 Installer

S32K3X4EVB-T172 S32DS v3.4 Installer

For more information on detailed installation of IDE, please follow the Installation Guide.

2.2 Download the S32K3xx Development Package

Additionally, the S32 Design Studio for S32 Platform v.3.4 Update 3 with support for S32K3 devices package must be installed on top of S32 Design Studio for S32 Platform v.3.4 with support for S32K3 devices.

The Update 3 can be found in the same location as the S32 Design Studio platform executable by navigating to Automotive SW → S32K3 → S32 Design Studio, going to the Current tab and selecting S32 Design Studio for S32 Platform v.3.4 Update 3 with support for S32K3 devices, then downloading SW32K3_S32DS_3.4.3_D2112.zip.

DOWNLOAD S32K3xx DEVELOPMENT PACKAGE

S32K3X4EVB-T172 S32DS Dev Package v3.4 Download

S32K3X4EVB-T172 S32DS Dev Package v3.4 Download

S32K3X4EVB-T172 S32DS Dev Package v3.4 Update 3 Download

S32K3X4EVB-T172 S32DS Dev Package v3.4 Update 3 Download

2.3 Download HSE Firmware

AWS Libraries for S32K3 makes use of the HSE security engine, so HSE FW 0.2.1.0 RTM must be installed on the device.

The firmware (HSE_FW_S32K3XX_0_2_1_0.exe) can be downloaded from Automotive SW → S32K3 Standard Software → Automotive SW → S32K3 → HSE Firmware → HSE FW 0.2.1.0 RTM Release.

Download HSE FW

A Demo Application is provided separately and contains details on how to provision HSE Firmware on new device from factory and demonstrates common use cases of its security features. The Demo Application can be found here (login required).

S32K3X4EVB-T172 HSE FW Download

S32K3X4EVB-T172 HSE FW Download

S32K3X4EVB-T172 HSE FW EXE Download

S32K3X4EVB-T172 HSE FW EXE Download

2.4 Get the Real Time Drivers

Automotive SW → S32K3 Standard Software → Automotive SW → S32K3 → Real-Time Drivers for Cortex-M → S32K3 Real-Time Drivers Version 2.0.1 → SW32K3_RTD_4.4_2.0.1_DS_updatesite_D2207.zip

DOWNLOAD S32K3 RTD

S32K3X4EVB-Q172 S32K3 RTD STDSW v2.0.1 Download

S32K3X4EVB-Q172 S32K3 RTD STDSW v2.0.1 Download

S32K3X4EVB-Q172 S32K3 RTD STDSW Update Site D2207

S32K3X4EVB-Q172 S32K3 RTD STDSW Update Site D2207

2.5 Download FreeRTOS

Automotive SW → S32K3 Reference Software → Automotive SW → S32K3 → FreeRTOS → SW32K3_FreeRTOS_10.4.6_2.0.1_D2209 → SW32K3_FreeRTOS_10_4_6_UOS_2_0_1_DS_updatesite_D2209.zip.

DOWNLOAD FreeRTOS

S32K3X4EVB-Q172 S32K3 FreeRTOS REFSW v2.0.1 Download

S32K3X4EVB-Q172 S32K3 FreeRTOS REFSW v2.0.1 Download

S32K3X4EVB-Q172 S32K3 FreeRTOS STDSW Update Site D2209

S32K3X4EVB-Q172 S32K3 FreeRTOS STDSW Update Site D2209

2.6 Download TCP/IP Stack

Automotive SW → S32K3 Reference Software → Automotive SW → S32K3 → Stacks → SW32K3 TCPIP Stack version 1.0.1 HF1 → SW32K3_TCPIP_RTM_1_0_1_HF1_D2209_updatesite.zip.

DOWNLOAD TCP/IP STACK

S32K3X4EVB-Q172 TCP IP REFSW v1.0.1HF1 Download

S32K3X4EVB-Q172 TCP IP REFSW v1.0.1HF1 Download

S32K3X4EVB-Q172 AWS IoT Core REFSW v1.0.1HF1 D2209

S32K3X4EVB-Q172 AWS IoT Core REFSW v1.0.1HF1 D2209

2.7 Download AWS Libraries for S32K3

Automotive SW → S32K3 Reference Software → Automotive SW → S32K3 → AWS IoT → S32K3 AWS IoT Core Version 1.0.0 → SW32K3_AWS_IOT_CORE_1.0.0_D2304_updatesite.zip

DOWNLOAD AWS LIBRARIES FOR S32K3

S32K3 AWS IoT Core Ref SW v1.0.0 Download

S32K3 AWS IoT Core Ref SW v1.0.0 Download

S32K3 AWS IoT Core Ref SW v1.0.0 Update Site D2304

S32K3 AWS IoT Core Ref SW v1.0.0 Update Site D2304

3. Install Software

This section describes how to install the packages downloaded in the previous section.

3.1 Install S32 Design Studio

Install S32 Design Studio by following the step-by-step installer.

For detailed information on installation of IDE, please follow the Installation Guide.

3.2 Install update sites in S32 Design Studio

Most of the SW above (Development package, RTD, FreeRTOS, TCP/IP, AWS Libraries for S32K3) will be downloaded in the form of Update Sites for S32 Design Studio (.zip archives), which can be installed in S32 Design Studio by following these steps:

  1. Choose Help → S32DS Extensions and Updates from the menu bar and select Add Update Sites
  2. Navigate to the directory with the downloaded ZIP files. Select all the ZIP files downloaded in the previous section and click Open, then click OK
  3. From the S32DS Extensions and Updates dialog select and install the required packages, in the following order:
    • select S32K3 Real-Time Drivers Version 2.0.1 and install (development package will be installed by default)
    • select AWS_IOT_CORE for S32K3 version 1.0.0 and install (the rest of the dependencies will be installed by default)

3.3 Install HSE Firmware on the device

The HSE firmware comes in two versions:

  • Full memory
  • A/B Swap

AWS Libraries for S32K3 is using the A/B Swap version, although the Full memory version can also be used if OTA update feature is not needed.

The steps to install the firmware are the following:

  1. Install the HSE firmware and the Demo Application using the guided setup
  2. Import the firmware installation example (<DemoExamples_location>/S32K3_HSE_DemoExamples/Device_Configuration/S32K344_HSE_FW_INSTALL) in S32 Design Studio by selecting File → Import… → General → Existing Projects into Workspace and browsing to the example location
  3. S32K3X4EVB-T172 S32DS HSEFW Import Project

    S32K3X4EVB-T172 S32DS HSEFW Import Project
  4. Build the project
  5. Debug the demo (replace FULL_MEM with AB_SWAP as indicated below, if using A/B swap version of the firmware)
  6. S32K3X4EVB-T172 S32DS Debug

    S32K3X4EVB-T172 S32DS Debug
  7. To check if the HSE firmware was installed correctly, you can pause the application and check the value of the gHseFwVersion variable
  8. S32K3X4EVB-T172 S32DS Pause

    S32K3X4EVB-T172 S32DS Pause

For more details please refer to the Readme.md file included in the project. The S32K3xx Security Overview and Bring Up Training (sign-in required) talks about security features in S32K3. You can also visit our secure files (NDA required) area for in-depth security details. Registration guide for the secure access rights can be found here.

4. Setup Your AWS Account

If you do not have an existing AWS account and user, refer to the online AWS documentation at Set up your AWS Account . To get started, follow the steps outlined in the sections below:

Pay special attention to the Notes.

4.1 Create resources in AWS IoT

Refer to the online AWS documentation at Create AWS IoT Resources . Follow the steps outlined in these sections to provision resources for your device:

Pay special attention to the Notes.

5. Build, Run

AWS Libraries for S32K3 contains several demos showcasing the AWS IoT Core connectivity. The steps describing how to import, build and run the demo apply to all the included demos, but we recommend starting with the aws_mqtt_s32k344 demo to confirm that the device is able to communicate with AWS IoT Core.

5.1 Create S32DS Project Starting From the aws_mqtt_s32k344 Example

After opening S32 Design Studio, go to File → New S32DS Project From Example and select aws_mqtt_s32k344 (you can search it by typing aws into the search box). Then click on Finish.

5.2 Configure demo_config.h

In order to successfully build the project and connect to AWS IoT Core the include/demo_config.h file must be filled in with information regarding the AWS IoT endpoint and the IoT thing created in the Create resources in AWS IoT section.

A few macros are mandatory (they are commented out in the file as a reference, but should be defined by the user):

  • democonfigCLIENT_IDENTIFIER

    Must be set to the Thing Name.

  • democonfigMQTT_BROKER_ENDPOINT

    Must be set to the AWS IoT Core endpoint.

  • democonfigMQTT_BROKER_PORT

    The port used for the secure MQTT connection - could be either 8883 (generally used for secure MQTT connection) or 443 (can be used in restricted network environments).

  • democonfigROOT_CA_PEM

    This certificate is used to identify the AWS IoT server and is publicly available. Can be retrieved from here or downloaded during thing creation in AWS IoT Console.

  • democonfigCLIENT_CERTIFICATE_PEM

    The certificate of the client device - generated during thing creation in AWS IoT Console.

  • democonfigCLIENT_PRIVATE_KEY_PEM

    The private key of the client device - generated during thing creation in AWS IoT Console.

Details on how to set up each of the macro can be found in the include/demo_config.h file comments.

5.3 Generate Configuration and Code

Double click on aws_mqtt_s32k344.mex file or open the Peripherals view by clicking the symbol (mentioned below) on the upper right corner of S32 DS.

Select the current project (aws_mqtt_s32k344) from the top left of the window.

The configuration of the different components can be updated by selecting any of them (not needed for the current example). This is an example of how the aws component looks like:

The aws component allows you to configure the ciphersuite settings for mbedTLS. If generating the device certificate and private key from the IoT Console by default, they will be RSA-based, so the ciphersuite must be updated accordingly:

Click on the Update Code button (green when there are new configuration files to be generated).

Wait for the code generation to be completed before continuing to the next step (when the Update Code message in the lower right disappears).

5.4 Build the Project

Switch again to the C/C++ perspective by clicking the symbol on the upper right corner of S32 DS.

Click on the Build button (hammer symbol).

Wait for the build action to be completed before continuing to the next step.

5.5 Run the Demo

Connect the debugger, connect the board to the Internet through the J428 port and power it up as described in the S32K3x4EVB Getting Started.

Click on the downward arrow corresponding to the Debug button in S32 DS and select Debug Configurations…. Select aws_mqtt_s32k344_Debug_FLASH_PNE and click on the Debug button.

Wait until the debug session is started and then click the Resume button to continue the execution of the application.

6. Verify Messages in AWS IoT Core

6.1 AWS IoT Core Console

From the AWS IoT Core console , select Test from the navigation pane, and choose MQTT test client. Select Subscribe to a topic, enter the topic (or use the # wildcard to see all topics) and then choose Subscribe. You should see messages being displayed as they are received.

S32K3X4EVB-T172-S32K3 AWS Demo MQTT Test Client

S32K3X4EVB-T172-S32K3 AWS Demo MQTT Test Client

7. Debugging

7.1 Debugging Process

You can check the progress of the execution by attaching a serial terminal on the virtual COM associated to the OpenSDA interface (which can be checked in Device Manager).

When the example starts running, a log similar to this will be printed:

S32K3X4EVB-Q172-S32K3 AWS Demo Debugging Log

S32K3X4EVB-Q172-S32K3 AWS Demo Debugging Log

If execution is successful, besides verifying the MQTT messages are received by AWS IoT Core as described in the Verify messages in AWS IoT Core section, you should see the following message at the end of the execution:

S32K3X4EVB-Q172-S32K3 AWS Demo Debugging Log Success Execution

S32K3X4EVB-Q172-S32K3 AWS Demo Debugging Log Success Execution

The logging levels can be updated from the Peripherals view, accessed as indicated in the Build and Run the demo section, step 3. The logging settings are in the Logging tab of the aws component:

If the logging settings or anything else is updated in the configurator, code will need to be generated and built again, as indicated in the Build and Run the demo section, steps 3 and 4.

When running the project as indicated in the Run the demo section, you can use the debugger embedded in S32 Design Studio (e.g. you can set breakpoints before clicking Resume, or Pause the execution and inspect the currently executed code). Details regarding debugging can be found in the S32DS User Guide (Chapter Debugging), located in the S32 Design Studio installation:

1<S32DS install dir>/S32DS/help/pdf/S32DS_User_Guide.pdf