SWRU214A
1
CC2530 Software Examples
User’s Guide
SWRU214A
2
Table of contents
1
Introduction................................................................................................................................................... 3
2 Abbreviations ................................................................................................................................................ 3
3 Using the software......................................................................................................................................... 4
3.1 Prerequisites ........................................................................................................................................... 4
3.2 Getting started......................................................................................................................................... 5
3.2.1 Set up Hardware and Software........................................................................................................ 5
3.2.2 Program the board with IAR........................................................................................................... 5
3.2.3 Alternative: Download hex files with the Flash Programmer ......................................................... 6
4 Application Examples................................................................................................................................... 8
4.1 Light/Switch application ......................................................................................................................... 8
4.2 Packet Error Rate tester application..................................................................................................... 10
4.3 Spectrum Analyzer application ............................................................................................................. 12
5 Software Library Reference....................................................................................................................... 13
5.1 Software architecture............................................................................................................................ 13
5.1.1 Software folder structure............................................................................................................... 13
5.2 Basic RF................................................................................................................................................ 14
5.2.1 Basic RF frame format.................................................................................................................. 14
5.2.2 Basic RF usage instructions .......................................................................................................... 15
5.2.3 Basic RF API reference................................................................................................................. 16
5.2.4 Basic RF operation........................................................................................................................ 18
5.2.5 Limitations of Basic RF ................................................................................................................ 21
5.3 Hardware Abstraction Layer ................................................................................................................ 21
5.3.1 HAL RF API reference ................................................................................................................. 21
References............................................................................................................................................................ 24
Document History ............................................................................................................................................... 24
SWRU214A
3
1 Introduction
This document describes software examples for the CC2530 System-on-Chip solution for IEEE
802.15.4/ZigBee. It also describes the necessary hardware and software to run the examples, and
how to get started. The software examples are designed to run on the CC2530EM mounted on
SmartRF05EB.
Section 3 of this document describes necessary prerequisites and how to get started with the code
examples. Section 4 describes how to run each of the application examples. The software library that
the code examples are built upon is described in section 5. The latter section also gives an API
reference and describes the functionality of the software library. Hex files for each of the example
applications are provided. IAR EW8051 Full version is needed for building the source code.
2 Abbreviations
API - Application Programming Interface
CBC-MAC - Cipher Block Chaining Message Authentication Code
CCM - Counter with CBC-MAC (mode of operation)
CCM* - Extension of CCM
FCS - Frame Check Sequence
HAL - Hardware Abstraction Layer
IO - Input/Output
MIC - Message Integrity Code
MPDU - MAC Protocol Data Unit
PAN - Personal Area Network
PER - Packet Error Rate
RF - Radio Frequency
RSSI - Received Signal Strength Indicator
SFD - Start of Frame Delimiter
SWRU214A
4
3 Using the software
This section describes the necessary hardware and software, and how to get started with the
application examples for CC2530.
3.1 Prerequisites
To successfully download and run the software described in this document, the following material is
needed:
• 2 x SmartRF05 EB rev. 1.7
• 2 x CC2530EM or CC2530-CC2591EM boards with appropriate antennas
• IAR Embedded Workbench for 8051 versions 7.51¹ (Full version)
• 4 AA batteries
1) The software is tested with version 7.51, but later versions might also work.
Figure 1 SmartRF05EB with CC2530EM
SWRU214A
5
3.2 Getting started
The following sections describe hardware and software setup, how to program the board and how to
run example code from the IAR debugger. A description of how to operate each software example is
found in section 4 of this guide.
3.2.1 Set up Hardware and Software
Follow these steps to configure the hardware and software needed:
1. Install IAR Embedded Workbench for 8051 and the patch to enable support for CC2530.
2. Save the CC2530 Software Examples zip file and unzip this file.
3. Attach the CC2530EM board to the SmartRF05EB.
4. Connect the SmartRF05EB to the PC with a USB cable.
5. Make sure the EM selection switch (P19 on SmartRF05EB) is placed in position SoC/TRX.
3.2.2 Program the board with IAR
6. Open IAR Embedded Workbench
7. Open the workspace file CC2530_SW_examples.eww with IAR. This file is found in the folder
ide under the folder where the CC2530 Software Examples was unzipped. Figure 2 shows the
IAR EW with the workspace opened.
8. Each application has its own project tab in the IAR workspace viewer. Select the project to be
compiled in the workspace viewer of IAR. See section 4 for a description of each application
example. The PER test and Light Switch applications both have two projects, one for the
CC2530EM and one for the CC2530-CC2591EM.
9. Select Project->Rebuild All. This will perform a full rebuild on the selected project.
10. Select Project->Debug. IAR will now establish a connection with the CC2530 and program
the application. The debugger will be started, halting the target at main().
11. Start the application by selecting Debug -> Go.
12. The board can be reset by selecting Debug -> Reset.
13. The debugger can be stopped by selecting Debug -> Stop Debugging.
14. The unit can now be operated independently from the debugger by disconnecting the USB
cable and using the AA batteries as power source. Cycle power with the power switch on the
SmartRF05EB.
15. Repeat the steps 9 to 12 to program additional boards.