KW2x radio-driver

Device driver for the NXP CR20A and KW2xD radios.

KW2XRF_DEFAULT_CHANNEL
1
(IEEE802154_DEFAULT_CHANNEL)
KW2XRF_MIN_CHANNEL
1
(11U)
KW2XRF_MAX_CHANNEL
1
(26U)
KW2XRF_OPT_SRC_ADDR_LONG

Internal device option flags.

1
(NETDEV_IEEE802154_SRC_MODE_LONG)

0x00ff is reserved for general IEEE 802.15.4 flags (see netdev_ieee802154_t)legacy define

KW2XRF_OPT_RAWDUMP

legacy define

1
(NETDEV_IEEE802154_RAW)
KW2XRF_OPT_ACK_REQ

legacy define

1
(NETDEV_IEEE802154_ACK_REQ)
KW2XRF_OPT_AUTOCCA

CCA befor TX active.

1
(0x0100)
KW2XRF_OPT_PROMISCUOUS

promiscuous mode active

1
(0x0200)
KW2XRF_OPT_PRELOADING

preloading enabled

1
(0x0400)
KW2XRF_OPT_TELL_TX_START

notify MAC layer on TX start

1
(0x0800)
KW2XRF_OPT_TELL_TX_END

notify MAC layer on TX finished

1
(0x1000)
KW2XRF_OPT_TELL_RX_START

notify MAC layer on RX start

1
(0x2000)
KW2XRF_OPT_TELL_RX_END

notify MAC layer on RX finished

1
(0x4000)
KW2XRF_OPT_AUTOACK

enable automatically ACK for incommint packet

1
(0x8000)
struct kw2xrf_params kw2xrf_params_t

Struct holding all params needed for device initialization.

void kw2xrf_setup(kw2xrf_t * dev, const kw2xrf.h::kw2xrf_params_t * params)

Setup an KW2XRF based device state.

Parameters

dev:device descriptor
params:parameters for device initialization

int kw2xrf_init(kw2xrf_t * dev, gpio.h::gpio_cb_t cb)

Initialize the given KW2XRF device.

Parameters

dev:device descriptor
cb:irq callback

Return values

  • 0 on success
  • <0 on error
void kw2xrf_reset_phy(kw2xrf_t * dev)

Configure radio with default values.

Parameters

dev:device to reset

KW2XRF_MAX_PKT_LENGTH

Maximum packet length.

1
(IEEE802154_FRAME_LEN_MAX)
KW2XRF_DEFAULT_TX_POWER

Default TX_POWER in dbm used after initialization.

1
(IEEE802154_DEFAULT_TXPOWER)
KW2XDRF_OUTPUT_POWER_MAX

Maximum output power of the kw2x device in dBm.

1
(8)
KW2XDRF_OUTPUT_POWER_MIN

Minimum output power of the kw2x device in dBm.

1
(-35)
struct kw2xrf_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.

gpio.h::gpio_t cs_pin

GPIO pin connected to chip select.

gpio.h::gpio_t int_pin

GPIO pin connected to the interrupt pin.

struct kw2xrf_t

Device descriptor for KW2XRF radio devices.

sched.h::thread_t * thread

device specific fields

Network driver thread, for providing feedback from IRQ handler

kw2xrf.h::kw2xrf_params_t params

parameters for initialization

uint8_t buf()

Buffer for incoming or outgoing packets.

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 kw2xrf.h::kw2xrf_t::idle_state

int16_t tx_power

The current tx-power setting of the device.

netdev_ieee802154_t netdev

netdev parent struct