Quick Start Guide
Table of Contents
Introduction
This guide is intended to assist users in the initial setup and demonstration of a CC3220 Azure application using the CC3220 Azure IoT Plugin. The guide explains how to configure the boards, compile the software artifacts, program the CC3220 device, set up your Azure account and run an Azure application.
Hardware Requirements
- TI CC3220SF (Secure Flash) and/or TI CC3220S (Secure) LaunchPad
Software Requirements
- SimpleLink CC3220 SDK 1.40
- A computer running a supported operating system listed in the Release Notes
- CCS 7.2.0 or above
Installing CC3220 Azure IoT Plugin in CCS
- Download and open the CC3220 Azure IoT Plugin Installer (replace x’s with version number):
- Windows: azure_cc3220_x_xx_xx_xx.exe
- Linux: azure_cc3220_x_xx_xx_xx.run
Select an installation directory. This will be referred to as
AZURE_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) and you should see the Install Discovered Products window
Select the CC3220 Azure IoT Plugin and click Install
Hardware Setup
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 CC3220 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.
Azure IoT Developer Setup
In order to run the example applications, it is necessary to complete the following steps:
Building and running Examples in CCS
Several examples are provided in the CC3220 Plugin and can be found in the examples/
subdirectory. These steps refer to the simplesample_http
application for the CC3220SF device, but the same procedure applies to the CC3220S and to other examples, as well.
It is assumed that the CC3220 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 CC3220 Azure IoT Plugin depends on the CC3220 SDK.Open Code Composer Studio.
In CCS, import the
simplesample_http
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
AZURE_INSTALL_DIR\examples\rtos\CC3220SF_LAUNCHXL\azure\simplesample_http
. Select the checkbox next to thesimplesample_http
for tirtos for CCS and hit the Finish button.Update the example to use your Azure connection string and WiFi Access Point information, as specified in the section Example Pre-Build Steps
Two projects should appear in the Project Explorer tab in CCS: one for the
simplesample_http
example itself (ie. simplesample_http_CC3220SF_LAUNCHXL_tirtos_ccs), and the other is a project corresponding to the OS chosen (e.g. azure_cc32xx_tirtos_builds_CC3220SF_LAUNCHXL_release_ccs). If tirtos is your OS, you can simply right-click on thesimplesample_http
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
CC3220.ccxml
as “File name”. Hit Finish.In the Basic window, select “Texas Instruments XDS110 USB Debug Probe” as the “Connection”, and then type “CC3220” in the “Board or Device” text field. Check the box next to “CC3220SF” or “CC3220S” (depending on your launchpad). Hit Save.
Right-click “CC3220.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
Optional: If you have not yet run any applications on your CC3220 since powering it on, then skip to step 2. Otherwise, if you have recently run an application on the CC3220 since powering it on, it is necessary to reset the board. Disconnect and reconnect the CC3220’s USB cable in order to power cycle the hardware, and then reconnect in CCS. For best results, it is recommended to do this before loading and running an application every time, in order to reset the CC3220’s network processor.
Select Run menu > Load > Load Program…, and browse to the file
simplesample_http_CC3220SF_LAUNCHXL_tirtos_ccs.out
, found in your project. Hit OK. This will load the program onto the board. (The same procedure applies to other examples by substitutingsimplesample_http
with the name of the example you are working with)Run the application by pressing F8. The output will appear in your serial terminal session:
Starting the simplesample_http example CC3220 has connected to AP and acquired an IP address. IP Address: 192.168.1.128 Current time: Wed May 31 22:08:22 2017 Flashing certificate file ...successfully wrote file /cert/ms.der to flash Info: IoT Hub SDK for C, version 1.1.15 IoTHubClient accepted the message for delivery Message Id: 1 Received. Result Call Back Called! Result is: IOTHUB_CLIENT_CONFIRMATION_OK
Viewing data from the cloud
You can view the data that has been received on the cloud side in various ways, for example using the Device Explorer or the iothub-explorer from Microsoft, or creating an Azure Function App on the Azure portal itself. Please refer to online documentation from Microsoft to learn about the various ways to interact with the IoT Hub.
Building with makefiles
To build the simplesample_http
application on the command-line using the provided makefile:
Update the
imports.mak
file in the<AZURE_INSTALL_DIR>
root folder with the appropriate path(s). This file relies on the settings in theimports.mak
file of the CC3220 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 of choice. For example,
<AZURE_INSTALL_DIR>/kernel/tirtos/builds/CC3220SF_LAUNCHXL/release/ccs
for tirtos.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_3_50_01_12_core\gmake.exe’). Normally XDCTOOLS are installed along with the CC3220 SDK, but if you need to download it, it is available here
Update the example to use your Azure connection string and WiFi Access Point information, as specified in the section Example Pre-Build Steps
Navigate to the example folder specific to your OS
<AZURE_INSTALL_DIR>/examples/rtos/CC3220SF_LAUNCHXL/azure/simplesample_http/tirtos/ccs
To build, run ‘make’ to generate
simplesample_http.out
You can load and debug the generated
simplesample_http.out
in CCSThe 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 Azure (these steps refer to the simplesample_http
application for the CC3220SF device, but the same procedure applies to other examples as well):
Update the Azure connection string
Open the simplesample_http.c
file from the directory <AZURE_INSTALL_DIR>\azure-iot-sdk-c\serializer\samples\simplesample_http
in a text editor and replace the value of the “connectionString” variable with the device connection string you noted when you registered your device with the IoT hub. (Other examples similarly have a source file named <example_name>.c
or NetMgr.c
where the connection string can be set.)
Flash the root certificate
Note: In the examples, the root CA certificate - “Baltimore CyberTrust Root” is flashed to CC3220 Launchpad to the location
/cert/ms.der
. This location is referenced in<AZURE_INSTALL_DIR>\source\third_party\azure-iot-sdk-c\c-utility\adapters\httpapi_tirtos.c
and<AZURE_INSTALL_DIR>\source\third_party\azure-iot-sdk-c\c-utility\adapters\tlsio_sl.c
, and is used by SimpleLink TLS stack.
Here’s why you need the Baltimore root CA - it’s the root CA for *.azure-devices.net
, the IoT Hub endpoint and it’s the only way for the tiny CC3220 to verify the chain of trust:
The default behavior of the example is to automatically write the certificate to flash if it does not exist. This prevents the file from being written unnecessarily to the file system each time the program is run. If you wish to override this behavior, or if you wish to use a new certificate file, you can force the certificate to be flashed by passing “-DOVERWRITE_CERTS” to the compiler in the makefile. Otherwise it is best to not change anything here.
Update The Example With Your Wi-Fi Access Point Information
Open the file wificonfig.h
, found in the simplesample_http
project. Search for “USER STEP” and update the Wi-Fi SSID and SECURITY_KEY macros.