The Texas Instruments SimpleLink™ Wi-Fi® CC3200 LaunchPad™ development kit is an easy and cost effective way to get started with 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 and macOS. For Linux, follow the macOS instructions.
This tutorial will teach you how to build, link, and deploy a Xively C Client Application onto the CC3200 using Code Composer Studio™. Then you will learn how to connect your device to Xively.
Texas Instruments SimpleLink™ Wi-Fi® CC3200 LaunchPad™ development kit
SimpleLink Wi-Fi CC3200 LaunchPad
- Code Composer Studio™ version 7.0
- CC3200 Simplelink™ Wi-Fi SDK
- Xively C Client library
- CC3200 Uniflash (optional)
Code Composer Studio™ includes the toolchain (compiler) you will need to build for the CC3200 and a java-based IDE.
- Download the Code Composer Studio™ version 7.0 appropriate for your operating system (Windows, Linux or macOS): Code Composer Studio (CCS) Integrated Development Environment (IDE).
- Once download is complete, start the installation.
- Accept the license agreement and click Next >.
- Choose the default install folder and click Next >. Or, if you install into a custom directory, then note its path as you will need to refer to it later. By default the path should be
c:\tion Windows and
- Enable SimpleLink Wi-Fi CC32XX Wireless MCUs.
Note: If you use a CCS version older than 7.0, select SimpleLink Wireless MCUs and its two child options: CC32xx Device Support and TI ARM Compiler.
- Click Next > and click Finish when the button becomes enabled.
- Once installation completes, click Finish to leave the installer.
This SDK contains the platform libraries that you will need to compile and link against when writing software for the CC3200.
- Launch Code Composer Studio™.
- If prompted to Select a Workspace, click OK to select the default path.
- Select View > Resource Explorer from the top bar menu.
- Select CC3200 Simplelink Wi-Fi from the list of available development tools.
- On the right side of the screen, click the Install on Desktop down-arrow icon and select Make Available Offline. Confirm Yes on the popup window.
- A Dependencies popup may appear. Click OK to download any software dependencies.
Note: Windows users may download the CC3200 Simplelink™ Wi-Fi SDK directly outside of the Code Composer Studio™ if you wish. Once downloaded, install using the default settings.
Configure the Xively C Client build environment by setting paths to CSS and SDK, and build the library:
- Open the
make/mt-os/mt-cc3200make target file in your favorite friendly text editor.
- Scroll to the HOSTS section devoted to your host platform:
MAC HOST OS,
WINDOWS HOST OS, or
LINUX HOST OS.
- In the HOST section appropriate for your platform, set the
XI_CC3200_PATH_SDKvariables to your Code Composer Studio™ and SDK install paths, respectively.
Note: If you chose the default installation paths for these installations then these values should alrea valid and you shouldn't need to change anything.
- The toolchain that Code Composer Studio™ downloaded might differ from the default that's configured in this
mt-cc3200.mkfile. Verify the compiler paths:
a. Browse to the path which you set in
b. Open up the
compiler/directory and note the name of the toolchain.
c. Compare this to the toolchain name stored in the
COMPILERvariable near the top of the file in
mt-cc3200.mk. Update the
COMPILERvariable as necessary.
- Execute the following commands from the
Set paths for
<path-to-ccs> is the path to your Code Composer Studio, for example
Clean and build the library:
gmake PRESET=CC3200_TLS_SOCKET clean gmake PRESET=CC3200_TLS_SOCKET
Clean and build the library:
make PRESET=CC3200_TLS_SOCKET clean make PRESET=CC3200_TLS_SOCKET
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.
This operation will create a device template and a device instance in Xively to represent your CC3200 board.
- Click on Product Launcher > Add another device.
- From the pop-up window select Choose from our template library and click Next.
- From the sections tabs at the top of the window go to Quickstart Kits, select TI CC3200, and click Next.
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 Download.
A file named
MQTTCredentials.txtgets 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 CC3200 will be able to connect as.
To allow your device to publish and subscribe to MQTT topics you will need your account ID.
- Click on your name 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_demoapplication configuration in the next step.
Now you are ready to build and run Xively Demo application.
We've prepared a CC3200 demo application that uses the Xively C Library to connect to the Xively Service. It will allow you to control the on-board LEDs remotely from the Xively Product Launcher, and send temperature and button state data from the device to the Xively Service.
We will import the example into Code Composer Studio™, configure your IoT Client parameters, and build the demo application to connect to the Xively service.
- In Code Composer Studio™, select File > Import.
- Select Code Composer Studio™ > CCS Projects and click Next >.
- To the right of Select search-directory click Browse.
- From this directory, browse to
PATH_TO_XIVELY_LIBRARY/xively-client-c/examples/cc3200and highlight the
xively_demofolder. Click Open.
- Click Finish.
To adapt the imported project to your environment, modify project variables that describe SDK and library locations on your hard drive.
- In Code Composer Studio™, make sure the
xively_demoproject is highlighted.
- Select Project > Properties.
- Highlight Resource > Linked Resources.
- Double click on
CC3200_SDK_ROOTvariable name and using the Folder button navigate to where your
CC3200_SDKis installed, mark the subfolder
cc3200-sdkin SDK's main directory and hit OK twice.
- Double click on
XIVELY_LIBRARY_C_ROOTvariable name and again using the Folder make the variable to point to the
Before you build your application, set your Wi-Fi credentials and Xively device credentials.
- Set your Wi-Fi credentials in 'main.c':
a. Update AP name and password defines according to your Wi-Fi settings:
#define ENT_NAME "AccessPointName" #define PASSWORD "Password"
b. Select a security type in the
MainLogic() function according to your Wi-Fi settings. For example, in the case of WPA2 set, the line looks as follows:
g_SecParams.Type = SL_SEC_TYPE_WPA_WPA2;
c. For other WLAN security setting flags, refer to
CC3200_SDK_ROOT/simplelink/include/wlan.h or TI Simplelink documentation.
- Set your Xively Credentials in 'main.c'.
Locate and update the following three values using information you got from Step 5 Create your Xively (digital) device.
#define XIVELY_DEVICE_ID "PASTE_YOUR_XIVELY_DEVICE_ID" #define XIVELY_DEVICE_SECRET "PASTE_YOUR_XIVELY_DEVICE_SECRET" #define XIVELY_ACCOUNT_ID "PASTE_YOUR_XIVELY_ACCOUNT_ID"
- Select Project > Build Project.
When complete, you should see the following in the console:
<Linking> Finished building target: xively_demo.out ... **** Build Finished ****
- Execute the example on the CC3200 device:
a. Connect the device to your PC or Mac with USB cable.
b. Press and release the RESET switch SW1.
c. In Code Composer Studio™, hit the green bug button on the top or select Run > Debug.
d. In Code Composer Studio™, hit the green right-arrow button on the top or select Run > Resume.
Host Driver Version: 126.96.36.199 Build Version 188.8.131.52.184.108.40.206.220.127.116.11.34 [WLAN EVENT] STA Connected to the AP: LMI-GUEST , BSSID: c:d9:96:82:c2:c2 [NETAPP EVENT] IP Acquired: IP=10.229.211.31 ,Gateway=10.229.208.1 [WLAN EVENT]Device disconnected from the AP: LMI-GUEST, BSSID: c:d9:96:82:c2:c2 on application's request Device is configured in default state Device started as STATION [WLAN EVENT] STA Connected to the AP: LMI-GUEST , BSSID: 54:78:1a:42:f4:c2 [NETAPP EVENT] IP Acquired: IP=10.229.211.31 ,Gateway=10.229.208.1 SNTP_G: 1484067770, pool.ntp.org->0x726F4F2D SNTP_L: 1484067770, UT 0 close the user file: /cert/xively_cert_globalsign_rootca.der connected to broker.xively.com:8883 topic:xi/blue/v1/56c70c5d-984e-46ff-a615-7458d6b8a237/d/2bf108c9-e326-4a10-be11-eab4557b1dce/Green LED. Subscription granted 0. topic:xi/blue/v1/56c70c5d-984e-46ff-a615-7458d6b8a237/d/2bf108c9-e326-4a10-be11-eab4557b1dce/Orange LED. Subscription granted 0. topic:xi/blue/v1/56c70c5d-984e-46ff-a615-7458d6b8a237/d/2bf108c9-e326-4a10-be11-eab4557b1dce/Red LED. Subscription granted 0.
In the Console pane, you should see messages showing:
- Your device connecting to your Wi-Fi network.
- Acquiring the current time from an NTP server.
- Connecting to the Xively MQTT broker.
- Subscribing to three topics.
Reaching this point means you are able to produce and execute CC3200 compatible binary on the device itself. Congratulations!
NOTE: As per Texas Instruments instructions, keep the J15 Jumper set to ON and push Reset button on the board before each debug session. In case of trouble review the TI's CC3200 help doc.
If everything worked correctly, within a few seconds you should see a debug log that says:
connected to broker.xively.com:8883
If you do not see that, double check that you followed all the previous steps accurately. If you see a
state value other than
0, check within
xively_error.h to see which error could be occuring (ex:
34 means bad credentials).
If you are just testing (or on a Mac), skip the next step and go straight to Congratulations!
By default Code Composer uploads your application into RAM for execution. This is great for quick iterations, but it also means that your device will lose your changes when you unplug it.
To permanently make changes to the device, flash the device using a Windows binary executable called Uniflash. This tool is external to Code Composer Studio™.
- From Code Composer Studio™ Uniflash download page choose Windows Offline Version.
- Begin the installation process
- On the "Select Components" window, leave only the Simplelink Wi-Fi CC31xx/CC32xx option selected and continue installation process.
- Plug in your CC3200 device and make sure that the J15 Jumper is set to ON.
- From File select New Configuration and select the following:
- Connection: CC3x Serial(UART) Interface
- Board or Device: SimpleLink Wi-Fi CC3100/CC3200
- On the left panel under the System Files, highlight the
- From the right panel click the Browse button right next to the Url field.
- Pick the
- From the left panel highlight CC31xx/CC32xx Flash Setup and Control.
- Click the Program button.
- Set the J15 jumper to OFF and restart your device.
Result: Your device runs the test program.
You did it! You now have a CC3200 board connected and communicating with Xively.
You should be able to go back to your device page in Xively management app and see that its status is now
Connected and within the logs see its
Device connected lifecycle log.
When you enter the Product Launcher you will be able to see the graphical representation of data received from your CC3200 device such as temperature and button states. You can also turn on and off CC3200's LEDs using this web page interface.
For advanced security with OCSP support, take a look at the next tutorial: TI CC3200 with enhanced security.
For now please visit our docs and view some other guides and please let us know any feedback or questions that you may have regarding this guide or Xively in general!
More coming soon
connection to broker.xively.com:8883 has failed reason 34
A. A state of
34 means that the device connected to the Xively system, but its credentials are invalid. This could occur if you copied the credentials incorrectly or if you have regenerated the device credentials and are using older ones. The easiest way to fix this issue is to regenerate the device credentials (see Step 5.2) and re-copy the new credentials within
main.c. Once you've done this rebuild the image flash the hardware again.