Setting Up the Integrated Development Environment

All embedded software for Z-Stack is developed using TI’s CCS on a Windows® 7 or later PC. To browse through the SDK projects and view the code as it is referenced in this document, it is necessary to install and set up the CCS integrated development environment (IDE). This section provides information on where to find this software and how to properly configure the workspace for the IDE.

Path and file references in this document assume that the SimpleLink™ CC26x2R1 SDK has been installed to the default path, hereafter referred to as <INSTALL_DIR>. Projects do not build properly if paths below the top-level directory are modified.

Installing the SDK

To install the SimpleLink™ CC26x2R1 SDK, run the installer: simplelink_cc26x2_sdk_1_60_00_xx.exe

Note

The xx indicates the SDK build revision number at the time of release.

The default SimpleLink™ CC26x2R1 SDK install path is:

C:\ti\simplelink_cc26x2_sdk_x_xx_xx_xx

Note

The ‘xx’ indicate version numbers.

Installing the SDK installs the TI-RTOS kernel, and XDC tools if not already installed.

Installing the Z-Stack Plugin

Download the Zigbee SDK Plugin and run the installer. The default installation path is: C:\ti\simplelink_zigbee_sdk_plugin_1_60_10_xx

Installing Code Composer Studio

Code Composer Studio (CCS) provides a suite of tools that are used to develop applications that run on TI’s MCUs and embedded processors. Code Composer Studio™ contains many features that go beyond the scope of this documention, more information can be found on the CCS website. Check the CC26X2R1 SimpleLink SDK release notes to see which Code Composer Studio™ version to use.

The following describes installing and configuring the correct version of CCS and the necessary tools.

  1. Download CCS 7.4.0.00015 from the Download CCS wiki page.
  2. Launch the CCS installer.
  3. On the Processor Support menu (see Figure 57.), expand SimpleLink Wireless MCUs and select SimpleLink CC13xx and CC26xx Wireless MCUs
../../../_images/fig-ccs-install-processor-menu.jpeg

Figure 57. Processor Support Menu Selections

  1. Click the Next button, then click the Finish button.
  2. Open CCS 7.4.0.00015 to a new workspace.
  3. Apply all available updates by selecting HelpCheck for Updates.

Note

This step may require restarting CCS as each update is applied.

Importing SDK Projects

Launch the CCS IDE and prepare to import the Z-Stack projects from the installed SDK:

  1. Select ProjectImport CCS Projects

  2. Select Select search-directory: and click the Browse… button.

  3. Navigate to

    C:\ti\simplelink_zigbee_sdk_plugin_1_60_10_xx\examples\rtos\CC26X2R1_LAUNCHXL\zstack
    

    and click the OK button (see Figure 58.).

../../../_images/fig-import-project.png

Figure 58. Import SDK Projects Menu Selection

  1. The Discovered projects box now lists the projects that have been found. Select the Copy projects into workspace checkbox, click the Select All button, and last click the Finish button to import a copy of each SDK project into the workspace (see Figure 59.).
../../../_images/fig-import-project-pane.png

Figure 59. CCS Project Import Pane

Workspace Overview

The workspace now contains all projects needed to build downloadable images. The following examples build a Light image, to produce a functional Light device.

In the Project Explorer pane, click on the zc_light_cc26x2lp project to make it active. Click on the arrow to the left of the project to expand its contents, as shown in Figure 60..

../../../_images/fig-ccs-project-explorer-pane.png

Figure 60. CCS Project Explorer Pane

In Figure 60., all folders (under the zc_light_cc26x2lp project) except for zc_light_cc26x2lp can be considered input folders, which contain source code files, header files, and configuration files used to compile and link the application. The zc_light_cc26x2lp folder contains output files, which include programmable images and the linker map.

Compiling and Linking

All example projects in the SDK are ready to build out-of-the-box meaning they are preconfigured for use with a specific target board, in this case the CC26x2R1 LaunchPad™. To build a Light Application image that is ready to program onto a LaunchPad board, select ProjectRebuild Project. The Console pane of the IDE displays the individual results of source file compilations, followed by the linker results, as shown in Figure 61..

../../../_images/fig-ccs-project-console-pane.png

Figure 61. CCS Project Console Pane

In Figure 61., the output folder zc_light_cc26x2lp is populated with results from a successful build of the Light Application. Two programmable output files have been produced,``zc_light_cc26x2lp.out`` and zc_light_cc26x2lp.hex, along with a detailed linker map file, zc_light_cc26x2lp.map.

Downloading Hex Files

As shown in Compiling and Linking, the CCS linker produces .hex files that are ready for direct download to the target hardware. The hex image can be downloaded to a target device by a stand-alone tool, such as the UniFlash, shown in Figure 62..

../../../_images/fig-Uniflash.png

Figure 62. Programming Hex Files

Make sure you have your CC26x2R1 LaunchPad™ board connected, Uniflash should detect it in Detected Devices as shown in Figure 62.. Then press the Start button.

As shown in Figure 63., Uniflash can be used to program the prebuilt hex file using the Flash image(s) → Single feature. Use the Browse… button to navigate to the workspace path and select the hex file:

{Workspace Path}\zc_light_cc26x2lp\zc_light_cc26x2lp

../../../_images/fig-Uniflash-Program.png

Figure 63. Programming Hex Files

The hex file can be programmed retaining the Nv or erasing the whole flash from the device by selecting the proper option from Erase Settings in Settings & Utilities menu shown in Figure 64.

../../../_images/fig-Uniflash-Settings.png

Figure 64. UniFlash Settings

Debugging

When debugging is necessary, .out files produced by the linker are downloaded and run from the CCS IDE. The following procedure would typically be used to debug the program.

Continuing with the Light example project, the compiled program can be downloaded to the target and a debug session initiated by selecting: RunDebug on the IDE, as shown in Figure 65..

../../../_images/fig-debug-light-application.png

Figure 65. Debugging light Application

In Figure 65., the IDE has switched from the CCS Edit perspective to CCS Debug and shows the program counter stopped at main(). From this starting point, the developer can single-step through source code, set and run-to breakpoints, and run the program using icons at the top of the display. During a debug session, the user can switch between the CCS Edit and CCS Debug perspectives, as necessary, to view project files and perform debugging operations.

Useful CCS IDE Settings

The CCS provides a large number of configurable settings that can be used to customize the IDE and individual projects. The following examples do not alter the generated program code, but they can improve the developer’s experience when working with CCS projects. The CCS can reduce project compilation time by taking advantage of multiple processor cores on the development computer.

To use this feature, navigate to ProjectPropertiesBuildBuilder and select Enable parallel build, as shown in Figure 66..

../../../_images/fig-properties-light.png

Figure 66. Properties for zc_light_cc26x2lp

CCS users can control the amount of information that is displayed in the Console portion of the screen during project compilation and linking, ranging from Verbose to Super quiet. To change this setting, navigate to WindowPreferencesCode Composer StudioBuild and select an entry from the Console verbosity level drop-down, as shown in Figure 67.

../../../_images/fig-ccs-console-verbosity.png

Figure 67. Console Verbosity Level Preferences

Accessing Preprocessor Symbols

Throughout this document and in the source code, various C preprocessor symbols may need to be defined or modified at the project level. Preprocessor symbols (also known as Predefined Symbols) are used to enable and disable features and set operational values to be considered when the program is compiled. The preprocessor symbols are split between project specific preprocessor symbols and configuration header preprocessor symbols.

Project Specific Preprocessor Symbols

Configurations for a given example project are stored in CCS’s predefined symbols setting for that project.

In CCS, preprocessor symbols are accessed by opening the appropriate Project Properties by right clicking on the project in the Project Explorer and selecting Properties then navigating to CCS BuildARM CompilerPredefined Symbols. To add, delete, or edit a preprocessor symbol, use one of the icons shown in the red box in Figure 68..

../../../_images/fig-ccs-predefined-symbols.png

Figure 68. Predefined Symbols Pane

Packet Sniffer

Ubiqua Protocol Analyzer

Install the Required Software

Required Hardware

One of the following boards should be used:

Hardware Setup

  • Connect the CC2531EMK/CC2650LP/CC2652LP to the computer with Ubiqua installed.
  • If necessary, program your relevant sniffer hardware.
    • For CC2531EMK, use the hex image sniffer_fw_cc2531.hex at C:\Program Files (x86)\Texas Instruments \SmartRF Tools\Packet Sniffer\bin\general\firmware and Flash Programmer.
    • For CC2650/CC2652LP, use sniffer_fw_15_4.hex at C:\Program Files (x86)\Texas Instruments \SmartRF Tools\SmartRF Packet Sniffer 2\sniffer_fw\bin\{your_device}\15.4 and UniFlash.

Running the Packet Sniffer

  1. Connect your sniffing hardware to your PC.

  2. Start Ubiqua.

  3. Select Menu -> Device -> Add Device, and the Add Device window will appear.

    ubiqua add device

    Figure 69. ubiqua add device

  4. In the Available Devices column click the Local Devices expander, and select your hardware, either the CC2531EMK or the Application COM Port of the CC2650/CC2652 LaunchPad.

  5. For the CC2531EMK, follow the prompts to add the device. For the CC2650/CC2652LP, refer to the settings below:

    ubiqua select device

    Figure 70. Ubiqua select device

  6. Right click on your device in the Device Manager window, and select the Protocol Stack option.

  7. Click on the ZigBee checkbox.

    ubiqua select Zigbee protocol option

    Figure 71. Ubiqua select Zigbee protocol option

  8. Choose the Channel

    • In Z-Stack, the channel is set by DEFAULT_CHANLIST in f8wConfig.h

    From Ubiqua, select Menu -> Device Channel, and choose the matching channel:

    ubiqua select channel

    Figure 72. Ubiqua channel selection

  9. Enter the Default TC Link Key

    • In order to decrypt Zigbee traffic, you will need to enter the default Trust Center Link Key into the Ubiqua keychain.

    From Ubiqua, select Tools -> Options -> Security -> ‘Add’ -> Application or Trust Center Link Key

    Enter the following key:

    5a6967426565416c6c69616e63653039

    ubiqua tc link key entry
  10. Start Capture

    From Ubiqua, Select Menu -> Device -> Start Device

    ubiqua start

    Figure 73. Starting capture

  11. If required, Select: Menu -> View -> Traffic View (or other selections) to view activity.

Wireshark

Install the Required Software

Required Hardware

One of the following boards should be used:

Hardware Setup

  • Connect the CC2650/CC2652LP to the computer with Ubiqua installed and determine the correct COM Port for your LaunchPad. It will be the “XDS110 Class Application/User UART” port for your device, you can determine this in Windows by going to Device Manager > Ports
  • If necessary, program your relevant sniffer hardware.
    • For CC2650/CC2652LP, use sniffer_fw_15_4.hex at C:\Program Files (x86)\Texas Instruments \SmartRF Tools\SmartRF Packet Sniffer 2\sniffer_fw\bin\{your_device}}\15.4 and UniFlash.

Running the Packet Sniffer

  1. Connect your sniffing hardware to your PC.

  2. Start SmartRF Packet Sniffer 2 Sniffer Agent and select Device Configuration

    sniffer agent config
  3. Select your IEEE channel to sniff

    sniffer agent channel config
  4. If your Sniffer Agent looks like this, you are ready to set up Wireshark:

    sniffer agent waiting for connection
  5. Add the TI 15.4 Wireshark Dissector to Wireshark (assuming x64 installation)

    Navigate to C:\Program Files (x86)\Texas Instruments\SmartRF Tools\ SmartRF Packet Sniffer 2\wireshark\plugins\2.4.x\ and copy ti802154ge-x64-2x.dll and tirpi-x64-2x.dll to C:\Program Files\Wireshark\plugins\2.4.3\

  6. Open Wireshark go to Edit > Preferences > Protocols > Zigbee add the Zigbee TC Link Key

    5a6967426565416c6c69616e63653039

    wireshark tc link key
  7. Close Wireshark and create a new Desktop shortcut for Wireshark and add the following to the path: -i\\.\pipe\tiwspc_data -k

    This will set up the Pipe that sends data from Sniffer Agent into Wireshark

    wireshark shortcut config
  8. Open Wireshark with the new shortcut and you will see Wireshark sniffing Zigbee data.