cc2420.c File Reference

Functions to monitore radio chip : interface, calibrate. More...

#include <environment.h>
#include <cc2420.h>
#include <hal_spi.h>
#include <hal_wait.h>
#include <timedef.h>
#include <TimeManage.h>
#include <display_info.h>
#include <SERIAL.H>

Include dependency graph for cc2420.c:

Go to the source code of this file.

Functions

void cc2420_active_batmon (void)
 active battery monitor 2420
void cc2420_change_channel (UINT8 channel)
 change transmit channel. In case selectionned channel not in chip specification, function force to use channel 11.
void cc2420_change_emission_power (int level)
void cc2420_Init (void)
 First and global initialization.
void cc2420_powerdown (void)
 Turn off oscillator to put device in low power mode.
INT8 halRfGetRSSI (void)
 Description: Get level of input radio signal (RSSI).
void halRfWaitForCrystalOscillator (void)
 Waits for the crystal oscillator to become stable. The flag ispolled via the SPI status byte.
int RecepFrame (void *buffer, UINT8 *nbytes, unsigned long wait, int *strength)
int sendFrame (const void *buffer, UINT8 nbytes)
 To send a frame to the radio chip.
void setup_cc2420 (void)
 Reset radio chip and configure registers for initialization.
void wakeup_cc2420 (void)
 Wake up the device : restart Oscillator.


Detailed Description

Functions to monitore radio chip : interface, calibrate.

Author:
Le Goffic Laurent

Savigny Christophe

ANGER Thomas

Date:
2005 / 07 / 11 : Adaptation for A23 cards : spi software

2006 / 03 / 28 : Adjustement for wireless sensor networks

2007 / 06 / 28 : modified for cc2420 radio chip

2008 / 11 / 17 : code review

2009 / 01 / 09 : adaptation of recept function to work with variable frame size

Definition in file cc2420.c.


Function Documentation

void cc2420_active_batmon ( void   ) 

active battery monitor 2420

Note:
not functional, don't use.

Definition at line 168 of file cc2420.c.

References BM, CC2420_BATTMON, CC2420_BATTMON_BATTMON_EN, CC2420_BATTMON_BATTMON_OK, FASTSPI_GETREG, and FASTSPI_SETREG.

void cc2420_change_channel ( UINT8  channel  ) 

change transmit channel. In case selectionned channel not in chip specification, function force to use channel 11.

void cc2420_change_channel(UINT8 channel)

Definition at line 146 of file cc2420.c.

References CC2420_FSCTRL, and FASTSPI_SETREG.

Referenced by check_online_code_version(), init(), main(), PT_THREAD(), and serveur_reprog().

Here is the caller graph for this function:

void cc2420_change_emission_power ( int  level  ) 

Definition at line 133 of file cc2420.c.

References CC2420_TXCTRL, and FASTSPI_SETREG.

Referenced by controller_write(), and main().

Here is the caller graph for this function:

void cc2420_Init ( void   ) 

First and global initialization.

Definition at line 185 of file cc2420.c.

References cc2420_powerdown(), halRfWaitForCrystalOscillator(), SET_VREG_ACTIVE, and setup_cc2420().

Referenced by init().

Here is the call graph for this function:

Here is the caller graph for this function:

void cc2420_powerdown ( void   ) 

Turn off oscillator to put device in low power mode.

Definition at line 123 of file cc2420.c.

References CC2420_SXOSCOFF, and FASTSPI_STROBE.

Referenced by cc2420_Init(), controller_read(), controller_read_alarm_frame(), controller_write(), main(), PT_THREAD(), and serveur_reprog().

Here is the caller graph for this function:

void halRfGetRSSI ( void   ) 

Description: Get level of input radio signal (RSSI).

Definition at line 90 of file cc2420.c.

References CC2420_RSSI, FASTSPI_GETREG, and RSSI_2_ED.

Referenced by RecepFrame().

Here is the caller graph for this function:

void halRfWaitForCrystalOscillator ( void   ) 

Waits for the crystal oscillator to become stable. The flag ispolled via the SPI status byte.

Note:
Note that this function will lock up if the SXOSCON commandstrobe has not been given before the function call. Also note that global interrupts will always beenabled when this function returns.

Definition at line 71 of file cc2420.c.

References BM, CC2420_XOSC16M_STABLE, and FASTSPI_UPD_STATUS.

Referenced by cc2420_Init(), and wakeup_cc2420().

Here is the caller graph for this function:

int RecepFrame ( void *  buffer,
UINT8 nbytes,
unsigned long  wait,
int *  strength 
)

Definition at line 294 of file cc2420.c.

References BASIC_RF_LENGTH_MASK, CC2420_SFLUSHRX, CC2420_SRFOFF, CC2420_SRXON, clockb(), FASTSPI_READ_FIFO_BYTE, FASTSPI_READ_FIFO_NO_WAIT, FASTSPI_STROBE, FIFO, FIFOP, halRfGetRSSI(), LED_TEST1_OFF, LED_TEST1_ON, and NB_TICK_MAX.

Referenced by controller_read(), controller_read_alarm_frame(), MAC_recept(), and main().

Here is the call graph for this function:

Here is the caller graph for this function:

int sendFrame ( const void *  buffer,
UINT8  nbytes 
)

To send a frame to the radio chip.

Parameters:
[in] buffer : points to the string to send
[in] nbytes : number of bytes in the string
Returns:
0 : transmit successful, 1 : transmit unsuccessful (TX underflow). 2 : transmit unsuccessful (channel busy).

Definition at line 205 of file cc2420.c.

References BM, CC2420_RSSI_VALID, CC2420_SFLUSHRX, CC2420_SFLUSHTX, CC2420_SRFOFF, CC2420_SRXON, CC2420_STXONCCA, CC2420_TX_ACTIVE, CC2420_TX_UNDERFLOW, FASTSPI_STROBE, FASTSPI_UPD_STATUS, FASTSPI_WRITE_FIFO, LED_TEST2_OFF, and LED_TEST2_ON.

Referenced by controller_read(), controller_write(), MAC_send(), and main().

Here is the caller graph for this function:

void setup_cc2420 ( void   ) 

Reset radio chip and configure registers for initialization.

Definition at line 41 of file cc2420.c.

References CC2420_FSCTRL, CC2420_IOCFG0, CC2420_MDMCTRL0, CC2420_MDMCTRL1, CC2420_SECCTRL0, CC2420_SECCTRL0_NO_SECURITY, CC2420_SXOSCON, FASTSPI_SETREG, FASTSPI_STROBE, halWait(), SET_RESET_ACTIVE, SET_RESET_INACTIVE, and TIME_CONSTANT.

Referenced by cc2420_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

void wakeup_cc2420 ( void   ) 

Wake up the device : restart Oscillator.

Definition at line 111 of file cc2420.c.

References CC2420_SXOSCON, FASTSPI_STROBE, and halRfWaitForCrystalOscillator().

Referenced by check_online_code_version(), controller_read(), controller_read_alarm_frame(), controller_write(), init(), main(), PT_THREAD(), and serveur_reprog().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Wed Jun 3 12:05:39 2009 for PowWow v1.0 by  doxygen 1.5.6