1
Out of the Box2
Get Software3
Install Software4
Setup Your AWS Account5
Build, Run6
Verify Messages in AWS IoT Core7
DebuggingSign in to save your progress. Don't have an account? Create one.
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.
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.
Something went wrong! Please try again.
The AWS Libraries for S32K3 product has the following dependencies:
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
.
Note: Version 3.4 is located under “Previous” tab.
Note: While installing S32DS, you will be required an activation code. This will be received through email or you may find it in the download page under License Keys tab.
DOWNLOAD S32 DESIGN STUDIO IDE
For more information on detailed installation of IDE, please follow the Installation Guide.
Something went wrong! Please try again.
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
.
Note: Version is located under “Current” tab.
DOWNLOAD S32K3xx DEVELOPMENT PACKAGE
Something went wrong! Please try again.
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.
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).
Something went wrong! Please try again.
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
Something went wrong! Please try again.
Note: The FreeRTOS for S32K3 platforms product represents the implementation of the FreeRTOS v10.4.6 kernel version for the S32K3 microcontrollers family.
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
.
Something went wrong! Please try again.
Note: The SW32K3 TCP/IP stack represents a software library that implements a port of the lwIP stack for the S32K3 microcontrollers family.
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
.
Something went wrong! Please try again.
Note: The AWS Libraries for S32K3 product represents the NXP port of the FreeRTOS LTS libraries, adding AWS Cloud connectivity to the S32K344 platform.
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
Something went wrong! Please try again.
This section describes how to install the packages downloaded in the previous section.
Install S32 Design Studio by following the step-by-step installer.
For detailed information on installation of IDE, please follow the Installation Guide.
Note: While installing S32DS, you will be required an activation code. This will be received through email or you may find it in the download page under License Keys tab.
Something went wrong! Please try again.
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:
Something went wrong! Please try again.
The HSE firmware comes in two versions:
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:
<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 locationFULL_MEM
with AB_SWAP
as indicated below, if using A/B swap version of the firmware)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.
Note: In case you want to use Full memory version of HSE FW, the debug configuration of the demo applications described in the following sections must be updated to select the proper flashing algorithm, as depicted below:
Something went wrong! Please try again.
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.
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.
Something went wrong! Please try again.
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.
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.
Something went wrong! Please try again.
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.
Something went wrong! Please try again.
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).
Something went wrong! Please try again.
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.
Something went wrong! Please try again.
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.
Something went wrong! Please try again.
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.
Something went wrong! Please try again.
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:
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:
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:
<S32DS install dir>/S32DS/help/pdf/S32DS_User_Guide.pdf
Something went wrong! Please try again.
Provisioning the device with credentials is showcased in the aws_pkcs11_mqtt_s32k344
demo. In addition to the standard MQTT example, this example uses the corePKCS11 library to provision the device with the client certificate and private key. The corePKCS11 library is integrated with the S32K3 hardware security engine (HSE).
An additional macro was added to the configuration in demo_config.h
#define democonfigPROVISION_DEVICE
This macro must be defined to enable provisioning of the device with the client certificate and private key defined below. After running the example once, the macro can be undefined, as the certificate will be stored in FLASH and the private key in the HSE.
The provisioning is implemented in the vDevModeKeyProvisioning()
function implemented in src/aws_dev_mode_key_provisioning.c
. This function is invoked by the InitTask()
located in src/main.c
, if the democonfigPROVISION_DEVICE
macro is defined.
Alternatively, the mbedTLS library included in AWS Libraries for S32K3 can be used, also integrated with the S32K3 hardware security engine (HSE).
NXP AWS IoT Core support product offers the following S32 Design Studio projects as examples
This example is used to create an MQTT connection to your AWS IoT account. The device will publish MQTT topic messages to the AWS endpoint and is able to receive publish messages from the server to which it will reply with acknowledgement messages.
This example project was created based on the MQTT_Mutual_Auth demo .
In addition to the standard MQTT example, this example uses corePKCS11 to provision the device with the client certificate and private key.
This example project was created based on the corePKCS11_MQTT_Mutual_Auth demo .
This example is used to showcase the capabilities of over-the-air update in AWS IoT Core.
The example starts the OTA Agent and listens for incoming updates requests from the AWS server. Once the update starts, a new firmware image will be downloaded to flash and the device will restart, loading the new image.
This example project was created based on the Ota demo.
This demo creates a single application task that demonstrates how to collect metrics, construct a device defender report in JSON format, and submit it to the AWS IoT Device Defender service through a secure MQTT connection to the AWS IoT MQTT Broker. The demo includes the standard networking metrics as well as custom metrics. For custom metrics, the demo includes:
This example project was created based on the Device_Defender demo.
This demo shows how to use the AWS IoT Device Shadow library to connect to the AWS Device Shadow service. It uses the coreMQTT library to establish an MQTT connection with TLS (Mutual Authentication) to the AWS IoT MQTT Broker and the coreJSON library parser to parse shadow documents received from the AWS Shadow service.
The demo shows basic shadow operations, such as how to update a shadow document and how to delete a shadow document. The demo also shows how to register a callback function with the coreMQTT library to handle messages like the shadow /update and /update/delta messages that are sent from the AWS IoT Device Shadow service.
This example project was created based on the Device_Shadow demo.
This project is showcasing the Greengrass capability by connecting S32K344 running AWS IoT Core (representing a Greengrass device) to S32G2 RDB2 running GoldVIP (representing the Greengrass core) and publishing diagnostics to a SiteWise dashboard. It requires extra prerequisites, which are mentioned in the demo description.
For details regarding running the demos please consult the description.txt file of the examples.
This chapter describes some of the common problems which may be encountered while running the AWS IoT Core demo.
This is caused by the watchdog in Safety SBC that is not fed properly and resets MCU. In such a case do a power-up procedure according to the steps described here.
This problem indicates that the HSE FW was not properly installed. Please check again the steps in section 3.3 Install HSE Firmware on the device.
The board is getting an IP address trough DHCP. If the execution is stuck in the following loop:
while (!dhcp_supplied_address(&network_interfaces[i]))
it may indicate that the board is not supplied with an IP address, which can happen if the DHCP server is not working properly.
If you do not want to use DHCP, you can change the settings in the Peripherals view, in the tcpip_stack component, Netif tab.
Seeing this error in the serial log might indicate that validation of the server certificate is failing. One possible cause would be wrong configuration of the current time in the RTC. This can be updated either by directly modifying the generate/src/Rtc_Ip_BOARD_InitPeripherals_PBcfg.c
file or updating the configuration in the Peripherals view and generating the code using Update Code:
Note: Time must be set to current UTC time.
For more information, refer to the AWS online documentation on Troubleshooting AWS IoT .
Get the Integrated Development Environment
Download the S32K3xx Development Package
Download HSE Firmware
Get the Real Time Drivers
Download FreeRTOS
Download TCP/IP Stack
Download AWS Libraries for S32K3
Install S32 Design Studio
Install update sites in S32 Design Studio
Install HSE Firmware on the device
Create S32DS Project Starting From the aws_mqtt_s32k344 Example
Configure demo_config.h
Generate Configuration and Code
Build the Project
Run the Demo