cc2538_rf.h

Low-level radio driver for the CC2538.

CC2538_AUTOCRC_LEN
1
(2)
CC2538_RF_FIFO_SIZE
1
(128)
CC2538_PACKET_LENGTH_SIZE
1
(1)
CC2538_RF_MAX_DATA_LEN
1
(CC2538_RF_FIFO_SIZE - CC2538_PACKET_LENGTH_SIZE)
CC2538_EUI64_LOCATION_PRI

Primary EUI-64 address location.

1
(0x00280028)
CC2538_EUI64_LOCATION_SEC

Secondary EUI-64 address location.

1
(0x0027FFCC)
IEEE802154_MIN_FREQ

Min.

1
(2405)

frequency (2405 MHz)

IEEE802154_MAX_FREQ

Max.

1
(2480)

frequency (2480 MHz)

IEEE802154_CHANNEL_SPACING

Channel spacing in MHz.

1
(5)
IEEE802154_CHAN2FREQ( chan)
1
( IEEE802154_MIN_FREQ + ((chan) - IEEE802154_CHANNEL_MIN) * IEEE802154_CHANNEL_SPACING )
IEEE802154_FREQ2CHAN( freq)
1
( IEEE802154_CHANNEL_MIN + ((freq) - IEEE802154_MIN_FREQ) / IEEE802154_CHANNEL_SPACING )
CC2538_MIN_FREQ
1
(2394)
CC2538_MAX_FREQ
1
(2507)
CC2538_RF_POWER_DEFAULT

Default output power in dBm.

1
(IEEE802154_DEFAULT_TXPOWER)
CC2538_RF_CHANNEL_DEFAULT
1
(IEEE802154_DEFAULT_CHANNEL)
OUTPUT_POWER_MIN

Min output power in dBm.

1
(-24)
OUTPUT_POWER_MAX

Max output power in dBm.

1
(7)
NUM_POWER_LEVELS
1
( OUTPUT_POWER_MAX - OUTPUT_POWER_MIN + 1 )
CC2538_CORR_VAL_MIN
1
(50U)
CC2538_CORR_VAL_MAX
1
(110U)
CC2538_CORR_VAL_MASK
1
(0x7F)
CC2538_RSSI_OFFSET

Signal strength offset value.

1
(-73)
CC2538_RF_SENSITIVITY

dBm typical, normal conditions

1
(-97)
RFCORE_ASSERT( expr)
1
(void)( (expr) || RFCORE_ASSERT_failure(#expr, __FUNCTION__, __LINE__) )
RFCORE_WAIT_UNTIL( expr)
1
2
3
4
while (!(expr)) {                                        \
    DEBUG("RFCORE_WAIT_UNTIL(%s) at line %u in %s()\n", #expr, __LINE__, __FUNCTION__);  \
    thread_yield();                                                                      \
}
RFCORE_FLUSH_RECEIVE_FIFO()
1
rfcore_strobe(ISFLUSHRX)
ABS_DIFF( x, y)
1
( ((x) < (y))? ((y) - (x)) : ((x) - (y)) )
BOOLEAN( x)
1
( (x) != 0 )
NOT( x)
1
( (x) == 0 )
GET_BYTE( buffer, index)
1
( (unsigned char*)(buffer) )[index]
BIT( n)
1
( 1 << (n) )
OBSSEL_EN
1
BIT(7)
enum @13
FSM_STATE_IDLE =  0
FSM_STATE_RX_CALIBRATION =  2
FSM_STATE_TX_CALIBRATION = 32
enum @14
STROBE_ERR = BIT(6)
TXUNDERF = BIT(5)
TXOVERF = BIT(4)
RXUNDERF = BIT(3)
RXOVERF = BIT(2)
RXABO = BIT(1)
NLOCK = BIT(0)
enum @15
ENERGY_SCAN = BIT(4)
AUTOACK = BIT(5)
AUTOCRC = BIT(6)
APPEND_DATA_MODE = BIT(7)
enum @16
ACT_UNUSED = BIT(0)
SFD = BIT(1)
Start of frame event.
FIFOP = BIT(2)
SRC_MATCH_DONE = BIT(3)
SRC_MATCH_FOUND = BIT(4)
FRAME_ACCEPTED = BIT(5)
RXPKTDONE = BIT(6)
End of frame event.
RXMASKZERO = BIT(7)
enum @17
rfc_obs_sig0 = 0
rfc_obs_sig1 = 1
rfc_obs_sig2 = 2
enum @18
constant_value_0 = 0x00
constant_value_1 = 0x01
rfc_sniff_data = 0x08
rfc_sniff_clk = 0x09
rssi_valid = 0x0c
demod_cca = 0x0d
sampled_cca = 0x0e
sfd_sync = 0x0f
tx_active = 0x10
rx_active = 0x11
ffctrl_fifo = 0x12
ffctrl_fifop = 0x13
packet_done = 0x14
rfc_xor_rand_i_q = 0x16
rfc_rand_q = 0x17
rfc_rand_i = 0x18
lock_status = 0x19
pa_pd = 0x20
lna_pd = 0x2a
void _irq_handler(void)

IRQ handler for RF events.

bool cc2538_channel_clear(void)

Trigger a clear channel assessment.

Return values

  • True if channel is clear
  • False if channel is busy
uint64_t cc2538_get_addr_long(void)

Get the configured long address of the device.

Return values

  • The currently set (8-byte) long address
uint16_t cc2538_get_addr_short(void)

Get the configured short address of the device.

Return values

  • The currently set (2-byte) short address
uint64_t cc2538_get_eui64_primary(void)

Get the primary (burned-in) EUI-64 of the device.

Return values

  • The primary EUI-64 of the device
unsigned int cc2538_get_chan(void)

Get the configured channel number of the device.

Return values

  • The currently set channel number
bool cc2538_get_monitor(void)

Check if device is in monitor (promiscuous) mode.

Return values

  • True if device is in monitor mode
  • False if device is not in monitor mode
uint16_t cc2538_get_pan(void)

Get the configured PAN ID of the device.

Return values

  • The currently set PAN ID
int cc2538_get_tx_power(void)

Get the configured transmission power of the device.

Return values

  • The currently configured transmission power in dBm
void cc2538_init(void)

Initialise the CC2538 radio hardware.

bool cc2538_is_on(void)

Check if device is active.

Return values

  • True if device is active
  • False if device is not active
void cc2538_off(void)

Deactivate the CC2538 radio device.

bool cc2538_on(void)

Activate the CC2538 radio device.

void cc2538_setup(cc2538_rf_t * dev)

Setup a CC2538 radio device for use with netdev.

Parameters

dev:Device descriptor

void cc2538_set_addr_short(uint16_t addr)

Set the short address of the device.

Parameters

addr:(2-byte) short address to set

void cc2538_set_addr_long(uint64_t addr)

Set the long address of the device.

Parameters

addr:(8-byte) short address to set

void cc2538_set_chan(unsigned int chan)

Set the channel number of the device.

Parameters

chan:Channel number to set

void cc2538_set_freq(unsigned int MHz)

Set the frequency of the device.

Parameters

MHz:Frequency to set in MHz

void cc2538_set_monitor(bool mode)

Enable/disable monitor (promiscuous) mode for the device.

Parameters

mode:True for enable, false for disable

void cc2538_set_pan(uint16_t pan)

Set the PAN ID of the device.

Parameters

pan:PAN ID to set

void cc2538_set_state(cc2538_rf_t * dev, netopt.h::netopt_state_t state)

Set the state of the device.

Parameters

dev:Device descriptor
state:State to set device to

void cc2538_set_tx_power(int dBm)

Set the transmission power for the device.

Parameters

dBm:Transmission power to set in dBm

struct cc2538_rf_t

Device descriptor for CC2538 transceiver.

netdev_ieee802154_t netdev

netdev parent struct

uint8_t state

current state of the radio