TI CC3220SF

How to connect a TI CC3220SF to Xively

The Texas Instruments SimpleLink™ Wi-Fi® CC3220SF LaunchPad™ development kit is an easy and cost effective way to get started with Wi-Fi connected devices.

Scan this tutorial to get familiar with it. Then complete each step in a sequential manner. Each step builds upon the previous one.

This tutorial supports Windows, macOS and Linux.

What you will learn

This tutorial will teach you how to upload Xively and Wi-Fi credentials to the CC3220SF board using UniFlash, so that a prebuilt application can connect to the Xively service.

Hardware you will need

Texas Instruments SimpleLink™ Wi-Fi® CC3220SF Wireless Microcontroller LaunchPad™ development kit

SimpleLink Wi-Fi CC3220SF Wireless Microcontroller LaunchPad

SimpleLink Wi-Fi CC3220SF Wireless Microcontroller LaunchPad

Software you will install during the tutorial

  • Precompiled Xively C Client and Client Example
  • UniFlash for TI Microcontrollers version 4.1

Step 1 of 5: Create your Xively digital device

You should have a Xively account already created, but if you do not, register one for free at Xively.com.

Before connecting a physical device to Xively, create its digital representation in the system. Log into the Xively management app to complete the following steps.

Create a CC3220SF device template using the Product Launcher

This operation will create a device template and a device instance in Xively to represent your CC3220SF board.

  1. Click on Product Launcher > Add another device.
  1. From the popup window select Choose from our template library and click Next.
  2. From the sections tabs at the top of the window go to Quickstart Kits, select TI CC3200, and click Next.

Get credentials for this device

In order for your device to securely talk to Xively it needs credentials that it will use to authenticate itself as a valid device within your account.

  1. Go to Devices > All devices and look for your sample CC3200 device. Click on its name.
  2. Click on Get password.
  1. When the modal window pops-up, click the Download button.

    A file named MQTTCredentials.txt gets downloaded. It contains the device credentials that will be used in the next step. The file contains two data items:

    • The first line is the Xively Device Secret.
    • The second line is the Xively Device Id.

You now have a provisioned device in Xively that your CC3220SF will be able to connect as.

Get account ID

To allow your device to publish and subscribe to MQTT topics you will need your account ID.

  1. Click on the cogwheel in the top right-hand corner of the page and click the turquoise rectangle with your account id.
    Your account id has been copied to the clipboard.
  2. Save your account id for later. It will be needed for xively_demo application configuration in the next step.

Now you have all of the credentials for your device.

Step 2 of 5: Install UniFlash

UniFlash is an application that loads firmware onto TI devices. Once the firmware is loaded, the device will always boot this firmware when powered on.

  1. Download UniFlash version 4.1 appropriate for your host operating system (Windows, Linux or macOS): UniFlash.
  2. Run the UniFlash installer.
  3. Once installation completes, check Launch UniFlash and click Finish to leave the installer.

Step 3 of 5: Import the Xively Client UniFlash Image

The UniFlash image is a ZIP file that contains the Xively client binary executable.

  1. Download the Xively CC3220 UniFlash ZIP archive from the Xively C Client github repository.
  2. Run UniFlash if it's not already running.
  3. In UniFlash, in the Device Configuration field, type "CC3220" and select CC3120 / CC3220.
    Note: Do not select the CC3220SF device. If you did, click on the Selected Device again to change it to the CC3120 / CC3220 option.
  1. Click Start Image Creator.
  2. Click Manage Projects.
  3. Click the Import Project icon:
  1. Select the UniFlash ZIP file that you downloaded from the Xively Github repository above, and click Open.
  2. Highlight the new XivelyProduction image and click on the Open icon:

Result: You have successfully imported the Xively Client image to UniFlash, and it is ready to be configured with your Xively credentials. At this stage UniFlash looks as follows:

Step 4 of 5: Edit the Xively Client Credential File in UniFlash

The Xively Client for the CC3220SF reads your Wi-Fi and Xively credentials from a file stored in flash memory on the device. Prepare your Xively Device ID, Xively Device Secret, Xively Account ID, and Wi-Fi credentials to copy them to a text file so that the CC3220SF client may read them.

  1. In UniFlash, in the left-hand bar, click User Files.
  1. Hover your mouse over the file in etc/xively_config.txt and click on the Get File icon.
  1. Save this file to your Desktop and open the file in your favorite text editor.
  2. Copy and paste your Xively AccountID, DeviceID, and DeviceSecret into the accountId, deviceId, and password fields, respectively.
  1. Enter your Wi-Fi SSID (name) and password into the corresponding fields.
  1. Ensure that your Wi-Fi security type is properly represented.
    Tip: The default "wpa2" value is the most popular type of Wi-Fi network. Other options include "open", "wep", "wpa", and "wpa_ent".
  2. Save the file.
  3. In UniFlash, hover over the xively_config.txt file and click the Overwrite File icon:

A standard file manager opens.

  1. Browse to the xively_config.txt file that you have altered on your desktop and click Open.
  2. Click the Overwrite button.
  3. Click the Save Project icon.

Result: The image for your device is now fully configured and ready to be flashed onto your device.

Step 5 of 5: Flash your device

  1. Set the J15 jumper to 1 on your device. This is the Sense on Power (SOP) jumper near the right-side button of the device.
    Note: At the time of unboxing, the device has this jumper set to 2 which prevents the device from being flashed.
  1. Plug the USB cable that came with your device into the CC3220SF power socket at the top of the board, and connect the USB cable to your computer.
  2. In the UniFlash project, click the Connect button and wait for the dialog box to disappear.
    Note: This step gathers information from the device including it's MAC address, which is required before burning the firmware. When the dialog box disappears, you will see MAC and other device-specific information on the right side of UniFlash.
  3. Click the Generate Image icon in the bottom right.
  1. Click the Program Image (Create & Program) button at the top.
    UniFlash writes the image on your board and a progress bar appears. This may take about 30 seconds.
  2. Wait until you see Programming complete, and click Close.

Result: Your device reboots and runs the test program.

Congratulations!

You did it! You now have a CC3220SF board connected and communicating with Xively.

To see the status of your device, go back to the device page in the Xively management app. The device status is now Connected, and on the Logs tab you see its Device connected lifecycle log.

To see the graphical representation of data received from your device such as temperature and button states, go to Product Launcher. You can also turn on and off LEDs on the board using this web page interface.

Troubleshooting

LED Error Indicators

The device's LEDs flash to indicate that the application is connecting to your Wi-Fi network and to the Xively service. Once connected, the LEDs turn off so they may be controlled by the Product Launcher.

If a connection problem persists, create a serial connection to the device (as described below in Creating a Serial Connection). The serial log may give you a specific reason for the failure.

Green LED
A flashing green light indicates there is an error in parsing your Xively credentials and Wi-Fi credentials file. Please review Step 4 above.

If solidly lit, the green LED signifies that the xively_cfg.txt file has been parsed correctly, and the application has progressed to the next stage: connecting to your Wi-Fi network.

Orange LED
A flashing orange light indicates there is a problem joining your Wi-Fi network. Check your Wi-Fi SSID, password, and security type in xively_cfg.txt as described in steps 4.5 - 4.6 above.

If solidly lit, the orange LED signifies that the device has successfully connected to your Wi-Fi network and is attempting to connect to the Xively service.

Red LED
A flashing red light indicates there is an error in connecting your device to Xively. Check your Xively device credentials in xively_cfg.txt as described in steps 1 and 4.4 above.

Creating a Serial Connection

Use serial connection to connect to your device in case your device fails to connect to Xively and you need to diagnose the problem, or you are curious about what the device is currently doing.

  1. Install a serial terminal program.
    We recommend Putty (Windows) or Serial Tools (macOS).
  2. Ensure that UniFlash is closed.
    Note: Depending on what UniFlash is currently doing, it might monopolize the serial connection that you are trying to establish. It is the safest to close the program until you become more comfortable with UniFlash connection states.
  3. Use your serial terminal program to connect to your device.
    The connection should have the following terminal properties:
    • Baud Rate: 115200
    • Data Bits: 8
    • Stop Bits: 1
    • Parity: None
    • Flow Control: None
    • Com Port: This is specific to your computer. This is usually com3 on Windows, and usbModem on macOS.
  4. Start the terminal session by clicking Connect on your client.
  5. To get the full console log, reset your device. Press the button adjacent to the power cable at the top of your CC3220SF.

TI CC3220SF

How to connect a TI CC3220SF to Xively