Loading...
Searching...
No Matches
AT86RF215 based drivers

This module contains a driver for the Atmel AT86RF215 radio. More...

Detailed Description

This module contains a driver for the Atmel AT86RF215 radio.

Modules

 AT86RF215 MR-FSK PHY
 
 AT86RF215 MR-O-QPSK PHY
 
 AT86RF215 MR-OFDM PHY
 
 AT86RF215 driver compile configuration
 

Files

file  at86rf215_internal.h
 Low-Level functions for the AT86RF215 driver.
 
file  at86rf215_netdev.h
 Netdev interface to AT86RF215 driver.
 
file  at86rf215_params.h
 Default configuration for the AT86RF215 driver.
 
file  at86rf215_registers.h
 Register Definitions for the AT86RF215 chip.
 
file  at86rf215.h
 Interface definition for AT86RF215 based drivers.
 

Data Structures

struct  at86rf215_params
 struct holding all params needed for device initialization More...
 
struct  at86rf215
 Device descriptor for AT86RF215 radio devices. More...
 

Macros

#define AT86RF215_MAX_PKT_LENGTH   (2047)
 Maximum possible packet size in byte.
 

Typedefs

typedef struct at86rf215_RF_regs at86rf215_RF_regs_t
 Registers for the Radio Frontend.
 
typedef struct at86rf215_BBC_regs at86rf215_BBC_regs_t
 Registers for the BaseBand Controller.
 
typedef void(* at86rf215_batmon_cb_t) (void *arg)
 Signature for the Battery monitor callback.
 
typedef struct at86rf215_params at86rf215_params_t
 struct holding all params needed for device initialization
 
typedef struct at86rf215 at86rf215_t
 Device descriptor for AT86RF215 radio devices.
 

Enumerations

enum  { AT86RF215_FCHIP_100 , AT86RF215_FCHIP_200 , AT86RF215_FCHIP_1000 , AT86RF215_FCHIP_2000 }
 MR-O-QPSK chip rates (kChip/s) More...
 
enum  { AT86RF215_MODE_LEGACY_OQPSK , AT86RF215_MODE_MR_OQPSK , AT86RF215_MODE_MR_OFDM , AT86RF215_MODE_MR_FSK }
 

Functions

void at86rf215_setup (at86rf215_t *dev_09, at86rf215_t *dev_24, const at86rf215_params_t *params, uint8_t index)
 Setup an AT86RF215 based device state.
 
void at86rf215_reset_and_cfg (at86rf215_t *dev)
 Trigger a hardware reset and configure radio with default values.
 
void at86rf215_reset (at86rf215_t *dev)
 Trigger a hardware reset, configuration is retained.
 
uint16_t at86rf215_get_addr_short (const at86rf215_t *dev, uint8_t filter)
 Get the short address of the given device form multi address filter.
 
void at86rf215_set_addr_short (at86rf215_t *dev, uint8_t filter, uint16_t addr)
 Set the short address of the given device to multi address filter.
 
bool at86rf215_get_framefilter_enabled (at86rf215_t *dev, uint8_t filter)
 Get whether a frame filter is enabled or not.
 
void at86rf215_disable_framefilter (at86rf215_t *dev, uint8_t filter)
 Enables a frame filter.
 
void at86rf215_enable_framefilter (at86rf215_t *dev, uint8_t filter)
 Disables a frame filter.
 
uint64_t at86rf215_get_addr_long (const at86rf215_t *dev)
 Get the configured long address of the given device.
 
void at86rf215_set_addr_long (at86rf215_t *dev, uint64_t addr)
 Set the long address of the given device.
 
uint8_t at86rf215_get_chan (const at86rf215_t *dev)
 Get the configured channel number of the given device.
 
void at86rf215_set_chan (at86rf215_t *dev, uint16_t chan)
 Set the channel number of the given device.
 
uint16_t at86rf215_get_pan (const at86rf215_t *dev, uint8_t filter)
 Get the configured PAN ID of the given device from multi address filter.
 
void at86rf215_set_pan (at86rf215_t *dev, uint8_t filter, uint16_t pan)
 Set the PAN ID of the given address filter.
 
int16_t at86rf215_get_txpower (const at86rf215_t *dev)
 Get the configured transmission power of the given device [in dBm].
 
void at86rf215_set_txpower (const at86rf215_t *dev, int16_t txpower)
 Set the transmission power of the given device [in dBm].
 
int8_t at86rf215_get_cca_threshold (const at86rf215_t *dev)
 Get the CCA threshold value.
 
void at86rf215_set_cca_threshold (at86rf215_t *dev, int8_t value)
 Set the CCA threshold value.
 
int8_t at86rf215_get_ed_level (at86rf215_t *dev)
 Get the latest ED level measurement.
 
void at86rf215_set_option (at86rf215_t *dev, uint16_t option, bool state)
 Enable or disable driver specific options.
 
void at86rf215_set_trim (at86rf215_t *dev, uint8_t trim)
 Set crystal oscillator trim value.
 
void at86rf215_set_clock_output (at86rf215_t *dev, at86rf215_clko_cur_t cur, at86rf215_clko_freq_t freq)
 Configure the Clock Output pin.
 
ssize_t at86rf215_send (at86rf215_t *dev, const void *data, size_t len)
 Convenience function for simply sending data.
 
int at86rf215_tx_prepare (at86rf215_t *dev)
 Prepare for sending of data.
 
size_t at86rf215_tx_load (at86rf215_t *dev, const uint8_t *data, size_t len, size_t offset)
 Load chunks of data into the transmit buffer of the given device.
 
int at86rf215_tx_exec (at86rf215_t *dev)
 Trigger sending of data previously loaded into transmit buffer.
 
void at86rf215_tx_abort (at86rf215_t *dev)
 Abort sending of data previously loaded into transmit buffer.
 
void at86rf215_tx_done (at86rf215_t *dev)
 Signal that the transfer of the frame (and optional ACK reception) has finished.
 
bool at86rf215_cca (at86rf215_t *dev)
 Perform one manual channel clear assessment (CCA)
 
int at86rf215_enable_batmon (at86rf215_t *dev, unsigned voltage)
 Generate an interrupt if supply voltage drops below the configured threshold.
 
void at86rf215_disable_batmon (at86rf215_t *dev)
 Disable the Battery Monitor interrupt.
 

Flags for device internal states (see datasheet)

enum  at86rf215_state_t {
  AT86RF215_STATE_OFF , AT86RF215_STATE_IDLE , AT86RF215_STATE_RX_SEND_ACK , AT86RF215_STATE_TX ,
  AT86RF215_STATE_TX_WAIT_ACK , AT86RF215_STATE_SLEEP
}
 

Clock Output Driver Strength

enum  at86rf215_clko_cur_t { AT86RF215_CLKO_2mA = 0 << 3 , AT86RF215_CLKO_4mA = 1 << 3 , AT86RF215_CLKO_6mA = 2 << 3 , AT86RF215_CLKO_8mA = 3 << 3 }
 

Clock Output Frequency

enum  at86rf215_clko_freq_t {
  AT86RF215_CLKO_OFF = 0 , AT86RF215_CLKO_26_MHz , AT86RF215_CLKO_32_MHz , AT86RF215_CLKO_16_MHz ,
  AT86RF215_CLKO_8_MHz , AT86RF215_CLKO_4_MHz , AT86RF215_CLKO_2_MHz , AT86RF215_CLKO_1_MHz
}
 

Internal device option flags

#define AT86RF215_OPT_CSMA   (0x0010)
 CSMA active.
 
#define AT86RF215_OPT_PROMISCUOUS   (0x0020)
 promiscuous mode active
 
#define AT86RF215_OPT_PRELOADING   (0x0040)
 preloading enabled
 
#define AT86RF215_OPT_AUTOACK   (0x0080)
 Auto ACK active.
 
#define AT86RF215_OPT_ACK_REQUESTED   (0x0100)
 ACK requested for current frame.
 
#define AT86RF215_OPT_AGCH   (0x0200)
 AGC Hold active.
 
#define AT86RF215_OPT_TX_PENDING   (0x0400)
 Frame is loaded into TX buffer.
 
#define AT86RF215_OPT_CCA_PENDING   (0x0800)
 CCA needs to be done for the current frame.
 
#define AT86RF215_OPT_RPC   (0x1000)
 Enable Reduced Power Consumption.
 
#define AT86RF215_OPT_CCATX   (0x2000)
 TX after CCA performd automatically.
 

Internal timeout flags

#define AT86RF215_TIMEOUT_ACK   (0x0001)
 ACK timeout.
 
#define AT86RF215_TIMEOUT_CSMA   (0x0002)
 CMSA timeout.
 

Macro Definition Documentation

◆ AT86RF215_MAX_PKT_LENGTH

#define AT86RF215_MAX_PKT_LENGTH   (2047)

Maximum possible packet size in byte.

Definition at line 72 of file at86rf215.h.

◆ AT86RF215_OPT_ACK_REQUESTED

#define AT86RF215_OPT_ACK_REQUESTED   (0x0100)

ACK requested for current frame.

Definition at line 311 of file at86rf215.h.

◆ AT86RF215_OPT_AGCH

#define AT86RF215_OPT_AGCH   (0x0200)

AGC Hold active.

Definition at line 312 of file at86rf215.h.

◆ AT86RF215_OPT_AUTOACK

#define AT86RF215_OPT_AUTOACK   (0x0080)

Auto ACK active.

Definition at line 310 of file at86rf215.h.

◆ AT86RF215_OPT_CCA_PENDING

#define AT86RF215_OPT_CCA_PENDING   (0x0800)

CCA needs to be done for the current frame.

Definition at line 314 of file at86rf215.h.

◆ AT86RF215_OPT_CCATX

#define AT86RF215_OPT_CCATX   (0x2000)

TX after CCA performd automatically.

Definition at line 316 of file at86rf215.h.

◆ AT86RF215_OPT_CSMA

#define AT86RF215_OPT_CSMA   (0x0010)

CSMA active.

Definition at line 307 of file at86rf215.h.

◆ AT86RF215_OPT_PRELOADING

#define AT86RF215_OPT_PRELOADING   (0x0040)

preloading enabled

Definition at line 309 of file at86rf215.h.

◆ AT86RF215_OPT_PROMISCUOUS

#define AT86RF215_OPT_PROMISCUOUS   (0x0020)

promiscuous mode active

Definition at line 308 of file at86rf215.h.

◆ AT86RF215_OPT_RPC

#define AT86RF215_OPT_RPC   (0x1000)

Enable Reduced Power Consumption.

Definition at line 315 of file at86rf215.h.

◆ AT86RF215_OPT_TX_PENDING

#define AT86RF215_OPT_TX_PENDING   (0x0400)

Frame is loaded into TX buffer.

Definition at line 313 of file at86rf215.h.

◆ AT86RF215_TIMEOUT_ACK

#define AT86RF215_TIMEOUT_ACK   (0x0001)

ACK timeout.

Definition at line 323 of file at86rf215.h.

◆ AT86RF215_TIMEOUT_CSMA

#define AT86RF215_TIMEOUT_CSMA   (0x0002)

CMSA timeout.

Definition at line 324 of file at86rf215.h.

Typedef Documentation

◆ at86rf215_batmon_cb_t

typedef void(* at86rf215_batmon_cb_t) (void *arg)

Signature for the Battery monitor callback.

Parameters
[in]argoptional argument which is passed to the callback

Definition at line 57 of file at86rf215.h.

◆ at86rf215_BBC_regs_t

Registers for the BaseBand Controller.

Definition at line 49 of file at86rf215.h.

◆ at86rf215_RF_regs_t

Registers for the Radio Frontend.

Definition at line 44 of file at86rf215.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

MR-O-QPSK chip rates (kChip/s)

Definition at line 62 of file at86rf215.h.

◆ anonymous enum

anonymous enum

Definition at line 268 of file at86rf215.h.

◆ at86rf215_clko_cur_t

Enumerator
AT86RF215_CLKO_2mA 

2 mA

AT86RF215_CLKO_4mA 

4 mA

AT86RF215_CLKO_6mA 

6 mA

AT86RF215_CLKO_8mA 

8 mA

Definition at line 279 of file at86rf215.h.

◆ at86rf215_clko_freq_t

Enumerator
AT86RF215_CLKO_OFF 

Clock Output Disabled

AT86RF215_CLKO_26_MHz 

26 MHz

AT86RF215_CLKO_32_MHz 

32 MHz

AT86RF215_CLKO_16_MHz 

16 MHz

AT86RF215_CLKO_8_MHz 

8 MHz

AT86RF215_CLKO_4_MHz 

4 MHz

AT86RF215_CLKO_2_MHz 

2 MHz

AT86RF215_CLKO_1_MHz 

1 MHz

Definition at line 291 of file at86rf215.h.

◆ at86rf215_state_t

Enumerator
AT86RF215_STATE_OFF 

radio not configured

AT86RF215_STATE_IDLE 

idle state, listening

AT86RF215_STATE_RX_SEND_ACK 

receiving frame, sending ACK

AT86RF215_STATE_TX 

sending frame

AT86RF215_STATE_TX_WAIT_ACK 

sending frame, wait for ACK

AT86RF215_STATE_SLEEP 

sleep mode, not listening

Definition at line 258 of file at86rf215.h.

Function Documentation

◆ at86rf215_cca()

bool at86rf215_cca ( at86rf215_t dev)

Perform one manual channel clear assessment (CCA)

The CCA mode and threshold level depends on the current transceiver settings.

Parameters
[in]devdevice to use
Returns
true if channel is determined clear
false if channel is determined busy

◆ at86rf215_disable_batmon()

void at86rf215_disable_batmon ( at86rf215_t dev)

Disable the Battery Monitor interrupt.

Parameters
[in]devdevice to configure

◆ at86rf215_disable_framefilter()

void at86rf215_disable_framefilter ( at86rf215_t dev,
uint8_t  filter 
)

Enables a frame filter.

Parameters
[in]devdevice to read from
[in]filter(1-byte) filter to get

◆ at86rf215_enable_batmon()

int at86rf215_enable_batmon ( at86rf215_t dev,
unsigned  voltage 
)

Generate an interrupt if supply voltage drops below the configured threshold.

Parameters
[in]devdevice to configure
[in]voltageThreshold voltage in mV
Returns
0 on success, error otherwise

◆ at86rf215_enable_framefilter()

void at86rf215_enable_framefilter ( at86rf215_t dev,
uint8_t  filter 
)

Disables a frame filter.

Parameters
[in]devdevice to read from
[in]filter(1-byte) filter to get

◆ at86rf215_get_addr_long()

uint64_t at86rf215_get_addr_long ( const at86rf215_t dev)

Get the configured long address of the given device.

Parameters
[in]devdevice to read from
Returns
the currently set (8-byte) long address

◆ at86rf215_get_addr_short()

uint16_t at86rf215_get_addr_short ( const at86rf215_t dev,
uint8_t  filter 
)

Get the short address of the given device form multi address filter.

Parameters
[in]devdevice to read from
[in]filteraddress filter to read
Returns
the currently set (2-byte) short address

◆ at86rf215_get_cca_threshold()

int8_t at86rf215_get_cca_threshold ( const at86rf215_t dev)

Get the CCA threshold value.

Parameters
[in]devdevice to read value from
Returns
the current CCA threshold value

◆ at86rf215_get_chan()

uint8_t at86rf215_get_chan ( const at86rf215_t dev)

Get the configured channel number of the given device.

Parameters
[in]devdevice to read from
Returns
the currently set channel number

◆ at86rf215_get_ed_level()

int8_t at86rf215_get_ed_level ( at86rf215_t dev)

Get the latest ED level measurement.

Parameters
[in]devdevice to read value from
Returns
the last ED level

◆ at86rf215_get_framefilter_enabled()

bool at86rf215_get_framefilter_enabled ( at86rf215_t dev,
uint8_t  filter 
)

Get whether a frame filter is enabled or not.

Parameters
[in]devdevice to read from
[in]filter(1-byte) filter to get
Returns
(bool) the current state of the filter

◆ at86rf215_get_pan()

uint16_t at86rf215_get_pan ( const at86rf215_t dev,
uint8_t  filter 
)

Get the configured PAN ID of the given device from multi address filter.

Parameters
[in]devdevice to read from
[in]filteraddress filter to read from
Returns
the currently set PAN ID

◆ at86rf215_get_txpower()

int16_t at86rf215_get_txpower ( const at86rf215_t dev)

Get the configured transmission power of the given device [in dBm].

Parameters
[in]devdevice to read from
Returns
configured transmission power in dBm

◆ at86rf215_reset()

void at86rf215_reset ( at86rf215_t dev)

Trigger a hardware reset, configuration is retained.

Parameters
[in,out]devdevice to reset

◆ at86rf215_reset_and_cfg()

void at86rf215_reset_and_cfg ( at86rf215_t dev)

Trigger a hardware reset and configure radio with default values.

Parameters
[in,out]devdevice to configure

◆ at86rf215_send()

ssize_t at86rf215_send ( at86rf215_t dev,
const void *  data,
size_t  len 
)

Convenience function for simply sending data.

Note
This function ignores the PRELOADING option
Parameters
[in,out]devdevice to use for sending
[in]datadata to send (must include IEEE802.15.4 header)
[in]lenlength of data
Returns
number of bytes that were actually send
or negative error code

◆ at86rf215_set_addr_long()

void at86rf215_set_addr_long ( at86rf215_t dev,
uint64_t  addr 
)

Set the long address of the given device.

Parameters
[in,out]devdevice to write to
[in]addr(8-byte) long address to set

◆ at86rf215_set_addr_short()

void at86rf215_set_addr_short ( at86rf215_t dev,
uint8_t  filter,
uint16_t  addr 
)

Set the short address of the given device to multi address filter.

Parameters
[in,out]devdevice to write to
[in]filter(1-byte) address filter to set
[in]addr(2-byte) short address to set

◆ at86rf215_set_cca_threshold()

void at86rf215_set_cca_threshold ( at86rf215_t dev,
int8_t  value 
)

Set the CCA threshold value.

Parameters
[in]devdevice to write to
[in]valuethe new CCA threshold value

◆ at86rf215_set_chan()

void at86rf215_set_chan ( at86rf215_t dev,
uint16_t  chan 
)

Set the channel number of the given device.

Parameters
[in,out]devdevice to write to
[in]chanchannel number to set

◆ at86rf215_set_clock_output()

void at86rf215_set_clock_output ( at86rf215_t dev,
at86rf215_clko_cur_t  cur,
at86rf215_clko_freq_t  freq 
)

Configure the Clock Output pin.

Parameters
[in]devdevice to configure
[in]curClock output current
[in]freqClock output frequency

◆ at86rf215_set_option()

void at86rf215_set_option ( at86rf215_t dev,
uint16_t  option,
bool  state 
)

Enable or disable driver specific options.

Parameters
[in,out]devdevice to set/clear option flag for
[in]optionoption to enable/disable
[in]statetrue for enable, false for disable

◆ at86rf215_set_pan()

void at86rf215_set_pan ( at86rf215_t dev,
uint8_t  filter,
uint16_t  pan 
)

Set the PAN ID of the given address filter.

Parameters
[in,out]devdevice to write to
[in]filteraddress filter to set
[in]panPAN ID to set

◆ at86rf215_set_trim()

void at86rf215_set_trim ( at86rf215_t dev,
uint8_t  trim 
)

Set crystal oscillator trim value.

     An internal capacitance array is connected to the
     crystal oscillator pins TCXO and XTAL2.

     Each increment of the trim value adds 0.3pF capacitance
     to the oscillator circuit.

     To trim a board, enable the clock output with
     @ref at86rf215_set_clock_output and connect a frequency
     counter to the clock output pin.
     Then adjust the trim value until it the measured frequency
     closely matches the configured output frequency.

     It is recommended to use a 26 MHz output frequency for the
     test as this is the raw frequency of the external oscillator.

     The resulting trim value must then be stored in a persistent
     memory area of the board to be set via @ref CONFIG_AT86RF215_TRIM_VAL
Parameters
[in]devdevice to configure
[in]trimtrim value

◆ at86rf215_set_txpower()

void at86rf215_set_txpower ( const at86rf215_t dev,
int16_t  txpower 
)

Set the transmission power of the given device [in dBm].

If the device does not support the exact dBm value given, it will set a value as close as possible to the given value. If the given value is larger or lower then the maximal or minimal possible value, the min or max value is set, respectively.

Parameters
[in]devdevice to write to
[in]txpowertransmission power in dBm

◆ at86rf215_setup()

void at86rf215_setup ( at86rf215_t dev_09,
at86rf215_t dev_24,
const at86rf215_params_t params,
uint8_t  index 
)

Setup an AT86RF215 based device state.

Parameters
[out]dev_09sub-GHz device descriptor
[out]dev_242.4 GHz device descriptor
[in]paramsparameters for device initialization
[in]indexindex of params in a global parameter struct array. If initialized manually, pass a unique identifier instead.

◆ at86rf215_tx_abort()

void at86rf215_tx_abort ( at86rf215_t dev)

Abort sending of data previously loaded into transmit buffer.

Parameters
[in]devdevice to abort TX on

◆ at86rf215_tx_done()

void at86rf215_tx_done ( at86rf215_t dev)

Signal that the transfer of the frame (and optional ACK reception) has finished.

Sets the radio in RX mode.

Parameters
[in]devdevice to use

◆ at86rf215_tx_exec()

int at86rf215_tx_exec ( at86rf215_t dev)

Trigger sending of data previously loaded into transmit buffer.

Parameters
[in]devdevice to trigger
Returns
0 on success, error otherwise

◆ at86rf215_tx_load()

size_t at86rf215_tx_load ( at86rf215_t dev,
const uint8_t *  data,
size_t  len,
size_t  offset 
)

Load chunks of data into the transmit buffer of the given device.

Parameters
[in,out]devdevice to write data to
[in]databuffer containing the data to load
[in]lennumber of bytes in buffer
[in]offsetoffset used when writing data to internal buffer
Returns
offset + number of bytes written

◆ at86rf215_tx_prepare()

int at86rf215_tx_prepare ( at86rf215_t dev)

Prepare for sending of data.

This function puts the given device into the TX state, so no receiving of data is possible after it was called.

Parameters
[in,out]devdevice to prepare for sending
Returns
0 on success, error otherwise