Watson IoT CC32XX Quick Start Guide

Table of Contents

1. Introduction

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

2. Prerequisites

The user is expected to have the following:

3. Setup

Software

It is assumed that the CC32XX SDK has already been installed in a directory we will refer to as CC32XX_SDK_INSTALL_DIR.

Install CC32XX Watson IoT Plugin in CCS

  1. Download and open the CC32XX Watson IoT Plugin Installer (replace x’s with version number):
    • Windows: watson_cc32xx_x_xx_xx_xx.exe
    • Linux: watson_cc32xx_x_xx_xx_xx.run
  2. Select an installation directory. This will be referred to as WATSON_INSTALL_DIR in the rest of this document. It’s recommended that you install it in your CCS installation directory (default c:/ti) so it can be discovered automatically.

  3. Click Next > and finish the installation

  4. Open CCS (close and re-open if already running).

  5. If you see the Install Discovered Products window, select the CC32XX Watson IoT Plugin and click Install. Otherwise you can verify that the plugin appears in the list of installed products under Window menu > Preferences > CCS > Products.

Hardware

Jumper settings

The SOP[2…0] jumpers are used to set different flash programming modes/states.

  1. SOP[2…0] mode ‘100’ is used for programming the serial flash with the application binary and/or the service pack. After flashing, the board should be reset and the mode set to ‘000’ (no jumpers in place) to run/execute the contents of flash

  2. SOP[2…0] mode ‘010’ is the flash and execute mode which is similar to the ‘100’ mode except that after flashing, the contents of flash are executed immediately without having to reset or remove all jumpers. This mode is also used when using the CCS to connect to the device for loading and debugging

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.

Watson IoT Cloud

The IBM Watson Platform offers a QuickStart service which allows devices to connect without being registered, in order to evaluate the Platform and verify connection setup. The examples leverage this service out-of-box.

4. Configure/modify examples

The steps in this section are common to CCS, IAR and command line environments.

Wi-Fi Access Point

Make sure the local access-point parameters (SSID_NAME, SECURITY_TYPE and SECURITY_KEY) defined in network_if.h are configured according to your local access-point. Note: use SL_WLAN_SEC_TYPE_WPA_WPA2 for SECURITY_TYPE if you have a WPA/WPA2 AP.

General Settings

5. Build examples

Examples can be built using either the CCS IDE, the IAR IDE or makefiles. Please refer the the appropriate section below based on your preference.

CCS

Build and run

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

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

  2. Open Code Composer Studio.

  3. In CCS, import the watson_mqttclient example by first selecting File > Import…

  4. In the Import window, select C/C++ > CCS Projects and hit the Next button

  5. In the Import CCS Eclipse Projects window, hit the browse button to browse to the location corresponding to WATSON_INSTALL_DIR\examples\rtos\CC3220SF_LAUNCHXL\watson\watson_mqttclient (replace CC3220SF_LAUNCHXL with your board name). Select the checkbox next to the watson_mqttclient example for tirtos for CCS and hit the Finish button.

  6. Update the example to use your WiFi Access Point information, as specified in the section Wi-Fi Access Point

  7. Two projects should appear in the Project Explorer tab in CCS: one for the watson_mqttclient example itself (ie. watson_mqttclient_CC3220SF_LAUNCHXL_tirtos_ccs), and the other is a project corresponding to the OS chosen (e.g. tirtos_builds_CC3220SF_LAUNCHXL_release_ccs if TIRTOS is your OS). You can simply right-click on the watson_mqttclient project, and select Build Project to build.

Setting Up Code Composer Studio Before Running The Examples

  1. In Code Composer Studio, open the CCS Debug Perspective - Windows menu > Perspective > Open Perspective > CCS Debug

  2. Open the Target Configurations View - Windows menu > Show View > Target Configurations

  3. Right-click on User Defined. Select New Target Configuration.

  4. Use CC32XX.ccxml as “File name”. Hit Finish.

  5. In the Basic window, select “Texas Instruments XDS110 USB Debug Probe” as the “Connection”, and then type CC3220 or CC3235 in the “Board or Device” text field. Check the box next to your device. Hit Save.

  6. Right-click “CC32XX.ccxml” in the Target Configurations View. Hit Launch Selected Configuration.

  7. Under the Debug View, right-click on “Texas Instruments XDS110 USB Debug Probe_0/Cortex_M4_0”. Select “Connect Target”.

Running an Example in CCS

  1. Select Run menu > Load > Load Program…, and browse to the executable file watson_mqttclient_CC3220SF_LAUNCHXL_tirtos_ccs.out, found in your project (replace CC3220SF_LAUNCHXL with your board name). Hit OK. This will load the program onto the board.

  2. Run the application by pressing F8. The Example output is displayed in the serial terminal, as shown here.

IAR

Download and Installation of IAR

For instructions on downloading and setting up IAR properly for use with the CC32XX SDK, please refer to the Quick Start Guide document that is included in the SimpleLink CC32XX SDK.

Configuring the IAR environmental variables for the Watson IoT Plugin

Before starting to work with any of the Watson IoT example projects, you need to load a set of environment variables that will be set to your current workspace (custom argvars). We are assuming here you have already loaded the custom argvars for the CC32XX SDK as instructed in the Quick Start Guide document that is included in the SimpleLink CC32XX SDK.

  1. The custom argvars can be found at <WATSON_INSTALL_DIR>/tools/iar/WATSON_CC32XX_SDK.custom_argvars. If you need to modify the default path for the plugin’s installation directory, edit the variable WATSON_CC32XX_INSTALL_DIR in the file with the correct path.

  2. Open the IAR IDE

  3. Choose Tools > Configure Custom Argument Variables

  4. Click Global > Import

  5. Browse to <WATSON_INSTALL_DIR>/tools/iar. Import the custom argvars from the plugin.

  6. Restart IAR

Importing your First Project

All Code Examples that are shipped with the plugin under the examples directory come with an IAR workspace. Double-Clicking the specific workspace (e.g. watson_mqttclient.template.eww) from the file manager allows you to open the project on disk and build it. After the project opens up in the IAR IDE, be sure to update the example to use the proper WiFi Access Point information, as specified in the section Update-WIFI

Start a debug session

  1. Select Project > options from the menu, and select the Debugger category.

  2. By default, the project Debug settings are configured for the TI XDS110, but the user may change them as needed.

  3. In case you are working with the CC32XXSF devices, check the Use flash loader(s) checkbox in the Debugger > Download tab.

  4. Go to the TI XDS Category, the settings should be TI XDS110 Emulator as the emulator, and JTAG (4-pin) as the interface

  5. You can override the path for code composer studio base according to the code composer installation path.

Load and run the Example

  1. Select Project > Download and Debug

  2. Click the Go button in IAR to run the Example

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

makefiles

To build the watson_mqttclient example on the command-line using the provided makefile:

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

  2. Navigate to the OS directory corresponding to your OS and toolchain of choice. For example, <CC32XX_SDK_INSTALL_DIR>/kernel/tirtos/builds/CC3220SF_LAUNCHXL/release/ccs for tirtos and TI compiler.

  3. 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

  4. Navigate to the example folder <WATSON_INSTALL_DIR>/examples/rtos/CC3220SF_LAUNCHXL/watson/watson_mqttclient (replace CC3220SF_LAUNCHXL with your board name). Update the example to use your WiFi Access Point information, as specified in the section Update-WIFI

  5. Navigate to the example folder specific to your OS and toolchain, e.g., <WATSON_INSTALL_DIR>/examples/rtos/CC3220SF_LAUNCHXL/watson/watson_mqttclient/tirtos/ccs

  6. To build, run ‘make’ to generate watson_mqttclient.out

  7. You can load and debug the generated watson_mqttclient.out in CCS

6. Run Examples

  1. Rebuild and run the example as described above for your particular environment. You should see the following on the serial console.

    Starting the Watson MQTT client example
    
            ============================================
               MQTT client Example Ver: 1.1.1
            ============================================
    
             CHIP: 0x20000019
             MAC:  2.0.0.0
             PHY:  2.2.0.6
             NWP:  3.7.0.1
             ROM:  0
             HOST: 2.0.1.27
             MAC address: 07:00:28:5a:58:9b
    
            ============================================
    
       MQTT ClientId: d:7ppa04:ti-simplelink:0700285a589b
    
    
    
                     *************************************************
                        CC32xx MQTT client Application
                     *************************************************
    
    
    
    Device came up in Station mode
    [WLAN EVENT] STA Connected to the AP: MyRouter , BSSID: 2f:30:39:52:53:33
    [NETAPP EVENT] IP acquired by the device
    
    Device has connected to ThingsNet
    Device IP Address is 192.168.1.127
    
    .CONNACK:
    Connection Success
    Connection to broker is successful
  2. Each time the User button (SW2) is pressed, a message with the button state will be sent.

     CC32xx Publishes the following message
    Topic: iot-2/evt/status/fmt/json
    Data: {"d":{"button":1}}
  3. Visualizing the data using IBM QuickStart

IBM

Congratulations! Your TI SimpleLink LaunchPad is now connected to the IBM Watson IoT Platform!

7. Other Info

More CCS project information can be found here and here.