AWS CC32XX Quick Start Guide

Table of Contents

Introduction

This guide is intended to assist users in the initial setup and demonstration of a CC32XX AWS IoT application using the CC32XX Plugin for AWS IoT. The guide explains how to configure the boards, compile the software artifacts, program the CC32XX device, set up your AWS account and run an AWS application.

Hardware Requirements

One of the following LaunchPads:

Software Requirements

Installing CC32XX Plugin for AWS IoT

  1. Download and open the CC32XX Plugin for AWS IoT Installer (replace x’s with version number):
    • Windows: aws_cc32xx_x_xx_xx_xx.exe
    • Linux: aws_cc32xx_x_xx_xx_xx.run
    • macOS: aws_cc32xx_x_xx_xx_xx.app
  2. Select an installation directory. This will be referred to as <AWS_INSTALL_DIR> in the rest of this document. It’s recommended that you install it in your CCS installation directory (default C:\ti on Windows) so it can be discovered automatically

  3. Click Next > and finish the installation

Hardware Setup

Jumper Settings

The CC32XX device implements a sense-on-power scheme to determine the device operation mode upon power up. The encoding of these pins determines the boot flow and the default mapping for some of the pins (UART, JTAG, etc.) The SOP pins are connected to jumper J13 on the CC32XX LaunchPad, which is shipped in flash and functional mode (010) as shown in the image below.

Setting Up a Serial Terminal

  1. Plug the CC32XX LaunchPad into a USB port on your PC.

  2. Open a serial session to the appropriate COM port with the following settings:

    Baudrate:     115200
    Data bits:       8
    Stop bits:       1
    Parity:       None
    Flow Control: None
  3. The output of the examples will be displayed in the terminal.

AWS IoT Developer Setup

In order to run the example applications, it is necessary to complete the following steps:

  1. Sign in to the AWS IoT Console

  2. Register a Device in the Thing Registry
    • Make sure you choose to download the certificate files, as these will be needed when setting up the examples.
    • Note: Due to the way the CC32XX device verifies the certificate chain, you need to use a different root CA than the one provided by AWS. This is because the Amazon root CA certificate is cross-signed with the Starfield Class 2 CA root certificate, therefore the CC32XX requires the Starfield Class 2 CA root certificate instead. You can download the Starfield Class 2 CA root from here.

For more details on AWS IoT, please refer to the What Is AWS IoT page.

Building and Running Examples in CCS

Several examples are provided in the Plugin and can be found in the examples/ subdirectory.

These steps refer to the subscribe_publish_sample application for the CC3220SF device, but the same procedure applies to any CC32XX device and to other examples as well.

  1. It is assumed that the SimpleLink CC32XX SDK has already been installed in a directory we will refer to as <SIMPLELINK_CC32XX_SDK_INSTALL_DIR>. You should install it if you have not already done so, as the CC32XX Plugin for AWS IoT depends on the CC32XX SDK.

  2. Open Code Composer Studio (close and re-open if already running before Plugin or SDK installation).

  3. In CCS, import the subscribe_publish_sample example by first selecting Project > Import CCS Projects…

  4. In the Import CCS Projects window, hit the browse button to browse to the location corresponding to <AWS_INSTALL_DIR>\examples. Select the checkbox next to the subscribe_publish_sample example for tirtos (or freertos) for CCS and hit the Finish button.

  5. Two projects should appear in the Project Explorer tab in CCS: one for the subscribe_publish_sample example itself (i.e. subscribe_publish_sample_CC3220SF_LAUNCHXL_tirtos_ccs), and the other is a project corresponding to the OS chosen (e.g. tirtos_builds_CC3220SF_LAUNCHXL_release_ccs).

  6. The example comes with a README.html file that contains more details specific to the example. Be sure to take a look as it may contain additional instructions.

  7. Update the example to use the proper certificates, AWS account and WiFi Access Point information, as specified in the section Example Pre-Build Steps

  8. If you are using FreeRTOS, you need to set the installation directory of FreeRTOS before building:
    1. In CCS, select Window > Preferences
    2. Navigate to Code Composer Studio > Build > Variables
    3. Click Add
    4. For Variable name, enter FREERTOS_INSTALL_DIR
    5. For Type, select directory
    6. For Value, enter the installation directory of FreeRTOS
    7. Hit OK until you get back to the main window in CCS
  9. Right-click on the subscribe_publish_sample project, and select Build Project to build.

Load and Run the Example

  1. Plug the LaunchPad into a USB port on your PC.

  2. Right-click on the subscribe_publish_sample project, and select Debug As > Code Composer Debug Session. Note the SOP[2..0] jumper setting on the board must be (010) in order for the CCS debugger to connect.

  3. Run the application by pressing F8. The output will appear in your serial terminal session:

    startSNTP: Current time: Tue Aug  7 19:28:11 2018
    
    CC32XX has connected to AP and acquired an IP address.
    
    IP Address: 192.168.1.131
    
    AWS IoT SDK Version 3.0.1-
    
    Connecting...
    
    Subscribing...
    
    -->sleep
    
    Subscribe callback
    
    sdkTest/sub     hello from SDK QOS1 : 1
    
    Subscribe callback
    
    sdkTest/sub     hello from SDK QOS0 : 0
    
    -->sleep

Building and Running Examples in IAR

Download and Installation

For instructions on downloading and setting up IAR properly for use with the SimpleLink CC32XX SDK and its Plugins, please refer to the CC32XX SDK’s Quick Start Guide document. As part of the procedure, make sure to configure the custom argument variables for the SDK.

Configuring Custom Argument Variables Specific to the Plugin

Before starting to work with any of the AWS IoT example projects in the Plugin, you need to load a set of environment variables that will be set for your current workspace, in addition to the ones from the SimpleLink SDK.

  1. The custom argvars can be found at <AWS_INSTALL_DIR>/tools/iar/AWS_CC32XX_SDK.custom_argvars, if you need to modify the default path argument variables, edit the variables with the correct path.

  2. Open the IAR IDE

  3. Choose Tools > Configure Custom Argument Variables

  4. Click Global > Import

  5. Browse to <AWS_INSTALL_DIR>/tools/iar. Import the custom argvars from the Plugin.

Importing Your First Project

These steps refer to the subscribe_publish_sample application for the CC3220SF device, but the same procedure applies to any CC32XX device and to other examples as well.

You can choose to open an Example Project by either directly accessing the Example workspace (by double clicking on its *.eww file), or by importing the Example from the Example List in the IDE.

Directly Accessing an Example From the Example Folder

All Code Examples that are shipped with the plugin come with an IAR workspace (*.eww file). Double-Clicking the specific workspace allows you to open the project on disk and build it.

Each example comes with a README.html file. Be sure to take a look in case it has additional instruction specific to the example you wish to run. Update the example to use the proper certificates, AWS account and WiFi Access Point information, as specified in the section Example Pre-Build Steps

Importing an Example in the Example List

  1. In the IAR-IDE, select File > Open File… from the menu and open <AWS_INSTALL_DIR>/tools/iar/Examples.html

  2. All the Plugin for AWS IoT example projects that are available in IAR are listed in the html page.

  3. Scroll through the page and click on the project you are interested in. In this guide we choose to work with subscribe_publish_sample for the CC3220SF based on TI-RTOS.

  4. When prompted, click Yes to save a copy of the project workspace in a specific folder, No will save the workspace in a default folder.

  5. After clicking Yes, browse to the location where you want to save this workspace. Click Choose

Building the Project

  1. Two projects should appear in the Workspace tab in IAR: one for the subscribe_publish_sample example itself (i.e. subscribe_publish_sample_CC3220SF_LAUNCHXL_tirtos_iar), and the other is a project corresponding to the OS chosen (e.g. tirtos_builds_CC3220SF_LAUNCHXL_release).

  2. The example comes with a README.html file that contains more details specific to the example. Be sure to take a look as it may contain additional instructions.

  3. Update the example to use the proper certificates, AWS account and WiFi Access Point information, as specified in the section Example Pre-Build Steps

  4. Make/Build the Example Project by first selecting the OS project tab on the Workspace window and select Project > Make. Once done, select the subscribe_publish_sample tab on the Workspace window and select Project > Make.

Start a Debug Session

To start an IAR debug session follow the steps outlined in the Run a debug session section in the QuickStart for IAR IDE chapter of the CC32XX SDK’s Quick Start Guide document.

Load and Run the Example

  1. Plug the LaunchPad into a USB port on your PC.

  2. Select Project > Download and Debug Note the SOP[2..0] jumper setting on the board must be (010) in order for the IAR debugger to connect.

  3. Run the application by pressing F5.

  4. The Example output is displayed in the serial terminal, as shown here.

Building with Makefiles

These steps refer to the subscribe_publish_sample application, but the same procedure applies to other examples as well.

  1. It is assumed that the SimpleLink CC32XX SDK has already been installed in a directory we will refer to as <SIMPLELINK_CC32XX_SDK_INSTALL_DIR>. You should install it if you have not already done so, as the CC32XX Plugin for AWS IoT depends on the CC32XX SDK.

  2. Update the imports.mak file in the <AWS_INSTALL_DIR> root folder with the appropriate path(s). This file relies on the settings in the imports.mak file of the SimpleLink CC32XX SDK, so please ensure you have updated the latter with the appropriate paths as well if you have not done so previously.

  3. Navigate to the directory corresponding to your OS, board and toolchain of choice. For example, <SIMPLELINK_CC32XX_SDK_INSTALL_DIR>/kernel/tirtos/builds/CC3220SF_LAUNCHXL/release/ccs for tirtos and TI (CCS) toolchain on the CC3220SF LaunchPad.

  4. Run ‘make’ to build the OS. If you develop on a Windows machine and do not have the ‘make’ utility, you can alternatively run ‘gmake’ from your TI XDCTOOLS installation (e.g. ‘C:\ti\xdctools_x_xx_xx_xx_core\gmake.exe’). Normally XDCTOOLS are installed along with the CC32XX SDK, but if you need to download it, it is available here.

  5. Navigate to the example folder specific to your board(replace CC3220SF_LAUNCHXL with your board name): <AWS_INSTALL_DIR>/examples/rtos/CC3220SF_LAUNCHXL/aws/subscribe_publish_sample

  6. Read the README.html file of the example, and follow any additional instructions specific to the example if present.

  7. Update the example to use the proper certificates, AWS account and WiFi Access Point information, as specified in the section Example Pre-Build Steps

  8. Navigate to the example folder specific to your OS and toolchain <AWS_INSTALL_DIR>/examples/rtos/CC3220SF_LAUNCHXL/aws/subscribe_publish_sample/tirtos/ccs

  9. To build, run ‘make’ to generate subscribe_publish_sample.out

  10. You can load and debug the generated subscribe_publish_sample.out in CCS (or IAR)

  11. The Example output is displayed in the serial terminal, as shown here.

Example Pre-Build Steps

Before building a specific application, you must complete the following steps in order to successfully connect to AWS (these steps refer to the subscribe_publish_sample application, but the same procedure applies to other examples as well):

Update the Example with Your Wi-Fi Access Point Information

Open the file wificonfig.h, found in the subscribe_publish_sample project. Search for “USER STEP” and update the Wi-Fi SSID and SECURITY_KEY macros.

Update the AWS Configuration File

Before you set up the AWS configuration file, you’ll need to retrieve your AWS IoT’s custom endpoint URL.

Navigate to your AWS IoT dashboard and click Settings on the sidebar. Your custom endpoint will be posted at the top of this page. Copy this value and save it somewhere safe, you’ll need it in the next step.

  1. In a text editor, open the aws_iot_config.h file, found in the subscribe_publish_sample project.

  2. Update the value of the macro “AWS_IOT_MQTT_HOST” with your AWS IoT’s custom endpoint URL. It will have a format similar to the following: <random-string>-ats.iot.us-east-2.amazonaws.com

  3. Update the value of the macro “AWS_IOT_MQTT_CLIENT_ID” to a unique name for your device

  4. Update the value of the macro “AWS_IOT_MY_THING_NAME” with the name of the thing you created during the steps for AWS IoT Developer Setup.

  5. The certificate file variables “AWS_IOT_ROOT_CA_FILENAME”, “AWS_IOT_CERTIFICATE_FILENAME”, and “AWS_IOT_PRIVATE_KEY_FILENAME” can be updated to specify the location to where the files are written in flash on the device. You can use the default values, if desired.

Flash the Certificates

The certificate files used by the examples need to be obtained from the AWS IoT Console. If you have not already done so, follow the steps for AWS IoT Developer Setup to create and download the certificates for your device.

The Uniflash tool is used to flash the CA root certificate, the client certificate, and the client (private) key. Consult UniFlash ImageCreator Basics, for instructions on how to setup the UniFlash ImageCreator tool and use it to add user files such as certificates.

Before flashing the certificates make sure to rename the files to match the value of the variables “AWS_IOT_ROOT_CA_FILENAME”, “AWS_IOT_CERTIFICATE_FILENAME”, and “AWS_IOT_PRIVATE_KEY_FILENAME” set in the AWS configuration file and add any folders needed to construct the correct path.

Other Info

More CCS project information can be found here and here.