1. CC2420 Interfaces On Micaz

1.1 Interface: tos.chips.cc2420.CC2420Config

interface CC2420Config

An HAL abstraction of the ChipCon CC2420 radio. This abstraction deals specifically with radio configurations. All get() and set() commands are single-phase. After setting some values, a call to sync() is required for the changes to propagate to the cc2420 hardware chip. This interface allows setting multiple parameters before calling sync().

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.6 $ $Date: 2006/06/20 18:56:04 $

Commands

command uint8_t getChannel()

Change the channel of the radio.

command uint16_t getPanAddr()

Change the PAN address of the radio.

command uint16_t getShortAddr()

Change the short address of the radio.

command void setChannel(uint8_t channel)

command void setPanAddr(uint16_t address)

command void setShortAddr(uint16_t address)

command error_t sync()

Sync configuration changes with the radio hardware.

Events

event void syncDone(error_t error)

Commands – Details

getChannel

command uint8_t getChannel()

Change the channel of the radio.

getPanAddr

command uint16_t getPanAddr()

Change the PAN address of the radio.

getShortAddr

command uint16_t getShortAddr()

Change the short address of the radio.

setChannel

command void setChannel(uint8_t channel)


setPanAddr

command void setPanAddr(uint16_t address)


setShortAddr

command void setShortAddr(uint16_t address)


sync

command error_t sync()

Sync configuration changes with the radio hardware. This only applies to set commands below.

Returns:

SUCCESS if the request was accepted, FAIL otherwise.

Events – Details

syncDone

event void syncDone(error_t error)

1.2 Interface: tos.chips.cc2420.CC2420Fifo

interface CC2420Fifo

HAL abstraction for accessing the FIFO registers of a ChipCon CC2420 radio.

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.7 $ $Date: 2006/06/20 18:56:04 $

Commands

command cc2420_status_t beginRead(uint8_t *data, uint8_t length)

Start reading from the FIFO.

command error_t continueRead(uint8_t *data, uint8_t length)

Continue reading from the FIFO without having to send the address byte again.

command cc2420_status_t write(uint8_t *data, uint8_t length)

Start writing the FIFO.

Events

event void readDone(uint8_t *data, uint8_t length, error_t error)

Signals the completion of a read operation.

event void writeDone(uint8_t *data, uint8_t length, error_t error)

Signals the completion of a write operation.

Commands – Details

beginRead

command cc2420_status_t beginRead(uint8_t *data, uint8_t length)

Start reading from the FIFO. The readDone event will be signalled upon completion.

Parameters:

data – a pointer to the receive buffer.

length – number of bytes to read.

Returns:

status byte returned when sending the last address byte of the SPI transaction.

continueRead

command error_t continueRead(uint8_t *data, uint8_t length)

Continue reading from the FIFO without having to send the address byte again. The readDone event will be signalled upon completion.

Parameters:

data – a pointer to the receive buffer.

length – number of bytes to read.

Returns:

SUCCESS always.

write

command cc2420_status_t write(uint8_t *data, uint8_t length)

Start writing the FIFO. The writeDone event will be signalled upon completion.

Parameters:

data – a pointer to the send buffer.

length – number of bytes to write.

Returns:

status byte returned when sending the last address byte of the SPI transaction.

Events – Details

readDone

event void readDone(uint8_t *data, uint8_t length, error_t error)

Signals the completion of a read operation.

Parameters:

data – a pointer to the receive buffer.

length – number of bytes read.

error – notification of how the operation went

writeDone

event void writeDone(uint8_t *data, uint8_t length, error_t error)

Signals the completion of a write operation.

Parameters:

data – a pointer to the send buffer.

length – number of bytes written.

error – notification of how the operation went

1.3 Interface: tos.chips.cc2420.CC2420Packet

interface CC2420Packet

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.2 $ $Date: 2006/06/20 18:56:04 $

Commands

command uint8_t getLqi(message_t *p_msg)

Get lqi value for a given packet.

command uint8_t getPower(message_t *p_msg)

Get transmission power setting for current packet.

command int8_t getRssi(message_t *p_msg)

Get rssi value for a given packet.

command void setPower(message_t *p_msg, uint8_t power)

Set transmission power for a given packet.

Commands – Details

getLqi

command uint8_t getLqi(message_t *p_msg)

Get lqi value for a given packet. For received packets, it is the link quality indicator value when receiving that packet. For sent packets, it is the link quality indicator value of the ack if an ack was received.

getPower

command uint8_t getPower(message_t *p_msg)

Get transmission power setting for current packet.

Parameters:

the – message

getRssi

command int8_t getRssi(message_t *p_msg)

Get rssi value for a given packet. For received packets, it is the received signal strength when receiving that packet. For sent packets, it is the received signal strength of the ack if an ack was received.

setPower

command void setPower(message_t *p_msg, uint8_t power)

Set transmission power for a given packet. Valid ranges are between 0 and 31.

Parameters:

p_msg – the message.

power – transmission power.

1.4 Interface: tos.chips.cc2420.CC2420Ram

interface CC2420Ram

HAL abstraction for accessing theRAM of a ChipCon CC2420 radio.

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.8 $ $Date: 2006/06/20 18:56:04 $

Commands

command cc2420_status_t read(uint8_t offset, uint8_t *data, uint8_t length)

Read data from a RAM.

command cc2420_status_t write(uint8_t offset, uint8_t *data, uint8_t length)

Write data to RAM.

Commands – Details

read

command cc2420_status_t read(uint8_t offset, uint8_t *data, uint8_t length)

Read data from a RAM. This operation is sychronous.

Parameters:

offset – within the field.

data – a pointer to the receive buffer.

length – number of bytes to read.

Returns:

status byte returned when sending the last byte of the SPI transaction.

write

command cc2420_status_t write(uint8_t offset, uint8_t *data, uint8_t length)

Write data to RAM. This operation is sychronous.

Parameters:

offset – within the field.

data – a pointer to the send buffer.

length – number of bytes to write.

Returns:

status byte returned when sending the last address byte of the SPI transaction. .

1.5 Interface: tos.chips.cc2420.CC2420Receive

interface CC2420Receive

Low-level abstraction of the receive path implementation for the ChipCon CC2420 radio.

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.5 $ $Date: 2006/06/20 18:56:04 $

Commands

command void sfd(uint16_t time)

Notification that an SFD capture has occured.

command void sfd_dropped()

Notification that the packet has been dropped by the radio (e.g.

Events

event void receive(uint8_t type, message_t *message)

Signals that a message has been received.

Commands – Details

sfd

command void sfd(uint16_t time)

Notification that an SFD capture has occured.

Parameters:

time – at which the capture happened.

sfd_dropped

command void sfd_dropped()

Notification that the packet has been dropped by the radio (e.g. due to address rejection).

Events – Details

receive

event void receive(uint8_t type, message_t *message)

Signals that a message has been received.

Parameters:

type – of the message received.

message – pointer to message received.

1.6 Interface: tos.chips.cc2420.CC2420Register

interface CC2420Register

Interface representing one of the Read/Write registers on the CC2420 radio. The return values (when appropriate) refer to the status byte returned on the CC2420 SO pin. A full list of RW registers can be found on page 61 of the CC2420 datasheet (rev 1.2). Page 25 of the same document describes the protocol for interacting with these registers over the CC2420 SPI bus.

Author:

Philip Levis

Version:

$Revision: 1.1.2.4 $ $Date: 2006/06/20 18:56:04 $

Commands

command cc2420_status_t read(uint16_t *data)

Read a 16-bit data word from the register.

command cc2420_status_t write(uint16_t data)

Write a 16-bit data word to the register.

Commands – Details

read

command cc2420_status_t read(uint16_t *data)

Read a 16-bit data word from the register.

Parameters:

data – pointer to place the register value.

Returns:

status byte from the read.

write

command cc2420_status_t write(uint16_t data)

Write a 16-bit data word to the register.

Parameters:

data – value to write to register.

Returns:

status byte from the write.

1.7 Interface: tos.chips.cc2420.CC2420Strobe

interface CC2420Strobe

Interface representing one of the CC2420 command strobe registers. Writing to one of these registers enacts a command on the CC2420, such as power-up, transmission, or clear a FIFO.

Author:

Philip Levis

Version:

$Revision: 1.1.2.3 $ $Date: 2006/06/20 18:56:05 $

Commands

command cc2420_status_t strobe()

Send a command strobe to the register.

Commands – Details

strobe

command cc2420_status_t strobe()

Send a command strobe to the register. The return value is the CC2420 status register. Table 5 on page 27 of the CC2420 datasheet (v1.2) describes the contents of this register.

Returns:

Status byte from the CC2420.

1.8 Interface: tos.chips.cc2420.CC2420Transmit

interface CC2420Transmit

Low-level abstraction for the transmit path implementaiton of the ChipCon CC2420 radio.

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.6 $ $Date: 2006/06/20 18:56:05 $

Commands

command error_t cancel()

Cancel sending of the message.

command error_t modify(uint8_t offset, uint8_t *buf, uint8_t len)

Modify the contents of a packet.

command error_t resend()

Send the previous message again with CCA disabled.

command error_t resendCCA()

Send the previous message again with CCA enabled.

command error_t send(message_t *p_msg)

Send a message with CCA disabled.

command error_t sendCCA(message_t *p_msg)

Send a message with CCA enabled.

Events

event void sendDone(message_t *p_msg, error_t error)

Signal that a message has been sent

Commands – Details

cancel

command error_t cancel()

Cancel sending of the message.

Returns:

SUCCESS if the request was accepted, FAIL otherwise.

modify

command error_t modify(uint8_t offset, uint8_t *buf, uint8_t len)

Modify the contents of a packet. This command can only be used when an SFD capture event for the sending packet is signalled.

Parameters:

offset – in the message to start modifying.

buf – to data to write

len – of bytes to write

Returns:

SUCCESS if the request was accepted, FAIL otherwise.

resend

command error_t resend()

Send the previous message again with CCA disabled.

Returns:

SUCCESS if the request was accepted, FAIL otherwise.

resendCCA

command error_t resendCCA()

Send the previous message again with CCA enabled.

Returns:

SUCCESS if the request was accepted, FAIL otherwise.

send

command error_t send(message_t *p_msg)

Send a message with CCA disabled.

Parameters:

p_msg – message to send.

Returns:

SUCCESS if the request was accepted, FAIL otherwise.

sendCCA

command error_t sendCCA(message_t *p_msg)

Send a message with CCA enabled.

Parameters:

p_msg – message to send.

Returns:

SUCCESS if the request was accepted, FAIL otherwise.

Events – Details

sendDone

event void sendDone(message_t *p_msg, error_t error)

Signal that a message has been sent

Parameters:

p_msg – message to send.

error – notifaction of how the operation went.

2. CC2420 Architecture On Micaz

2.1 Component: tos.chips.cc2420.CC2420ActiveMessageC

configuration CC2420ActiveMessageC

The Active Message layer for the CC2420 radio. This configuration just layers the AM dispatch (CC2420ActiveMessageM) on top of the underlying CC2420 radio packet (CC2420CsmaRadioC), which is inherently an AM packet (acknowledgements based on AM destination addr and group). Note that snooping may not work, due to CC2420 early packet rejection if acknowledgements are enabled.

Author:

Philip Levis

Version:

$Revision: 1.1.2.11 $ $Date: 2006/06/20 18:56:04 $

Provides

interface AMPacket

interface AMSend[am_id_t]

interface CC2420Packet

interface Packet

interface PacketAcknowledgements

interface Receive[am_id_t]

interface Receive as Snoop[am_id_t]

interface SplitControl

Wiring

2.2 Component: tos.chips.cc2420.CC2420ReceiveC

configuration CC2420ReceiveC

Implementation of the receive path for the ChipCon CC2420 radio.

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.5 $ $Date: 2006/06/20 18:56:04 $

Provides

interface AsyncStdControl

interface CC2420Receive

interface Init

interface Receive

Wiring

2.3 Component: tos.chips.cc2420.CC2420CsmaC

configuration CC2420CsmaC

Basic implementation of a CSMA MAC for the ChipCon CC2420 radio.

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.11 $ $Date: 2006/06/20 18:56:04 $

Provides

interface Receive

interface Send

interface SplitControl

Uses

interface AMPacket

Wiring

2.4 Component: tos.chips.cc2420.CC2420ControlC

configuration CC2420ControlC

Implementation for configuring a ChipCon CC2420 radio.

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.8 $ $Date: 2006/06/20 18:56:04 $

Provides

interface CC2420Config

interface CC2420Power

interface Init

interface Resource

Uses

interface AMPacket

Wiring

2.5 Component: tos.chips.cc2420.CC2420CsmaC

configuration CC2420CsmaC

Basic implementation of a CSMA MAC for the ChipCon CC2420 radio.

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.11 $ $Date: 2006/06/20 18:56:04 $

Provides

interface Receive

interface Send

interface SplitControl

Uses

interface AMPacket

Wiring

2.6 Component: tos.chips.cc2420.CC2420TransmitC

configuration CC2420TransmitC

Implementation of the transmit path for the ChipCon CC2420 radio.

Author:

Jonathan Hui <jhui@archrock.com>

Version:

$Revision: 1.1.2.8 $ $Date: 2006/06/20 18:56:05 $

Provides

interface AsyncStdControl

interface CC2420Transmit

interface CsmaBackoff

interface Init

interface RadioTimeStamping

Wiring