TI CC3200

How to connect a TI CC3200 to Xively

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 task in a sequential manner.

This tutorial supports Windows and macOS. For Linux, follow the macOS instructions.

Hardware you will need

Texas Instruments SimpleLink™ Wi-Fi® CC3200 LaunchPad™ development kit

SimpleLink Wi-Fi CC3200 LaunchPad

Software installed during the tutorial

  • Code Composer Studio™ version 7.0
  • CC3200 Simplelink™ Wi-Fi SDK
  • Xively C Client library repository
  • CC3200 Uniflash (optional)

Task 1 of 7: Install Code Composer Studio™

Code Composer Studio™ includes the toolchain (compiler) you will need to build for the CC3200 and a java-based IDE.

  1. Download and install the Code Composer Studio™ version 7.0 appropriate for your operating system (Windows, Linux or macOS): Code Composer Studio (CCS) Integrated Development Environment (IDE).
  2. Accept the license agreement and click Next >.
  3. Choose the default install folder and click Next >. Or, if you install into a custom directory, then note its path as you will need it later. By default the path should be c:\ti on Windows and /Applications/ti on macOS.
  4. 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.

  1. Click Next and click Finish when the button becomes enabled.

Task 2 of 7: Install the CC3200 Simplelink™ Wi-Fi SDK

This SDK contains the platform libraries that you will need to compile and link against when writing software for the CC3200.

  1. Launch Code Composer Studio™.
  2. If prompted to Select a Workspace, click OK to select the default path.
  3. Select View > Resource Explorer from the top bar menu.
  4. Select CC3200 Wi-Fi from the list of available development tools.
  5. 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.
    Note: 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 want. Once downloaded, install using the default settings.

Task 3 of 7: Download the Xively C Client library

Download the library source code from xively-client-c. Git clone the repository or download the source archive from the right side of the GitHub page.

If you are not used to using Git, you can find their basics tutorial here

Task 4 of 7: Build the Xively C Client library

Configure the Xively C Client build environment by setting paths to CSS and SDK, and build the library:

If you are not used to using Git, you can find their basics tutorial here

  1. Go to the make/mt-os folder and open the make target file (mk) ```mt-cc3200```` in your preferred text editor.

  2. Scroll to the HOSTS section devoted to your host platform: MAC HOST OS, WINDOWS HOST OS, or LINUX HOST OS.

  3. In the HOST section appropriate for your platform, set the XI_CC3200_PATH_CCS_TOOLS and XI_CC3200_PATH_SDK variables 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 already be valid and you shouldn't need to change anything.

  4. The toolchain that Code Composer Studio™ downloaded might differ from the default that's configured in this mt-cc3200.mk file. Verify the compiler paths:
    a. Browse to the path which you set in XI_CC3200_PATH_CCS_TOOLS.
    b. Open up the compiler/ directory (by default, located at: C:\ti\ccsv7\tools or the path you set your SDK installer to) and note the name of the toolchain.
    c. Compare this to the toolchain name stored in the COMPILER variable near the top of the file in mt-cc3200.mk. Update the COMPILER variable as necessary.

  5. Open a command prompt and navigate to the xively-client-c root folder

  6. Execute the following commands:

In Windows:

Set paths for the gmake and mkdir commands:

By default, <path-to-ccs> is the path to your Code Composer Studio, for example C:\ti\ccsv6.


Clean and build the library by executing the following commands:

gmake PRESET=CC3200_TLS_SOCKET clean

In macOS and Linux:

Clean and build the library:

make PRESET=CC3200_TLS_SOCKET clean

Task 5 of 7: Create your Xively digital device

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 CC3200 device template using the Product Launcher

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

  1. Click on Product Launcher > Add another device.
  1. From the pop-up window select Choose from our template library and click Next.
  1. 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.

Tip: Save this password to a text file as it is necessary for use later.

  1. Get the Device ID by clicking the turquoise rectangle with your Device ID.

Tip: Save this Device ID to a text file as it is necessary for use later.

You now have a provisioned device in Xively that your CC3200 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. To get 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.

Tip: Save this Account ID to a text file as it is necessary for use later.

Now you are ready to build and run Xively Demo application.

Task 6 of 7: Build your client 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.

Import xively_demo

  1. In Code Composer Studio™, select File > Import.
  2. Select Code Composer Studio™ > CCS Projects and click Next >.
  3. To the right of Select search-directory click Browse.
  4. From this directory, browse to PATH_TO_XIVELY_LIBRARY/xively-client-c/examples/cc3200 5. Highlight the xively_demo folder. Click Open.
  5. Click Finish.

Configure Code Composer Studio project

To adapt the imported project to your environment, modify project variables that describe SDK and library locations on your hard drive.

  1. In Code Composer Studio™, make sure the xively_demo project is highlighted.
  2. Select Project > Properties.
  3. Highlight Resource > Linked Resources.
  4. Double click on CC3200_SDK_ROOT variable name and using the Folder button navigate to where your CC3200_SDK is installed, mark the subfolder cc3200-sdk in SDK's main directory and hit OK twice.
  5. Double click on XIVELY_LIBRARY_C_ROOT variable name and again using the Folder make the variable to point to the xively-client-c folder and hit OK twice. By default, the 'xively-client-c' folder should be somewhere such as C:/ti/$(XI_CC3200_SDK)/cc3200-sdk/.

Configure xively_demo

Before you build your application, set your Wi-Fi credentials and Xively device credentials.

  1. In the Project Explorer tab, navigate to 'main.c'.
  2. Update AP name and password defines according to your Wi-Fi settings:
#define ENT_NAME    "AccessPointName"
            #define PASSWORD    "Password"
  1. 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;

Note: For other WLAN security setting flags, refer to CC3200_SDK_ROOT/simplelink/include/wlan.h or TI Simplelink documentation.

  1. In the Project Explorer tab, navigate to 'main.c'.
  2. Locate and update the following three values using the information you got from Step 5 Create your Xively (digital) device.

Note: Your XIVELY_DEVICE_SECRET is the same as your Get Password.


All of the above can be obtained by logging into your xively.com account.

Enable Firmware Updates and Secure File Transfer

In the main.c file, follow the below code sample to ensure that your device is enabled for Firmware Updates and Secure File Transfer:

    /* Pass list of files to be updated by the Xively Services. */
    const char** files_to_keep_updated =
        ( const char* [] ){"firmware.bin", "credentials.cfg"};

    xi_set_updateable_files( gXivelyContextHandle, files_to_keep_updated, 2);

In xi_set_updateable_files , the number after files_to_keep_updated, must be a value equal to the number of files that are listed as files you want to keep updated.

In the above example, the number of files is 2: firmware.bin and credentials.cfg.

Build and run the example

  1. Select Project > Build Project.
    When complete, you should see the following in the console:
            Finished building target: xively_demo.out
            **** Build Finished ****
  1. Execute the example on the CC3200 device:
    a. Connect the device to your PC or Mac with USB cable.
    b. On the device, press and release the RESET switch SW1.
    c. In Code Composer Studio™, click the green bug button on the top or select Run > Debug.
    d. In Code Composer Studio™, click the green right-arrow button on the top or select Run > Resume.
Host Driver Version:
Build Version
[WLAN EVENT] STA Connected to the AP: LMI-GUEST , BSSID: c:d9:96:82:c2:c2
[NETAPP EVENT] IP Acquired: IP= ,Gateway=
[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= ,Gateway=
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 the Reset button on the board before each debug session. In case of trouble review the TI's CC3200 help doc.

You should see a debug log containing:

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 occurring (ex: 34 means bad credentials).

If you are just testing (or on a Mac), skip the next step and go straight to Congratulations!

Task 7 of 7: Flash your client application onto the device.

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™.

Download and install the Code Composer Studio™ Uniflash software

  1. From Code Composer Studio™ Uniflash download page choose Windows Offline Version.
  2. Begin the installation process
  3. On the "Select Components" window, leave only the Simplelink Wi-Fi CC31xx/CC32xx option selected and continue the installation process.

Run the Code Composer Studio™ Uniflash Software

To flash your client application with Firmware Updates, see here.

To flash your client application without Firmware Updates, see here.


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.

What to do next?

How to use a more secure configuration of wolfSSL with OCSP Stapling?

For advanced security with OCSP support, take a look at the next tutorial: TI CC3200 with enhanced security.

Common pitfalls or errors

Q. When I build the example application I get the "Xively Hello World" debug message, but with a state of 34.
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.

Updated 2 years ago

TI CC3200

How to connect a TI CC3200 to Xively

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.