Table of contents Introduction..............................3 Abbreviations ..............................3 Using the software............................4 Prerequisites ............................4 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 Application Examples ...........................
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.
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: •...
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.2.3 Alternative: Download hex files with the Flash Programmer It is also possible to program the boards with the Texas Instruments Flash Programmer as an alternative to IAR. Follow these steps after connecting the USB cable in section 3.2.1. 5. Install the Texas Instruments Flash Programmer. The TI Flash programmer tool is found under the ‘Tools and software’...
4. The light switch application example is now ready. LED1 on the ‘Light’ node can now be toggled by pushing joystick down on the ‘Switch’. The data sent out from the switch device can be observed with a Texas Instruments packet sniffer* configured on channel 25 – 2475 Mhz.
Page 8
Figure 4 Compile option for CCM security SWRU214...
4.2 Packet Error Rate tester application This application example requires 2 nodes for operation. Select the project ‘per_test’* in the IAR workspace viewer and program both nodes. *The PER test application is also preprogrammed on both of the CC2530EM boards found in the CC2530DK.
2’s complement and must be corrected with an RSSI offset to get the absolute RSSI value (in dBm). This offset is specified in the CC2530 datasheet. The converted RSSI values of the last 32 (defined by RSSI_AVG_WINDOW_SIZE in per_test.h) received packets are stored in a ring buffer, implementing a moving average filter.
5 Software Library Reference This section describes the software libraries the application examples are built upon. 5.1 Software architecture The design of the software in this package is based on the layered architecture as depicted in Figure 5 below. Application Basic RF Hardware Abstraction Layer Hardware...
Figure 6 Software folder structure 5.2 Basic RF The Basic RF layer offers a simple protocol for transmission and reception using a two-way RF link. The Basic RF protocol offers service for packet transmission and reception. It also offers secure communication by use of CCM-64 authentication and encryption/decryption of packets.
The frame format of the Basic RF protocol is shown in Figure 7. The first byte is a length byte. The length byte itself is not counted in the length. The frame control field is set according to the IEEE Std. 802.15.4-2006.
5.2.3 Basic RF API reference Include files basic_rf.h basic_rf_security.h Compile time configuration In order to use the security features of basic RF the following compile option must be set in the project files: SECURITY_CCM Defining this compile switch enables the security features of Basic RF. All outgoing packets will be authenticated and encrypted with ENC-MIC-64 CCM*.
Page 15
Send packet to the given destination short address. Returns TRUE if packet was sent successfully, and FAILED otherwise. If ackRequest is TRUE the return value of this function will only be TRUE if an acknowledgment is received from the destination. uint8 basicRfPacketIsReady(void) Returns TRUE if a received packet is ready to be retrieved by higher layer.
In addition the basicRfInit() function sets up the channel, short address and PAN ID to the CC2530, and register the interrupt service routine to handle the received packet interrupt from the radio.
Page 17
Packet transmission Figure 9 illustrates the sequence of function calls for a packet transmission scenario with Basic RF. In this scenario the security features of Basic RF are disabled. Application Basic RF HAL RF basicRfSendPacket(destAddr, pPayload, length) halRfWaitTransceiverReady() basicRfBuildMpdu(destAddr, pPayload, length) halRfWriteTxBuf(txMpdu, mpduLength) halRfTransmit()
Page 18
4. Basic RF will then call halRfWriteTxBuf() to write the MPDU to the CC2530 TX FIFO buffer. 5. The function halRfTransmit() is called to transmit a packet with on the air. This function will issue the command strobe ISTXON() to send the packet in the TX FIFO.
See Figure 10. 2. The length of the received frame is read out from the first byte in the RX buffer on CC2530. This is done with the call halRfReadRxBuf(length, 1) in Figure 10.
Page 20
Functions uint8 halRfInit(void) Powers up the radio, configures the radio with recommended register settings, enables autoack and configures the IO on the radio. This function must be called after halBoardInit(). uint8 halRfSetPower(uint8 power) Set TX output power uint8 halRfTransmit(void) Transmit frame void halRfSetGain(uint8 gainMode) Set gain mode.
Page 21
Wait until the transceiver is ready void halRfReceiveOn(void) Turn on receiver on radio. void halRfReceiveOff(void) Turn off receiver on radio. void halRfDisableRxInterrupt(void) Clear and disable RX interrupt. void halRfEnableRxInterrupt(void) Enable RX interrupt. void halRfRxInterruptConfig(ISR_FUNC_PTR pf) Configure RX interrupt, and setting the function to be called on interrupt. void halRfSetChannel(uint8 channel) Set RF channel.
Increment the frame counter field of the nonce used for outgoing packets. Refer to IEEE Std. 802.15.4-2006 [1] for a description of this field. References [1] IEEE Std. 802.15.4-2006, Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Networks (WPANs) [2] CC2530 datasheet Document History Revision Date Description/Changes 2009.03.18...
Need help?
Do you have a question about the CC2530 and is the answer not in the manual?
Questions and answers