AT86RF2xx based drivers¶
This module contains drivers for radio devices in Atmel’s AT86RF2xx series.
The driver is aimed to work with all devices of this series.
-
AT86RF2XX_MIN_CHANNEL
¶ 1
(IEEE802154_CHANNEL_MIN)
-
AT86RF2XX_MAX_CHANNEL
¶ 1
(IEEE802154_CHANNEL_MAX)
-
AT86RF2XX_DEFAULT_CHANNEL
¶ 1
(IEEE802154_DEFAULT_CHANNEL)
-
AT86RF2XX_STATE_P_ON
¶ initial power on
1
(0x00)
-
AT86RF2XX_STATE_BUSY_RX
¶ busy receiving data (basic mode)
1
(0x01)
-
AT86RF2XX_STATE_BUSY_TX
¶ busy transmitting data (basic mode)
1
(0x02)
-
AT86RF2XX_STATE_FORCE_TRX_OFF
¶ force transition to idle
1
(0x03)
-
AT86RF2XX_STATE_RX_ON
¶ listen mode (basic mode)
1
(0x06)
-
AT86RF2XX_STATE_TRX_OFF
¶ idle
1
(0x08)
-
AT86RF2XX_STATE_PLL_ON
¶ ready to transmit
1
(0x09)
-
AT86RF2XX_STATE_SLEEP
¶ sleep mode
1
(0x0f)
-
AT86RF2XX_STATE_BUSY_RX_AACK
¶ busy receiving data (extended mode)
1
(0x11)
-
AT86RF2XX_STATE_BUSY_TX_ARET
¶ busy transmitting data (extended mode)
1
(0x12)
-
AT86RF2XX_STATE_RX_AACK_ON
¶ wait for incoming data
1
(0x16)
-
AT86RF2XX_STATE_TX_ARET_ON
¶ ready for sending data
1
(0x19)
-
AT86RF2XX_STATE_IN_PROGRESS
¶ ongoing state conversion
1
(0x1f)
-
AT86RF2XX_OPT_TELL_TX_START
¶ notify MAC layer on TX start
1
(0x0001)
-
AT86RF2XX_OPT_TELL_TX_END
¶ notify MAC layer on TX finished
1
(0x0002)
-
AT86RF2XX_OPT_TELL_RX_START
¶ notify MAC layer on RX start
1
(0x0004)
-
AT86RF2XX_OPT_TELL_RX_END
¶ notify MAC layer on RX finished
1
(0x0008)
-
AT86RF2XX_OPT_CSMA
¶ CSMA active.
1
(0x0010)
-
AT86RF2XX_OPT_PROMISCUOUS
¶ promiscuous mode active
1
(0x0020)
-
AT86RF2XX_OPT_PRELOADING
¶ preloading enabled
1
(0x0040)
-
AT86RF2XX_OPT_AUTOACK
¶ Auto ACK active.
1
(0x0080)
-
AT86RF2XX_OPT_ACK_PENDING
¶ ACK frames with data pending.
1
(0x0100)
-
struct at86rf2xx_params
at86rf2xx_params_t
¶ struct holding all params needed for device initialization
-
void
at86rf2xx_setup
(at86rf2xx_t * dev, constat86rf2xx.h::at86rf2xx_params_t
* params)¶ Setup an AT86RF2xx based device state.
Parameters
dev: device descriptor params: parameters for device initialization
-
void
at86rf2xx_reset
(at86rf2xx_t * dev)¶ Trigger a hardware reset and configure radio with default values.
Parameters
dev: device to reset
-
uint16_t
at86rf2xx_get_addr_short
(const at86rf2xx_t * dev)¶ Get the short address of the given device.
Parameters
dev: device to read from Return values
- the currently set (2-byte) short address
-
void
at86rf2xx_set_addr_short
(at86rf2xx_t * dev, uint16_t addr)¶ Set the short address of the given device.
Parameters
dev: device to write to addr: (2-byte) short address to set
-
uint64_t
at86rf2xx_get_addr_long
(const at86rf2xx_t * dev)¶ Get the configured long address of the given device.
Parameters
dev: device to read from Return values
- the currently set (8-byte) long address
-
void
at86rf2xx_set_addr_long
(at86rf2xx_t * dev, uint64_t addr)¶ Set the long address of the given device.
Parameters
dev: device to write to addr: (8-byte) long address to set
-
uint8_t
at86rf2xx_get_chan
(const at86rf2xx_t * dev)¶ Get the configured channel number of the given device.
Parameters
dev: device to read from Return values
- the currently set channel number
-
void
at86rf2xx_set_chan
(at86rf2xx_t * dev, uint8_t chan)¶ Set the channel number of the given device.
Parameters
dev: device to write to chan: channel number to set
-
uint8_t
at86rf2xx_get_page
(const at86rf2xx_t * dev)¶ Get the configured channel page of the given device.
Parameters
dev: device to read from Return values
- the currently set channel page
-
void
at86rf2xx_set_page
(at86rf2xx_t * dev, uint8_t page)¶ Set the channel page of the given device.
Parameters
dev: device to write to page: channel page to set
-
uint16_t
at86rf2xx_get_pan
(const at86rf2xx_t * dev)¶ Get the configured PAN ID of the given device.
Parameters
dev: device to read from Return values
- the currently set PAN ID
-
void
at86rf2xx_set_pan
(at86rf2xx_t * dev, uint16_t pan)¶ Set the PAN ID of the given device.
Parameters
dev: device to write to pan: PAN ID to set
-
int16_t
at86rf2xx_get_txpower
(const at86rf2xx_t * dev)¶ Get the configured transmission power of the given device [in dBm].
Parameters
dev: device to read from Return values
- configured transmission power in dBm
-
void
at86rf2xx_set_txpower
(const at86rf2xx_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
dev: device to write to txpower: transmission power in dBm
-
int16_t
at86rf2xx_get_rxsensitivity
(const at86rf2xx_t * dev)¶ Get the configured receiver sensitivity of the given device [in dBm].
Parameters
dev: device to read from Return values
- configured receiver sensitivity in dBm
-
void
at86rf2xx_set_rxsensitivity
(const at86rf2xx_t * dev, int16_t rxsens)¶ Set the receiver sensitivity 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
dev: device to write to rxsens: rx sensitivity in dBm
-
uint8_t
at86rf2xx_get_max_retries
(const at86rf2xx_t * dev)¶ Get the maximum number of retransmissions.
Parameters
dev: device to read from Return values
- configured number of retransmissions
-
void
at86rf2xx_set_max_retries
(const at86rf2xx_t * dev, uint8_t max)¶ Set the maximum number of retransmissions.
This setting specifies the number of attempts to retransmit a frame, when it was not acknowledged by the recipient, before the transaction gets cancelled. The maximum value is 7.
Parameters
dev: device to write to max: the maximum number of retransmissions
-
uint8_t
at86rf2xx_get_csma_max_retries
(const at86rf2xx_t * dev)¶ Get the maximum number of channel access attempts per frame (CSMA)
Parameters
dev: device to read from Return values
- configured number of retries
-
void
at86rf2xx_set_csma_max_retries
(const at86rf2xx_t * dev, int8_t retries)¶ Set the maximum number of channel access attempts per frame (CSMA)
This setting specifies the number of attempts to access the channel to transmit a frame. If the channel is busy
retries
times, then frame transmission fails. Valid values: 0 to 5, -1 means CSMA disabledParameters
dev: device to write to retries: the maximum number of retries
-
void
at86rf2xx_set_csma_backoff_exp
(const at86rf2xx_t * dev, uint8_t min, uint8_t max)¶ Set the min and max backoff exponent for CSMA/CA.
- Maximum BE: 0 - 8
- Minimum BE: 0 - [max]
Parameters
dev: device to write to min: the minimum BE max: the maximum BE
-
void
at86rf2xx_set_csma_seed
(const at86rf2xx_t * dev, const uint8_t entropy)¶ Set seed for CSMA random backoff.
Parameters
dev: device to write to entropy: 11 bit of entropy as seed for random backoff
-
int8_t
at86rf2xx_get_cca_threshold
(const at86rf2xx_t * dev)¶ Get the CCA threshold value.
Parameters
dev: device to read value from Return values
- the current CCA threshold value
-
void
at86rf2xx_set_cca_threshold
(const at86rf2xx_t * dev, int8_t value)¶ Set the CCA threshold value.
Parameters
dev: device to write to value: the new CCA threshold value
-
int8_t
at86rf2xx_get_ed_level
(at86rf2xx_t * dev)¶ Get the latest ED level measurement.
Parameters
dev: device to read value from Return values
- the last ED level
-
void
at86rf2xx_set_option
(at86rf2xx_t * dev, uint16_t option, bool state)¶ Enable or disable driver specific options.
Parameters
dev: device to set/clear option flag for option: option to enable/disable state: true for enable, false for disable
-
uint8_t
at86rf2xx_set_state
(at86rf2xx_t * dev, uint8_t state)¶ Set the state of the given device (trigger a state change)
Parameters
dev: device to change state of state: the targeted new state Return values
- the previous state before the new state was set
-
msp430_types.h::size_t
at86rf2xx_send
(at86rf2xx_t * dev, const uint8_t * data,msp430_types.h::size_t
len)¶ Convenience function for simply sending data.
Note
This function ignores the PRELOADING option
Parameters
dev: device to use for sending data: data to send (must include IEEE802.15.4 header) len: length of data
Return values
- number of bytes that were actually send
- 0 on error
-
void
at86rf2xx_tx_prepare
(at86rf2xx_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
dev: device to prepare for sending
-
msp430_types.h::size_t
at86rf2xx_tx_load
(at86rf2xx_t * dev, const uint8_t * data,msp430_types.h::size_t
len,msp430_types.h::size_t
offset)¶ Load chunks of data into the transmit buffer of the given device.
Parameters
dev: device to write data to data: buffer containing the data to load len: number of bytes in buffer
offset: offset used when writing data to internal buffer Return values
- offset + number of bytes written
-
void
at86rf2xx_tx_exec
(const at86rf2xx_t * dev)¶ Trigger sending of data previously loaded into transmit buffer.
Parameters
dev: device to trigger
-
bool
at86rf2xx_cca
(at86rf2xx_t * dev)¶ Perform one manual channel clear assessment (CCA)
The CCA mode and threshold level depends on the current transceiver settings.
Parameters
dev: device to use Return values
- true if channel is determined clear
- false if channel is determined busy
-
AT86RF2XX_MAX_PKT_LENGTH
¶ Maximum possible packet size in byte.
1
(IEEE802154_FRAME_LEN_MAX)
-
AT86RF2XX_DEFAULT_TXPOWER
¶ Default TX power (0dBm)
1
(IEEE802154_DEFAULT_TXPOWER)
-
RSSI_BASE_VAL
¶ Base (minimal) RSSI value in dBm.
1
(-91)
-
MAX_RX_SENSITIVITY
¶ Max Receiver sensitivity value in dBm.
1
(-49)
-
MIN_RX_SENSITIVITY
¶ Min Receiver sensitivity value in dBm.
1
(-101)
-
AT86RF2XX_HAVE_RETRIES
¶ Frame retry counter reporting.
1
(1)
The AT86RF2XX_HAVE_RETRIES flag enables support for NETOPT_TX_RETRIES NEEDED operation. Required for this functionality is the XAH_CTRL_2 register which contains the frame retry counter. Only the at86rf232 and the at86rf233 support this register.
-
AT86RF2XX_SMART_IDLE_LISTENING
¶ Smart idle listening feature.
1
(0)
This feature optimizes radio operation in the listening mode, reducing current consumption by ~50%. It is supported by only at86rf233. The reference manual recommends to disable this feature for RSSI measurements or random number generation (Section 8.4 and Section 11.2).
-
struct
at86rf2xx_params
¶ struct holding all params needed for device initialization
-
spi.h::spi_t
spi
¶ SPI bus the device is connected to.
-
atmega_common/include/periph_cpu_common.h::spi_clk_t
spi_clk
¶ SPI clock speed to use.
-
spi.h::spi_cs_t
cs_pin
¶ GPIO pin connected to chip select.
-
gpio.h::gpio_t
int_pin
¶ GPIO pin connected to the interrupt pin.
-
gpio.h::gpio_t
sleep_pin
¶ GPIO pin connected to the sleep pin.
-
gpio.h::gpio_t
reset_pin
¶ GPIO pin connected to the reset pin.
-
-
struct
at86rf2xx_t
¶ Device descriptor for AT86RF2XX radio devices.
-
netdev_ieee802154_t
netdev
¶ netdev parent struct
-
at86rf2xx.h::at86rf2xx_params_t
params
¶ parameters for initialization
-
uint16_t
flags
¶ Device specific flags.
-
uint8_t
state
¶ current state of the radio
-
uint8_t
tx_frame_len
¶ length of the current TX frame
-
uint8_t
idle_state
¶ state to return to after sending
-
uint8_t
pending_tx
¶ keep track of pending TX calls this is required to know when to return to
at86rf2xx.h::at86rf2xx_t::idle_state
-
uint8_t
tx_retries
¶ Number of NOACK retransmissions.
-
netdev_ieee802154_t