IEEE 802.15.4

Overview

IEEE 802.15.4 is a technical standard which defines the operation of low-rate wireless personal area networks (LR-WPANs). For more detailed overview of this standard, see this IEEE 802.15.4 Wikipedia article. Also, see IEEE GET Program for creating an IEEE account and downloading the specification.

Zephyr supports IEEE 802.15.4 with Thread and 6LoWPAN. The Thread implementation is based on OpenThread. The IPv6 header compression in 6LoWPAN is shared with the Bluetooth IPSP (IP support profile).

API Reference

IEEE 802.15.4

group ieee802154

IEEE 802.15.4 library.

Defines

IEEE802154_MAX_ADDR_LENGTH
IEEE802154_NO_CHANNEL
IEEE802154_L2_CTX_TYPE
IEEE802154_AR_FLAG_SET

Typedefs

typedef void (*energy_scan_done_cb_t)(const struct device *dev, int16_t max_ed)
typedef void (*ieee802154_event_cb_t)(const struct device *dev, enum ieee802154_event evt, void *event_params)

Enums

enum ieee802154_channel

IEEE 802.15.4 Channel assignments.

Channel numbering for 868 MHz, 915 MHz, and 2450 MHz bands.

  • Channel 0 is for 868.3 MHz.

  • Channels 1-10 are for 906 to 924 MHz with 2 MHz channel spacing.

  • Channels 11-26 are for 2405 to 2530 MHz with 5 MHz channel spacing.

For more information, please refer to 802.15.4-2015 Section 10.1.2.2.

Values:

enumerator IEEE802154_SUB_GHZ_CHANNEL_MIN
enumerator IEEE802154_SUB_GHZ_CHANNEL_MAX
enumerator IEEE802154_2_4_GHZ_CHANNEL_MIN
enumerator IEEE802154_2_4_GHZ_CHANNEL_MAX
enum ieee802154_hw_caps

Values:

enumerator IEEE802154_HW_FCS
enumerator IEEE802154_HW_PROMISC
enumerator IEEE802154_HW_FILTER
enumerator IEEE802154_HW_CSMA
enumerator IEEE802154_HW_2_4_GHZ
enumerator IEEE802154_HW_TX_RX_ACK
enumerator IEEE802154_HW_SUB_GHZ
enumerator IEEE802154_HW_ENERGY_SCAN
enumerator IEEE802154_HW_TXTIME
enumerator IEEE802154_HW_SLEEP_TO_TX
enum ieee802154_filter_type

Values:

enumerator IEEE802154_FILTER_TYPE_IEEE_ADDR
enumerator IEEE802154_FILTER_TYPE_SHORT_ADDR
enumerator IEEE802154_FILTER_TYPE_PAN_ID
enumerator IEEE802154_FILTER_TYPE_SRC_IEEE_ADDR
enumerator IEEE802154_FILTER_TYPE_SRC_SHORT_ADDR
enum ieee802154_event

Values:

enumerator IEEE802154_EVENT_TX_STARTED
enumerator IEEE802154_EVENT_RX_FAILED
enum ieee802154_rx_fail_reason

Values:

enumerator IEEE802154_RX_FAIL_NOT_RECEIVED
enumerator IEEE802154_RX_FAIL_INVALID_FCS
enumerator IEEE802154_RX_FAIL_ADDR_FILTERED
enumerator IEEE802154_RX_FAIL_OTHER
enum ieee802154_tx_mode

IEEE802.15.4 Transmission mode.

Values:

enumerator IEEE802154_TX_MODE_DIRECT

Transmit packet immediately, no CCA.

enumerator IEEE802154_TX_MODE_CCA

Perform CCA before packet transmission.

enumerator IEEE802154_TX_MODE_CSMA_CA

Perform full CSMA CA procedure before packet transmission.

enumerator IEEE802154_TX_MODE_TXTIME

Transmit packet in the future, at specified time, no CCA.

enumerator IEEE802154_TX_MODE_TXTIME_CCA

Transmit packet in the future, perform CCA before transmission.

enum ieee802154_fpb_mode

IEEE802.15.4 Frame Pending Bit table address matching mode.

Values:

enumerator IEEE802154_FPB_ADDR_MATCH_THREAD

The pending bit shall be set only for addresses found in the list.

enumerator IEEE802154_FPB_ADDR_MATCH_ZIGBEE

The pending bit shall be cleared for short addresses found in the list.

enum ieee802154_config_type

IEEE802.15.4 driver configuration types.

Values:

enumerator IEEE802154_CONFIG_AUTO_ACK_FPB

Indicates how radio driver should set Frame Pending bit in ACK responses for Data Requests. If enabled, radio driver should determine whether to set the bit or not based on the information provided with IEEE802154_CONFIG_ACK_FPB config and FPB address matching mode specified. Otherwise, Frame Pending bit should be set to 1(see IEEE Std 802.15.4-2006, 7.2.2.3.1).

enumerator IEEE802154_CONFIG_ACK_FPB

Indicates whether to set ACK Frame Pending bit for specific address or not. Disabling the Frame Pending bit with no address provided (NULL pointer) should disable it for all enabled addresses.

enumerator IEEE802154_CONFIG_PAN_COORDINATOR

Indicates whether the device is a PAN coordinator.

enumerator IEEE802154_CONFIG_PROMISCUOUS

Enable/disable promiscuous mode.

enumerator IEEE802154_CONFIG_EVENT_HANDLER

Specifies new radio event handler. Specifying NULL as a handler will disable radio events notification.

Functions

static inline bool ieee802154_is_ar_flag_set(struct net_buf *frag)

Check if AR flag is set on the frame inside given net_pkt.

Return

True if AR flag is set, False otherwise

Parameters
  • frag: A valid pointer on a net_buf structure, must not be NULL, and its length should be at least made of 1 byte (ACK frames are the smallest frames on 15.4 and made of 3 bytes, not not counting the FCS part).

enum net_verdict ieee802154_radio_handle_ack(struct net_if *iface, struct net_pkt *pkt)

Radio driver ACK handling function that hw drivers should use.

ACK handling requires fast handling and thus such function helps to hook directly the hw drivers to the radio driver.

Return

NET_OK if it was handled, NET_CONTINUE otherwise

Parameters
  • iface: A valid pointer on a network interface that received the packet

  • pkt: A valid pointer on a packet to check

void ieee802154_init(struct net_if *iface)

Initialize L2 stack for a given interface.

Parameters
  • iface: A valid pointer on a network interface

struct ieee802154_security_ctx
#include <ieee802154.h>
struct ieee802154_context
#include <ieee802154.h>
struct ieee802154_filter
#include <ieee802154_radio.h>
struct ieee802154_config
#include <ieee802154_radio.h>

IEEE802.15.4 driver configuration data.

struct ieee802154_radio_api
#include <ieee802154_radio.h>

IEEE 802.15.4 radio interface API.

IEEE 802.15.4 Management

group ieee802154_mgmt

IEEE 802.15.4 library.

Defines

IEEE802154_MAX_ADDR_LENGTH
NET_REQUEST_IEEE802154_SET_ACK
NET_REQUEST_IEEE802154_UNSET_ACK
NET_REQUEST_IEEE802154_PASSIVE_SCAN
NET_REQUEST_IEEE802154_ACTIVE_SCAN
NET_REQUEST_IEEE802154_CANCEL_SCAN
NET_REQUEST_IEEE802154_ASSOCIATE
NET_REQUEST_IEEE802154_DISASSOCIATE
NET_REQUEST_IEEE802154_SET_CHANNEL
NET_REQUEST_IEEE802154_GET_CHANNEL
NET_REQUEST_IEEE802154_SET_PAN_ID
NET_REQUEST_IEEE802154_GET_PAN_ID
NET_REQUEST_IEEE802154_SET_EXT_ADDR
NET_REQUEST_IEEE802154_GET_EXT_ADDR
NET_REQUEST_IEEE802154_SET_SHORT_ADDR
NET_REQUEST_IEEE802154_GET_SHORT_ADDR
NET_REQUEST_IEEE802154_GET_TX_POWER
NET_REQUEST_IEEE802154_SET_TX_POWER
NET_EVENT_IEEE802154_SCAN_RESULT
IEEE802154_IS_CHAN_SCANNED(_channel_set, _chan)
IEEE802154_IS_CHAN_UNSCANNED(_channel_set, _chan)
IEEE802154_ALL_CHANNELS

Enums

enum net_request_ieee802154_cmd

Values:

enumerator NET_REQUEST_IEEE802154_CMD_SET_ACK
enumerator NET_REQUEST_IEEE802154_CMD_UNSET_ACK
enumerator NET_REQUEST_IEEE802154_CMD_PASSIVE_SCAN
enumerator NET_REQUEST_IEEE802154_CMD_ACTIVE_SCAN
enumerator NET_REQUEST_IEEE802154_CMD_CANCEL_SCAN
enumerator NET_REQUEST_IEEE802154_CMD_ASSOCIATE
enumerator NET_REQUEST_IEEE802154_CMD_DISASSOCIATE
enumerator NET_REQUEST_IEEE802154_CMD_SET_CHANNEL
enumerator NET_REQUEST_IEEE802154_CMD_GET_CHANNEL
enumerator NET_REQUEST_IEEE802154_CMD_SET_PAN_ID
enumerator NET_REQUEST_IEEE802154_CMD_GET_PAN_ID
enumerator NET_REQUEST_IEEE802154_CMD_SET_EXT_ADDR
enumerator NET_REQUEST_IEEE802154_CMD_GET_EXT_ADDR
enumerator NET_REQUEST_IEEE802154_CMD_SET_SHORT_ADDR
enumerator NET_REQUEST_IEEE802154_CMD_GET_SHORT_ADDR
enumerator NET_REQUEST_IEEE802154_CMD_GET_TX_POWER
enumerator NET_REQUEST_IEEE802154_CMD_SET_TX_POWER
enumerator NET_REQUEST_IEEE802154_CMD_SET_SECURITY_SETTINGS
enumerator NET_REQUEST_IEEE802154_CMD_GET_SECURITY_SETTINGS
enum net_event_ieee802154_cmd

Values:

enumerator NET_EVENT_IEEE802154_CMD_SCAN_RESULT
struct ieee802154_req_params
#include <ieee802154_mgmt.h>

Scanning parameters.

Used to request a scan and get results as well

struct ieee802154_security_params
#include <ieee802154_mgmt.h>

Security parameters.

Used to setup the link-layer security settings