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:
- One of the following CC32XX LaunchPads:
- A computer running a supported operating system listed in the Release Notes
- SimpleLink CC32XX SDK 2.40
- At least one of the following IDE supported by the SimpleLink CC32XX SDK:
- FreeRTOSv10.0.0 (Optional) The SimpleLink CC32XX SDK does not deliver FreeRTOS sources. User is expected to download the same from www.freertos.org if they want to use FreeRTOS with the SDK.
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
- 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
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.Click Next > and finish the installation
Open CCS (close and re-open if already running).
If you see the
Install Discovered Products
window, select theCC32XX 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.
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
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
Plug the CC32XX LaunchPad into a USB port on your PC.
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
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.
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.
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.Open Code Composer Studio.
In CCS, import the
watson_mqttclient
example by first selecting File > Import…In the Import window, select C/C++ > CCS Projects and hit the Next button
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
(replaceCC3220SF_LAUNCHXL
with your board name). Select the checkbox next to thewatson_mqttclient
example for tirtos for CCS and hit the Finish button.Update the example to use your WiFi Access Point information, as specified in the section Wi-Fi Access Point
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 thewatson_mqttclient
project, and select Build Project to build.
Setting Up Code Composer Studio Before Running The Examples
In Code Composer Studio, open the CCS Debug Perspective - Windows menu > Perspective > Open Perspective > CCS Debug
Open the Target Configurations View - Windows menu > Show View > Target Configurations
Right-click on User Defined. Select New Target Configuration.
Use
CC32XX.ccxml
as “File name”. Hit Finish.In the Basic window, select “Texas Instruments XDS110 USB Debug Probe” as the “Connection”, and then type
CC3220
orCC3235
in the “Board or Device” text field. Check the box next to your device. Hit Save.Right-click “CC32XX.ccxml” in the Target Configurations View. Hit Launch Selected Configuration.
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
Select Run menu > Load > Load Program…, and browse to the executable file
watson_mqttclient_CC3220SF_LAUNCHXL_tirtos_ccs.out
, found in your project (replaceCC3220SF_LAUNCHXL
with your board name). Hit OK. This will load the program onto the board.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.
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 variableWATSON_CC32XX_INSTALL_DIR
in the file with the correct path.Open the IAR IDE
Choose Tools > Configure Custom Argument Variables
Click Global > Import
Browse to
<WATSON_INSTALL_DIR>/tools/iar
. Import the custom argvars from the plugin.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
Select Project > options from the menu, and select the Debugger category.
By default, the project Debug settings are configured for the TI XDS110, but the user may change them as needed.
In case you are working with the CC32XXSF devices, check the Use flash loader(s) checkbox in the Debugger > Download tab.
Go to the TI XDS Category, the settings should be TI XDS110 Emulator as the emulator, and JTAG (4-pin) as the interface
You can override the path for code composer studio base according to the code composer installation path.
Load and run the Example
Select Project > Download and Debug
Click the
Go
button in IAR to run the ExampleThe 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:
Update the
imports.mak
file in the<WATSON_INSTALL_DIR>
root folder with the appropriate path(s). This file relies on the settings in theimports.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.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.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
Navigate to the example folder
<WATSON_INSTALL_DIR>/examples/rtos/CC3220SF_LAUNCHXL/watson/watson_mqttclient
(replaceCC3220SF_LAUNCHXL
with your board name). Update the example to use your WiFi Access Point information, as specified in the section Update-WIFINavigate to the example folder specific to your OS and toolchain, e.g.,
<WATSON_INSTALL_DIR>/examples/rtos/CC3220SF_LAUNCHXL/watson/watson_mqttclient/tirtos/ccs
To build, run ‘make’ to generate
watson_mqttclient.out
You can load and debug the generated
watson_mqttclient.out
in CCS
6. Run Examples
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
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}}
- Visualizing the data using IBM QuickStart
- Now connect to IBM QuickStart to view the data by navigating to this link in your web browser: https://quickstart.internetofthings.ibmcloud.com/
- Use the MAC address of the LaunchPad as shown on the serial console as device id to see the data! You will need to remove the colons (:) from the MAC address. A graph is updated every time the button state is published:
Congratulations! Your TI SimpleLink LaunchPad is now connected to the IBM Watson IoT Platform!