📄 tep126.txt
字号:
===================================
CC2420 Radio Stack
===================================
:TEP: 126
:Group: Core Working Group
:Type: Documentary
:Status: Draft
:TinyOS-Version: 2.x
:Author: David Moss, Jonathan Hui, Philip Levis, and Jung Il Choi
:Draft-Created: 5-Mar-2007
:Draft-Version: $Revision: 1.5 $
:Draft-Modified: $Date: 2007/06/14 18:51:58 $
:Draft-Discuss: TinyOS Developer List <tinyos-devel at mail.millennium.berkeley.edu>
.. Note::
This memo documents a part of TinyOS for the TinyOS Community, and
requests discussion and suggestions for improvements. Distribution
of this memo is unlimited. This memo is in full compliance with
TEP 1.
Abstract
====================================================================
This TEP documents the architecture of the CC2420 low power listening
radio stack found in TinyOS 2.x. Radio stack layers and implementation
details of the CC2420 stack will be discussed. Readers will be better
informed about existing features, possible improvements, and limitations
of the CC2420 radio stack. Furthermore, lessons learned from
the construction of the stack can help guide development
of future TinyOS radio stacks.
1. Introduction
====================================================================
The TI/Chipcon CC2420 radio is a complex device, taking care of
many of the low-level details of transmitting and receiving packets
through hardware. Specifying the proper behavior of that hardware
requires a well defined radio stack implementation. Although much
of the functionality is available within the radio chip itself, there
are still many factors to consider when implementing a flexible,
general radio stack.
The software radio stack that drives the CC2420 radio consists of
many layers that sit between the application and hardware. The highest
levels of the radio stack modify data and headers in each packet, while
the lowest levels determine the actual send and receive behavior.
By understanding the functionality at each layer of the stack, as well
as the architecture of a layer itself, it is possible to easily extend
or condense the CC2420 radio stack to meet project requirements.
Some details about the CC2420 are out of the scope of this document.
These details can be found in the CC2420 datasheet [1]_.
2. CC2420 Radio Stack Layers
====================================================================
2.1 Layer Architecture
--------------------------------------------------------------------
The CC2420 radio stack consists of layers of functionality stacked
on top of each other to provide a complete mechanism that
modifies, filters, transmits, and controls inbound and outbound messages.
Each layer is a distinct module that can provide and use three sets of
interfaces in relation to the actual radio stack: Send, Receive, and
SplitControl. If a general layer provides one of those interfaces, it
also uses that interface from the layer below it in the stack. This
allows any given layer to be inserted anywhere in the stack through
independant wiring. For example:::
provides interface Send;
uses interface Send as SubSend;
provides interface Receive;
uses interface Receive as SubReceive;
provides interface SplitControl;
uses interface SplitControl as subControl;
The actual wiring of the CC2420 radio stack is done at the highest level
of the stack, inside CC2420ActiveMessageC. This configuration defines
three branches: Send, Receive, and SplitControl. Note that not all
layers need to provide and use all three Send, Receive, and SplitControl
interfaces:::
// SplitControl Layers
SplitControl = LplC;
LplC.SubControl -> CsmaC;
// Send Layers
AM.SubSend -> UniqueSendC;
UniqueSendC.SubSend -> LinkC;
LinkC.SubSend -> LplC.Send;
LplC.SubSend -> TinyosNetworkC.Send;
TinyosNetworkC.SubSend -> CsmaC;
// Receive Layers
AM.SubReceive -> LplC;
LplC.SubReceive -> UniqueReceiveC.Receive;
UniqueReceiveC.SubReceive -> TinyosNetworkC.Receive;
TinyosNetworkC.SubReceive -> CsmaC;
If another layer were to be added, CC2420ActiveMessageC would need
to be modified to wire it into the correct location.
2.1 Layer Descriptions
--------------------------------------------------------------------
The layers found within this radio stack are in the following order:
- ActiveMessageP: This is the highest layer in the stack, responsible
for filling in details in the packet header and providing information
about the packet to the application level [2]_. Because the CC2420 radio
chip itself uses 802.15.4 headers in hardware [1]_, it is not possible
for the layer to rearrange header bytes.
- UniqueSend: This layer generates a unique Data Sequence
Number (DSN) byte for the packet header. This byte is incremented once
per outgoing packet, starting with a pseudo-randomly generated number.
A receiver can detect duplicate packets by comparing
the source and DSN byte of a received packet with previous packets.
DSN is defined in the 802.15.4 specification [3]_.
- PacketLink: This layer provides automatic retransmission functionality
and is responsible for retrying a packet transmission if no
acknowledgement was heard from the receiver. PacketLink is
activated on a per-message basis, meaning the outgoing packet will
not use PacketLink unless it is configured ahead of time to do so.
PacketLink is most reliable when software acknowledgements are enabled
as opposed to hardware auto acknowledgements.
- CC2420AckLplP / CC2420NoAckLplP [4]_: These layers provide
asynchronous low power listening implementations. Supporting both of them
is CC2420DutyCycleP. The DutyCycleP component is responsible for
turning the radio on and off and performing receive checks.
After a detection occurs, DutyCycleP is hands off responsibility to
LowPowerListeningP to perform some transaction and turn the radio off
when convenient. Low power listening transmissions are activated on
a per-message basis, and the layer will continuously retransmit the full outbound
packet until either a response from the receiver is heard or the
transmit time expires.
The AckLplP implementation supports acknowledgement gaps during the
low power listening packetized preamble, which allows
transmitters to stop early but penalizes receive check lengths.
AckLplP low power listening is optimal for high transmission, long
receive check interval networks.
The NoAckLplP implementation does not support acknowledgements during
the packetized preamble. It continuously modulates the channel,
allowing the receiver to perform the smallest possible receive check.
NoAckLpl low power listening is effective for low transmission, short
receive check interval networks.
- UniqueReceive: This layer maintains a history of the source address
and DSN byte of the past few packets it has received, and helps
filter out duplicate received packets.
- TinyosNetworkC: This layer allows the TinyOS 2.x radio stack to
interoperate with other non-TinyOS networks. Proposed 6LowPAN
specifications include a network identifier byte after the
standard 802.15.4 header [5]_. If interoperability frames are
used, the dispatch layer provides functionality for setting
the network byte on outgoing packets and filtering non-TinyOS
incoming packets.
- CsmaC: This layer is responsible for defining 802.15.4 FCF
byte information in the outbound packet, providing default
backoff times when the radio detects a channel in use, and
defining the power-up/power-down procedure for the radio.
- TransmitP/ReceiveP: These layers are responsible for interacting
directly with the radio through the SPI bus, interrupts, and GPIO lines.
+--------------------------------------------------+
| Application Layer |
| |
+-----------------------+--------------------------+
+----------------------+-------------------------+
| Active Message Layer |
+----------------------+-------------------------+
+----------------------+-------------------------+
| Unique Send Layer |
+----------------------+-------------------------+
+----------------------+-------------------------+
| Optional Packet Link Layer |
+----------------------+-------------------------+
+----------------------+-------------------------+
| Optional Low Power Listening Implementations |
+----------------------+-------------------------+
+----------------------+-------------------------+
| Unique Receive Filtering Layer |
+----------------------+-------------------------+
+----------------------+-------------------------+
| Optional 6LowPAN TinyOS Network Layer |
+----------------------+-------------------------+
+----------------------+-------------------------+
| Carrier Sense Multiple Access (CSMA) |
+----------------------+-------------------------+
+----------+----------+ +----------+----------+
| ReceiveP | | TransmitP |
+----------+----------+ +----------+----------+
+-----------------------+-------------------------+
| SPI bus, GPIO, Interrupts, Timer Capture |
+-------------------------------------------------+
3. CC2420 Packet Format and Specifications
====================================================================
The CC2420 Packet structure is defined in CC2420.h. The default
I-Frame CC2420 header takes on the following format:::
typedef nx_struct cc2420_header_t {
nxle_uint8_t length;
nxle_uint16_t fcf;
nxle_uint8_t dsn;
nxle_uint16_t destpan;
nxle_uint16_t dest;
nxle_uint16_t src;
nxle_uint8_t network; // optionally included with 6LowPAN layer
nxle_uint8_t type;
} cc2420_header_t;
All fields up to 'network' are 802.15.4 specified fields, and are
used in the CC2420 hardware itself. The 'network' field is a 6LowPAN
interoperability specification [5]_ only to be included when the
6LowPAN TinyosNetwork layer is included. The 'type' field is a
TinyOS specific field.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -