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.
- Download CCS 7.4.0.00015 from the Download CCS wiki page.
- Launch the CCS installer.
- On the Processor Support menu (see Figure 57.), expand SimpleLink Wireless MCUs and select SimpleLink CC13xx and CC26xx Wireless MCUs
- Click the Next button, then click the Finish button.
- Open CCS 7.4.0.00015 to a new workspace.
- Apply all available updates by selecting
Help
→Check 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:
Select Project → Import CCS Projects
Select Select search-directory: and click the Browse… button.
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.).
- 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.).
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..
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 Project → Rebuild 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..
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..
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
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.
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: Run → Debug on the IDE, as shown in Figure 65..
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 Project → Properties → Build → Builder and select Enable parallel build, as shown in Figure 66..
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 Window → Preferences → Code Composer Studio → Build and select an entry from the Console verbosity level drop-down, as shown in Figure 67.
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 Build → ARM Compiler → Predefined Symbols. To add, delete, or edit a preprocessor symbol, use one of the icons shown in the red box in Figure 68..
Packet Sniffer¶
Ubiqua Protocol Analyzer¶
Install the Required Software¶
- Download the Ubilogix Ubiqua packet sniffer software from: https://www.ubilogix.com/ubiqua/
- To get the drivers for the CC2531EMK dongle install the TI Packet sniffer from: https://www.ti.com/tool/packet-sniffer
- To program the CC2531EMK install TI Flash Programmer from: https://www.ti.com/tool/flash-programmer
- To get the drivers for the CC2650/CC2652LP install the TI Packet sniffer 2 from: https://www.ti.com/tool/packet-sniffer
- To program the CC2650/CC2652LP install UniFlash from: https://www.ti.com/tool/UNIFLASH
Required Hardware¶
One of the following boards should be used:
- TI CC2531EMK USB Dongle: https://www.ti.com/tool/CC2531USB-RD
- (optional for programming CC2531EMK) CC-debugger https://www.ti.com/tool/cc-debugger
- TI CC2652 Launchpad: https://www.ti.com/tool/LAUNCHXL-CC26X2R1
- TI CC2650 Launchpad: https://www.ti.com/tool/LAUNCHXL-CC2650
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
atC:\Program Files (x86)\Texas Instruments \SmartRF Tools\Packet Sniffer\bin\general\firmware
and Flash Programmer. - For CC2650/CC2652LP, use
sniffer_fw_15_4.hex
atC:\Program Files (x86)\Texas Instruments \SmartRF Tools\SmartRF Packet Sniffer 2\sniffer_fw\bin\{your_device}\15.4
and UniFlash.
- For CC2531EMK, use the hex
image
Running the Packet Sniffer¶
Connect your sniffing hardware to your PC.
Start Ubiqua.
Select Menu -> Device -> Add Device, and the Add Device window will appear.
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.
For the CC2531EMK, follow the prompts to add the device. For the CC2650/CC2652LP, refer to the settings below:
Right click on your device in the Device Manager window, and select the Protocol Stack option.
Click on the ZigBee checkbox.
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:
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
Start Capture
From Ubiqua, Select Menu -> Device -> Start Device
If required, Select: Menu -> View -> Traffic View (or other selections) to view activity.
Wireshark¶
Install the Required Software¶
- TI Packet Sniffer 2: https://www.ti.com/tool/packet-sniffer
- Wireshark: https://www.wireshark.org/#download
- To program the CC2650/CC2652LP install UniFlash from: https://www.ti.com/tool/UNIFLASH
Required Hardware¶
One of the following boards should be used:
- TI CC2652 Launchpad: https://www.ti.com/tool/LAUNCHXL-CC26X2R1
- TI CC2650 Launchpad: https://www.ti.com/tool/LAUNCHXL-CC2650
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
atC:\Program Files (x86)\Texas Instruments \SmartRF Tools\SmartRF Packet Sniffer 2\sniffer_fw\bin\{your_device}}\15.4
and UniFlash.
- For CC2650/CC2652LP, use
Running the Packet Sniffer¶
Connect your sniffing hardware to your PC.
Start SmartRF Packet Sniffer 2 Sniffer Agent and select Device Configuration
Select your IEEE channel to sniff
If your Sniffer Agent looks like this, you are ready to set up Wireshark:
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 copyti802154ge-x64-2x.dll
andtirpi-x64-2x.dll
toC:\Program Files\Wireshark\plugins\2.4.3\
Open Wireshark go to Edit > Preferences > Protocols > Zigbee add the Zigbee TC Link Key
5a6967426565416c6c69616e63653039
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
Open Wireshark with the new shortcut and you will see Wireshark sniffing Zigbee data.