March
2005, Issue 176
Zeroing
in on ZigBee (Part 2)
Chipsets
and Source Code
CC2420
802.15.4 KIT
Chipcon
boasts that the CC2420 is the first transceiver IC to
meet both the IEEE 802.15.4 and ZigBee standards. Of
course, there’s meeting the standards, and then there’s
the ability to produce a workable cost-effective product.
After using the evaluation kit, I can say that Chipcon
has produced both in the first version of silicon.
Chipcon’s
hardware support and software tools keep you ahead of
the complexity curve. The single-chip implementation
limits the RF circuitry to just the antenna and its
matching network (see Figure 1). The PC-based SmartRF
Studio software makes configuring and using the evaluation
kit a breeze.
|

(Click
here to enlarge)
|
Figure
1—Sure, you say, here comes another one of those
single-chip transceivers that somehow has managed
to morph itself into a complicated, messy RF jungle
by the time it makes its way from the sales brochure
to the application diagram. With the CC2420, however,
this promise is almost entirely kept.[1] |
Fortunately,
soldering the CC2420 (although fairly tiny) is just
under that critical threshold where doing it yourself
is still doable. The CC2420 QLP-48 package with a 0.5-mm
lead pitch is a challenge, but it’s one I’ve been able
to cope with. Products like PCB iron-on artwork transfer
paper has allowed amateur PCB makers like me to easily
produce tracks and clearances with 10-mil (0.01")
track widths and clearance. A friend of mine regularly
does 7 mils with a clothes iron and a slosh of etching
acid!
As
well as the physical challenge of the intricate surface-mount
packages, software drivers are the other big impediment
to experimenting at home. Often, a lack of information
in the datasheet and the need to program 100 registers
consigns hopeful efforts to the waste bin. When success
is achieved and the results are posted on a web site,
the person responsible is rightly proclaimed a hero.
ZigBee,
or even a full 802.15.4 link, would take more than an
afternoon to develop your own software for, but you’d
be able to get something useful fairly quickly. To prove
the RF link, simply use the serial port to confirm two-way
serial communication with the CC2420. A simple register
setting then places it in Transmit or Receive Test mode,
so you can check if the hardware works.
Making
a simple one-way, point-to-point link is the next step.
Then, a simple two-link is accomplished by implementing
mode control by manipulating the CC2420 state machine.
If you need more than a master/slave relationship, add
a simple MAC protocol such as aloha (time slots) or
check for a clear channel before transmission. You can
add more features at this point. Encryption, link quality
indication, and dynamic power output level control would
be nice. But wait. This is starting to sound like 802.15.4!
Why don’t you just download the free code from the Chipcon
web site?
Most
of what you need is included with the CC2420DBK demonstration
board kit. You can download the files from Chipcon to
make your own PCB. The schematic, BOM, and PCB layout
are all there. You can use the free source code for
the IEEE 802.15.4 layer. If you don’t want to make the
PCBs yourself, they’re available on the web site for
$50. The software isn’t a full implementation of the
IEEE 802.15.4 MAC, but it’s enough for basic message
sending and acknowledgment. The full IEEE 802.15.4 MAC
software is free if you sign a licensing agreement.
Although both versions were written in C for the Atmel
ATmega128L microcontroller, they port easily to other
microcontrollers.
The
easiest approach would be to copy the PCB exactly and
use the free GNU AVR gcc cross-development tool. Chipcon
strongly recommends that you copy the reference design
as closely as possible. If you want to develop a two-layer
PCB, you should keep the ground via positions as close
as possible to the location on the original board. Of
course, FCC licensing is another story. The first stage
is to get to a working prototype!
The
documentation for the CC2420DBK demonstration board
kit states that practical testing outdoors with line
of sight (LOS) resulted in a range of 170 m at 250 kbps
(zikes!). The simplicity of this information surprised
me, because IC vendors usually provide ambiguous range
performance information.
I
actually used the CC2420DK development kit for range
checking. It consists of a pair of motherboards (CC2400EB)
and their respective transceiver plug-in boards (CC2400EM),
as you can see in Photo 1.
|

(Click
here to enlarge)
|
Photo
1—Your next 802.15.4 project will look this simple.
The IC is 7 mm × 7 mm. Chipcon encourages you to
copy the PCB layout and adapt it for your own needs.
You need a four-layer PCB to guarantee the quoted
performance.[2] |
I
was initially discouraged by the presence of a Xilinx
Spartan II FPGA on the motherboard. Why so complex?
But my disappointment vanished when I discovered that
the FPGA is only used to configure the evaluation board
in a variety of different setups. The FPGA routes signals
so that the on-board microcontroller controls the plug-in
transceiver board. In another configuration, the plug-in
transceiver board connections are routed via the headers
to your processor board when prototyping with your own
microcontroller.
The
process of setting up, including the installation of
the SmartRF Studio evaluation software on the PC, took
less than 20 min. I found that it wouldn’t work on some
of my USB ports. Apart from this, things went extremely
well. Getting the two boards set up for a range check
was as simple as selecting Normal View, Packet TX, Start
Packet Transmit on one of the boards, and Start Packet
Receive on the other. I then checked for the lights
that flash after a reception. Link quality statistics
were displayed in real time on the PC. The CRC and packet
count information was great, but the RSSI didn’t work.
A separate piece of software can be used for packet
sniffing.
I
unplugged the board configured for reception, performed
a walk-around range check, and continued to look for
the flashing of the LEDs. Using this technique, I found
reliable reception everywhere in my 1,100-square-foot,
single-level wood house. Reliable transmission occurred
when transmitting through three walls with the doors
closed, even when partially shielding the receiver antenna
with my hand and placing it right on top of other operating
electronic equipment.
Taking
it outside, I found reliable reception 90' away through
one wooden wall out to the backyard. Walking down the
street, I got intermittent operation as far as 100 yards
away from the transmission end inside my house. I even
got reliable reception from 12' away after disconnecting
the antenna on the receiver!
The
version of the IC I tried suffered from excessive current
draw in Shutdown mode when the internal 1.8-V regulator
was in use. This was corrected in a later silicon revision,
along with an address recognition problem.
Now
let’s take a look at a simple software application example.
A pair of the CC2420DB evaluation kits running the example
program will establish a point-to-point RF link, sending
data packets containing a 5-byte payload (see Listing
1). The payload will be transmitted when the potentiometer
is turned, or the switch, S2, is held down. The first
byte of the payload contains the potentiometer value,
which controls the PWM duty cycle of the LED at the
receiving node. This example isn’t a full-blown ZigBee
application, or even a proper 802.15.4 implementation,
but it illustrates the basics of doing something useful
with the hardware. (Well, assuming blinking LEDs enthrall
you!)
Listing
2 shows how pressing the button and noting the status
of the yellow and green LEDs can perform a simple range
check. This is a simple but useful example. To keep
things simple, only a small subset of the IEEE 802.15.4
standard is implemented in this example. A pair of CC2420DBs
running this program will establish a point-to-point
link on a single channel. The frame format conforms
to 802.15.4, but it doesn’t implement any other MAC
properties. The full IEEE 802.15.4 MAC software can
be obtained for free after signing a licensing agreement.