Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

BRA - Bladox Radio Architecture


Detailed Description

BRA API is available only on devices with radio interface - Turbo BRA. It is possible to upload application to any Turbo device but it will use null wrapper.

BRA is a radio protocol based on 802.15.4 standard. It follows the same goals as ZigBee(tm) but it is simpler and truly open. It can utilize both non-sleeping (always ready) and sleeping (idle) devices/nodes.

BRA is:

bra_mac.png

MAC Layer Frame Format

bra_packet.png

BRA Layer Frame Format

Defines

Functions


Define Documentation

#define DEF_BRA_MAC_LEN
 

BRA MAC address length. 4 bytes address format A.B.C.D is used. Every device has unique address burned in - can be modified by application. 255.255.255.255 denotes everybody.

#define DEF_BRA_MAX_FREQ
 

Max radio frequency - 2483 MHz. See CC2420 Radio Datasheet.

#define DEF_BRA_MIN_FREQ
 

Min radio frequency - 2400 MHz. See CC2420 Radio Datasheet.

#define DEF_BRA_VERSION
 

BRA packet version.

#define T_BRA_DATA
 

Application data in BRA packet.

#define T_BRA_DEST
 

Destination address tag in BRA packet.

#define T_BRA_SRC
 

Source address tag in BRA packet.

#define T_BRA_TAG
 

Application tag in BRA packet.

#define T_BRA_VERSION
 

Version tag in BRA packet.


Function Documentation

u16 bra_cc2420_read (  u16  addr  ) 
 

Low level read access to CC2420 radio chip registers, RAM and strobe commands. See CC2420 Radio Datasheet.

Parameters:
addr if MSB is '1' (i.e. |0x8000) then RAM is used, if 0 then register. Registers 0x00..0x0e are strobe commands.
Returns:
value of register/memory
Examples:
braping.c.

u16 bra_cc2420_write (  u16  addr,
u16  val
) 
 

Low level write access to CC2420 radio chip RAM and registers. Write to registers 0x00..0x0e is equivalent to read operation, i.e. strobe command. See CC2420 Radio Datasheet.

Parameters:
addr if MSB is '1' (i.e. |0x8000) RAM is used, registers otherwise
val value, for RAM only low byte is used
Returns:
result of the operation
Examples:
braping.c.

u16 bra_freq (   ) 
 

Returns current radio frequency.

Returns:
freq between DEF_BRA_MIN_FREQ and DEF_BRA_MAX_FREQ

u16 bra_lqi (   ) 
 

LQI - Link Quality Indicatior of the last packed received.

Low byte is RSSI, hi byte is correlation as defined in CC2420 Radio Datasheet.

Returns:
value consists of RSSI|(CORR&0x7f)
Examples:
braping.c.

void bra_mac_get (  u8  addr[DEF_BRA_MAC_LEN]  ) 
 

Get device MAC address (possibly modified by bra_mac_set()).

Examples:
braping.c.

void bra_mac_reset (   ) 
 

Reset device MAC address previously modified with bra_mac_set() to factory default.

void bra_mac_set (  u8  addr[DEF_BRA_MAC_LEN]  ) 
 

Modify device MAC address.

u8* bra_make_head (  u8 *  buf,
u8 *  dest_addr,
u8 *  tag,
u8  release
) 
 

Function to construct BRA packet.

Parameters:
buf pointer on buffer used for packet construction
dest_addr NULL for everybody or specific destination address
tag application tag - used to select destination application
release indication if target device can go sleep. 1 means yes, target can go idle/sleep, 0 - further communication to follow
Returns:
pointer on buf after just constructed header.
Examples:
braled.c, and braping.c.

u8* bra_seek_head (  u8 *  buf,
u8  tag
) 
 

Seek tag in BRA packet header.

Parameters:
buf pointer on buffer containing BRA packet
tag what to seek: T_BRA_VERSION, T_BRA_DEST, T_BRA_SRC, T_BRA_TAG, T_BRA_DATA
Returns:
pointer on sought data in BRA packet
Examples:
braping.c.

u8 bra_set_802_15_4_channel (  u8  channel  ) 
 

Set radio frequency channel, can be between 11 and 26. Default is 26.

Parameters:
channel 11-26 as defined by ieee802.15.4
Returns:
NO_ERROR, ERR_BRA_WRONG_CHANNEL
Examples:
braping.c.

u8 bra_set_freq (  u16  freq  ) 
 

Set radio frequency, can be between DEF_BRA_MIN_FREQ and DEF_BRA_MAX_FREQ. Default is 2480MHz (channel 26).

Parameters:
freq frequency in MHz
Returns:
NO_ERROR, ERR_BRA_WRONG_FREQ
Examples:
braping.c.

void bra_set_tx_power (  u8  pa  ) 
 

Set radio Tx (transmit) power. See CC2420 Radio Datasheet.

Parameters:
pa output power: 0-31
Examples:
braping.c.

u8 bra_tx_power (   ) 
 

Returns current Tx power.

Returns:
pa 0..31, see CC2420 Radio Datasheet

b8 bra_txrx (  u8 *  buf,
u8  len,
u8 *  bra_app_tag,
u8  nr_tx,
u8  nr_rx,
u8  after_tx_ms
) 
 

BRA Tx and Rx function - this is the main call for radio communication. Tx/Rx loop to communicate that can be used to communicate with both idle (sleeping) and ready (non-sleeping) devices.

The loop looks following:

while(nr_tx--)
{
tx();
tmp_nr_rx=nr_rx;
while(tmp_nr_rx--)
 {
 delay_ms(after_tx_ms);
 rx();
 if something received:
        check destination addr me or everybody
        check application tag
 }
}

Parameters:
buf pointer on buffer with BRA packet
len length of packet to send
bra_app_tag required BRA application tag to be received, can be NULL
nr_tx number of Tx
nr_rx number of Rx attempts after Tx
after_tx_ms delay between Tx/Rx (and following Rx's), in milisec
Returns:
0 - nothing received, >0 length of received packet, <0 error
Examples:
braled.c, and braping.c.


Copyright © 2004-2006 BLADOX
Turbo version 1.2