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. It shows you how to load precompiled firmware onto the device.
Tip: If you would like to build the firmware from source code then please see our tutorial TI CC3220SF Built From Scratch.
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
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.
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.
- Click on
Product Launcher
>Add another device
.
- From the popup window select
Choose from our template library
and clickNext
. - From the sections tabs at the top of the window go to
Quickstart Kits
, selectTI CC3200
, and clickNext
.
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.
- Go to
Devices
>All devices
and look for your sample CC3200 device. Click on its name. - Click on
Get password
.
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.
- 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. - 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.
- Download UniFlash version 4.1 appropriate for your host operating system (Windows, Linux or macOS): UniFlash.
- Run the UniFlash installer.
- Once installation completes, check
Launch UniFlash
and clickFinish
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.
- Download the Xively CC3220 UniFlash ZIP archive from the Xively C Client github repository.
- Run UniFlash if it's not already running.
- In UniFlash, in the
Device Configuration
field, type "CC3220" and selectCC3120 / CC3220
.
Note: Do not select theCC3220SF
device. If you did, click on theSelected Device
again to change it to theCC3120 / CC3220
option.
- Click
Start Image Creator
. - Click
Manage Projects
. - Click the
Import Project
icon:
- Select the UniFlash ZIP file that you downloaded from the Xively Github repository above, and click
Open
. - Highlight the new
XivelyProduction
image and click on theOpen
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.
- In UniFlash, in the left-hand bar, click
User Files
.
- Hover your mouse over the file in
etc/xively_config.txt
and click on theGet File
icon.
- Save this file to your Desktop and open the file in your favorite text editor.
- Copy and paste your Xively AccountID, DeviceID, and DeviceSecret into the accountId, deviceId, and password fields, respectively.
- Enter your Wi-Fi SSID (name) and password into the corresponding fields.
- 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". - Save the file.
- In UniFlash, hover over the xively_config.txt file and click the
Overwrite File
icon:
A standard file manager opens.
- Browse to the
xively_config.txt
file that you have altered on your desktop and clickOpen
. - Click the
Overwrite
button. - 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
- 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 to2
which prevents the device from being flashed.
- 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.
- 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. - Click the
Generate Image
icon in the bottom right.
- 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. - Wait until you see
Programming complete
, and clickClose
.
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.
- Install a serial terminal program.
We recommend Putty (Windows) or Serial Tools (macOS). - 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. - 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, andusbModem
on macOS.
- Start the terminal session by clicking
Connect
on your client. - To get the full console log, reset your device. Press the button adjacent to the power cable at the top of your CC3220SF.