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.

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

Enums

enum ieee802154_hw_caps

Values:

IEEE802154_HW_FCS = BIT(0)
IEEE802154_HW_PROMISC = BIT(1)
IEEE802154_HW_FILTER = BIT(2)
IEEE802154_HW_CSMA = BIT(3)
IEEE802154_HW_2_4_GHZ = BIT(4)
IEEE802154_HW_TX_RX_ACK = BIT(5)
IEEE802154_HW_SUB_GHZ = BIT(6)
enum ieee802154_filter_type

Values:

IEEE802154_FILTER_TYPE_IEEE_ADDR
IEEE802154_FILTER_TYPE_SHORT_ADDR
IEEE802154_FILTER_TYPE_PAN_ID
IEEE802154_FILTER_TYPE_SRC_IEEE_ADDR
IEEE802154_FILTER_TYPE_SRC_SHORT_ADDR
enum ieee802154_config_type

IEEE802.15.4 driver configuration types.

Values:

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. Otherwise, Frame Pending bit should be set to 1(see IEEE Std 802.15.4-2006, 7.2.2.3.1).

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.

Functions

static 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_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:

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

Values:

NET_EVENT_IEEE802154_CMD_SCAN_RESULT = 1
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