MIT
6.111 Labkit  

 FPGA Labkit

for 6.111 Introduction to Digital Systems

6.111 homeLabkit home → CC2420 Radio

CC2420 Radio

by David Wentzloff

Introduction

The Chipcon (now owned by Texas Instruments) CC2420 is a commercial radio chip that complies with the ZigBee wireless standard. We have CC2420DBK development kits available for your project. Each development kit comes with 2 development boards (2 radios). Each development board has a Chipcon CC2420 radio, an Atmel Atmega128L microcontroller, 32kB of external RAM, an RS-232 connector, buttons, a mini joystick, four LED's, a temperature sensor, a potentiometer, an on-board antenna, a 9V battery connector, and assorted general purpose connectors. Free software is available for programming the CC2420 radio, and compiling C code for the Atmel microcontroller. Chipcon has developed C libraries for communicating with the CC2420 radio from the Atmel microcontroller.

The microcontroller has two built-in options that can be used for communicating with the 6.111 Labkit: an RS-232 serial port, and a high-speed SPI port. Both are configured with internal registers in the microcontroller. Alternatively, there are several general purpose I/O pins and an external interrupt pin available on the board. These can be used to develop a custom parallel interface to the labkit.

The CC2420 development kits were donated to 6.111 by Texas Instruments.

CC2420DBK evaluation board

Radio Specifications

The radio operates in the 2.4GHz ISM band and can communicate at a maximum data rate of 250kb/s. Realistically, the average data rate is closer to 25kb/s including all overhead. The development board may be powered from an external supply between 4-10V, or powered by a 9V battery.

The radio development board also has an integrated Atmel microcontroller that can be programmed in C. Libraries are available that make it easy to transmit and receive data, and communicate with the CC2420 radio chip.

For more information, please refer to the CC2420 documentation on Chipcon's webpage.

Step 1: Install the Required Software

Begin by downloading and installing the following software:

  1. WinAVR: a GCC compiler toolchain for the AVR microcontroller architecture. WinAVR can be downloaded from SourceForge.net. (Get the latest available version. Release 20070122 was used for this tutorial.)
  2. AVR Studio: an integrated development environment used for compiling C code (requires WinAVR) and programming Atmel microcontrollers. AVR studio can be downloaded from Atmel's website. (Studio 4 Build 528 was used for this tutorial.)
  3. Download the "CC2420DBK Examples Release" from the CC2420 product page on Chipcon's website, and unzip it to your local working directory (e.g. My Documents/your_6111_project/). (Edition 1.1 was used for this tutorial.)
  4. Download the "CC2420DBK Libraries" from the CC2420 product page on Chipcon's website, and unzip them to a temp directory. (Edition 1.1 was used for this tutorial.)
    • Copy the contents of the 'include' directory to C:\WinAVR\avr\include\.
    • Copy the contents of the 'lib' directory to your working directory—you will need to manually add these source files to your project.
  5. You do not need the Chipcon SmartRF Studio software.

Step 2: Test the Wireless Link

Follow these steps to verify the wireless link is working properly. Refer to page 46 of the CC2420DBK Demonstration Board Kit User Manual for more information.

  1. Power the two CC2420DBK radio boards using an external 4-10V power supply or a 9V battery.
  2. Verify the jumper pins on the PCB and configured as shown below.

    Jumper positions

  3. Program both radios with the rf_blink_led.hex file using the programming instructions below. The file is found in the "CC2420DBK Examples Release", available on the CC2420 product page on Chipcon.com.
  4. On the first radio, press and release the 'RESET' button (S1), then push the mini joystick (U5) in any direction—up, down, left, or right—and release. Be careful not to press directly down on the mini joystick.
  5. On the second radio, press and release the 'RESET' button (S1), then press and release the mini joystick (U5) directly down like a push-button.
  6. Turn the potentiometer on either of the radios and it will adjust the brightness of an LED on the other board.

Step 3: Programming a HEX File on the CC2420DBK

Follow these steps to program the CC2420DBK radio board with a compiled HEX file. Refer to page 43 of the CC2420DBK Demonstration Board Kit User Manual for more information.

  1. Power the CC2420DBK radio board using an external 4-10V power supply or a 9V battery.
  2. Connect the CC2420DBK serial port to your PC serial port using the supplied cable.
  3. Hold down the 'S2' push button on the radio.
  4. Press and release the 'RESET' (S1) button while still holding the 'S2' button to enter the programming mode.
  5. Release the 'S2' button. All LEDs should be off.
  6. Start up AVR Studio 4, and select Tools → AVR Prog…
  7. Browse to find your *.hex file. Use rf_blink_led.hex found in the "CC2420DBK Examples Release" for testing the wireless link.
  8. Click on the Flash "Program" button to program the Flash memory.
  9. Push the 'RESET' (S1) button on the radio to exit programming mode and start your application.

    AVR Studio programming dialog

Step 4: Create an AVR Studio Project

Now you can create your own project within AVR Studio and begin writing code for the radio board. Begin by compiling the 'rf_blink_led.c' file and programming the radios with the compiled *.hex file. Then verify the wireless link still works, as in the wireless link test above.

  1. Launch AVR Studio 4, and open the Project Wizard from Project → Project Wizard. By default the Project Wizard launches at startup.
  2. Click on 'New Project.'

    AVR Studio project wizard

  3. Select 'AVR GCC' and give the project a name. Uncheck 'Create initial file', and check 'Create folder.' Browse to the location where you would like the project to be stored. Click 'Next'.

    AVR Studio project wizard

  4. Select 'AVR Simulator' as the Debug platform, and 'ATmega128' as the Device. Click 'Load'.

    AVR Studio project wizard

  5. Right-click on the 'Source Files' folder and add the following existing source files to the project. These files are available in the "CC2420DBK Libraries" from the CC2420 product page on Chipcon.com.
    lib/basic_rf/basic_rf_init.c
    lib/basic_rf/basic_rf_receive.c
    lib/basic_rf/basic_rf_send_packet.c
    lib/hal/hal_rf_set_channel.c
    lib/hal/hal_rf_wait_for_crystal_oscillator.c
    lib/hal/atmega128/hal_wait.c
    

    AVR Studio adding source files

  6. Copy the following file to your project directory and the right-click on the 'Source Files' folder and add the file to the project. This file is available in the "CC2420DBK Examples Release" from the CC2420 product page on Chipcon.com.
    apps/basic_rf/rf_blink_led/rf_blink_led.c
    
  7. Your project should now look like this.

    AVR Studio with all source files added

  8. Double click on the rf_blink_led.c under Source Files to view the file. This contains the main program routine, and is the template you should use to begin your own project.
  9. Right click on the project name and select 'Edit Configuration Options.'

    AVR Studio configuration menu

  10. Select 'Custom Options,' and add the following two options in the 'Custom Compilation Options' add field and click 'OK'.
    -DCC2420DB
    -std=gnu99
    
    Make sure to include the dashes.

    AVR Studio custom options dialog

  11. Build the project by right clicking on the project name again, and selecting 'Rebuild.' A *.hex file should now be created in the [project_directory]/default/ directory that you can program the radio with following the programming steps outlined above. Compile the rf_blink_led.c source without modification first and program the radios with the generated *.hex file to verify everything is working. This is the same demo used to test the wireless link above.

    AVR Studio building the project

Additional Information

MIT 6.111 Introduction to Digital Systems, Updated May 01, 2007