LoRaMAC

LoRaMAC definitions. More...

Detailed Description

LoRaMAC definitions.

Files

file  loramac.h
 LoRaMAC header definitions.
 

Data Structures

struct  loramac_channel_t
 A LoRaMAC network channel. More...
 

LoRaMAC default parameters

#define LORAMAC_DEV_EUI_DEFAULT
 Default device EUI. More...
 
#define LORAMAC_APP_EUI_DEFAULT
 Default application EUI. More...
 
#define LORAMAC_APP_KEY_DEFAULT
 Default application key. More...
 
#define LORAMAC_APP_SKEY_DEFAULT
 Default application session key. More...
 
#define LORAMAC_NWK_SKEY_DEFAULT
 Default network session key. More...
 
#define LORAMAC_DEV_ADDR_DEFAULT   { 0x00, 0x00, 0x00, 0x00 }
 Default device address.
 

LoRaMAC default values

#define LORAMAC_DEFAULT_DEVICE_CLASS   (LORAMAC_CLASS_A)
 Default device class (A, B or C)
 
#define LORAMAC_DEFAULT_NETID   (1U)
 Default NetID (only valid with ABP join procedure)
 
#define LORAMAC_DEFAULT_PUBLIC_NETWORK   (true)
 Default network type (public or private)
 
#define LORAMAC_DEFAULT_DR   (LORAMAC_DR_0)
 Default datarate (only valid for EU)
 
#define LORAMAC_DEFAULT_TX_POWER   (LORAMAC_TX_PWR_1)
 Default MAC TX power (14dBm in EU)
 
#define LORAMAC_DEFAULT_TX_PORT   (2U)
 Default MAC TX port (from 1 to 223)
 
#define LORAMAC_DEFAULT_TX_MODE   (LORAMAC_TX_CNF)
 Default MAC TX mode (confirmable or unconfirmable)
 
#define LORAMAC_DEFAULT_ADR   (false)
 Default MAC TX power (14dBm in EU) More...
 
#define LORAMAC_DEFAULT_RETX   (5U)
 Default uplink retransmission.
 
#define LORAMAC_DEFAULT_LINKCHK   (0U)
 Default link check interval (in seconds) More...
 
#define LORAMAC_DEFAULT_RX1_DELAY   (1U)
 Default first RX window delay (in s)
 
#define LORAMAC_DEFAULT_RX2_DELAY   (1U + LORAMAC_DEFAULT_RX1_DELAY)
 Default first RX window delay (in s)
 
#define LORAMAC_DEFAULT_AR   (false)
 Default automatic reply status.
 
#define LORAMAC_DEFAULT_RX2_DR   (LORAMAC_DR_0)
 Default second RX window datarate index.
 
#define LORAMAC_DEFAULT_RX2_FREQ   (869525000UL)
 Default second RX window frequency (in Hz)
 
#define LORAMAC_DEFAULT_JOIN_PROCEDURE   (LORAMAC_JOIN_OTAA)
 Default LoRaMAC join procedure.
 
#define LORAMAC_DEFAULT_JOIN_DELAY1   (5U)
 Default LoRaMAC join accept delay 1 (in seconds)
 
#define LORAMAC_DEFAULT_JOIN_DELAY2   (6U)
 Default LoRaMAC join accept delay 2.
 
#define LORAMAC_DEFAULT_MAX_FCNT_GAP   (16384U)
 Default max FCNT gap.
 
#define LORAMAC_DEFAULT_ADR_ACK_LIMIT   (64U)
 Default adaptive datarate ACK limit (in s)
 
#define LORAMAC_DEFAULT_ADR_ACK_DELAY   (32U)
 Default adaptive datarate ACK delay (in s)
 
#define LORAMAC_DEFAULT_ADR_TIMEOUT   (3U)
 Default adaptive datarate timeout.
 

LoRaMAC constants

#define LORAMAC_DEVEUI_LEN   (8U)
 Device EUI length in bytes.
 
#define LORAMAC_DEVADDR_LEN   (4U)
 Device address length in bytes.
 
#define LORAMAC_APPEUI_LEN   (8U)
 Application EUI length in bytes.
 
#define LORAMAC_APPKEY_LEN   (16U)
 Application key length in bytes.
 
#define LORAMAC_APPSKEY_LEN   (16U)
 Application session key length in bytes.
 
#define LORAMAC_NWKSKEY_LEN   (16U)
 Network session key length in bytes.
 
#define LORAMAC_PORT_MIN   (1U)
 Minimum port value.
 
#define LORAMAC_PORT_MAX   (223U)
 Maximmu port value.
 

LoRaMAC parameters indexes

enum  loramac_class_t { LORAMAC_CLASS_A, LORAMAC_CLASS_B, LORAMAC_CLASS_C }
 Device class. More...
 
enum  loramac_join_mode_t { LORAMAC_JOIN_OTAA, LORAMAC_JOIN_ABP }
 LoRaMAC network join procedure type. More...
 
enum  loramac_tx_mode_t { LORAMAC_TX_CNF, LORAMAC_TX_UNCNF }
 LoRaMAC transmission mode. More...
 
enum  loramac_dr_idx_t {
  LORAMAC_DR_0 = 0, LORAMAC_DR_1, LORAMAC_DR_2, LORAMAC_DR_3,
  LORAMAC_DR_4, LORAMAC_DR_5, LORAMAC_DR_6, LORAMAC_DR_7,
  LORAMAC_DR_8, LORAMAC_DR_9, LORAMAC_DR_10, LORAMAC_DR_11,
  LORAMAC_DR_12, LORAMAC_DR_13, LORAMAC_DR_14, LORAMAC_DR_15
}
 LoRaMAC datarate indexes. More...
 
enum  loramac_tx_pwr_idx_t {
  LORAMAC_TX_PWR_0 = 0, LORAMAC_TX_PWR_1, LORAMAC_TX_PWR_2, LORAMAC_TX_PWR_3,
  LORAMAC_TX_PWR_4, LORAMAC_TX_PWR_5, LORAMAC_TX_PWR_6, LORAMAC_TX_PWR_7,
  LORAMAC_TX_PWR_8, LORAMAC_TX_PWR_9, LORAMAC_TX_PWR_10, LORAMAC_TX_PWR_11,
  LORAMAC_TX_PWR_12, LORAMAC_TX_PWR_13, LORAMAC_TX_PWR_14, LORAMAC_TX_PWR_15
}
 LoRaMAC transmission power indexes. More...
 

Macro Definition Documentation

◆ LORAMAC_APP_EUI_DEFAULT

#define LORAMAC_APP_EUI_DEFAULT
Value:
{ 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 }

Default application EUI.

8 bytes key, required for join procedure

Definition at line 52 of file loramac.h.

◆ LORAMAC_APP_KEY_DEFAULT

#define LORAMAC_APP_KEY_DEFAULT
Value:
{ 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 }

Default application key.

16 bytes key, required for join procedure

Definition at line 62 of file loramac.h.

◆ LORAMAC_APP_SKEY_DEFAULT

#define LORAMAC_APP_SKEY_DEFAULT
Value:
{ 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 }

Default application session key.

16 bytes key, only required for ABP join procedure type

Definition at line 74 of file loramac.h.

◆ LORAMAC_DEFAULT_ADR

#define LORAMAC_DEFAULT_ADR   (false)

Default MAC TX power (14dBm in EU)

Default adaptive datarate state

Definition at line 163 of file loramac.h.

◆ LORAMAC_DEFAULT_LINKCHK

#define LORAMAC_DEFAULT_LINKCHK   (0U)

Default link check interval (in seconds)

0 means the link check process is disabled

Definition at line 179 of file loramac.h.

◆ LORAMAC_DEV_EUI_DEFAULT

#define LORAMAC_DEV_EUI_DEFAULT
Value:
{ 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 }

Default device EUI.

8 bytes key, required for join procedure

Definition at line 42 of file loramac.h.

◆ LORAMAC_NWK_SKEY_DEFAULT

#define LORAMAC_NWK_SKEY_DEFAULT
Value:
{ 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00 }

Default network session key.

16 bytes key, only required for ABP join procedure type.

Definition at line 86 of file loramac.h.

Enumeration Type Documentation

◆ loramac_class_t

Device class.

Enumerator
LORAMAC_CLASS_A 

Class A device.

LORAMAC_CLASS_B 

Class B device.

LORAMAC_CLASS_C 

Class C device.

Definition at line 317 of file loramac.h.

◆ loramac_dr_idx_t

LoRaMAC datarate indexes.

Each index corresponds to a different modulation, spreading factor and bandwidth depending on the regions.

Enumerator
LORAMAC_DR_0 
  • ISM EU863-870: LoRa modulation, SF12, BW125 (250bit/s)
  • ISM US902-928: LoRa modulation, SF10, BW125 (980bit/s)
  • ISM CN779-787: LoRa modulation, SF12, BW125 (250bit/s)
  • ISM EU433: LoRa modulation, SF12, BW125 (250bit/s)
  • ISM AU915-928: LoRa modulation, SF10, BW125 (980bit/s)
  • ISM CN470-510: LoRa modulation, SF12, BW125 (250bit/s)
  • ISM AS923: LoRa modulation, SF12, BW125 (250bit/s)
  • ISM KR920-923: LoRa modulation, SF12, BW125 (250bit/s)

Default value used.

LORAMAC_DR_1 
  • ISM EU863-870: LoRa modulation, SF11, BW125 (440bit/s)
  • ISM US902-928: LoRa modulation, SF9, BW125 (1760bit/s)
  • ISM CN779-787: LoRa modulation, SF11, BW125 (440bit/s)
  • ISM EU433: LoRa modulation, SF11, BW125 (440bit/s)
  • ISM AU915-928: LoRa modulation, SF9, BW125 (1760bit/s)
  • ISM CN470-510: LoRa modulation, SF11, BW125 (440bit/s)
  • ISM AS923: LoRa modulation, SF11, BW125 (440bit/s)
  • ISM KR920-923: LoRa modulation, SF11, BW125 (440bit/s)
LORAMAC_DR_2 
  • ISM EU863-870: LoRa modulation, SF10, BW125 (980bit/s)
  • ISM US902-928: LoRa modulation, SF8, BW125 (3125bit/s)
  • ISM CN779-787: LoRa modulation, SF10, BW125 (980bit/s)
  • ISM EU433: LoRa modulation, SF10, BW125 (980bit/s)
  • ISM AU915-928: LoRa modulation, SF8, BW125 (3125bit/s)
  • ISM CN470-510: LoRa modulation, SF10, BW125 (980bit/s)
  • ISM AS923: LoRa modulation, SF10, BW125 (980bit/s)
  • ISM KR920-923: LoRa modulation, SF10, BW125 (980bit/s)
LORAMAC_DR_3 
  • ISM EU863-870: LoRa modulation, SF9, BW125 (1760bit/s)
  • ISM US902-928: LoRa modulation, SF7, BW125 (5470bit/s)
  • ISM CN779-787: LoRa modulation, SF9, BW125 (1760bit/s)
  • ISM EU433: LoRa modulation, SF9, BW125 (1760bit/s)
  • ISM AU915-928: LoRa modulation, SF7, BW125 (5470bit/s)
  • ISM CN470-510: LoRa modulation, SF9, BW125 (1760bit/s)
  • ISM AS923: LoRa modulation, SF9, BW125 (1760bit/s)
  • ISM KR920-923: LoRa modulation, SF9, BW125 (1760bit/s)
LORAMAC_DR_4 
  • ISM EU863-870: LoRa modulation, SF8, BW125 (3125bit/s)
  • ISM US902-928: LoRa modulation, SF8, BW500 (12500bit/s)
  • ISM CN779-787: LoRa modulation, SF8, BW125 (3125bit/s)
  • ISM EU433: LoRa modulation, SF8, BW125 (3125bit/s)
  • ISM AU915-928: LoRa modulation, SF8, BW500 (12500bit/s)
  • ISM CN470-510: LoRa modulation, SF8, BW125 (3125bit/s)
  • ISM AS923: LoRa modulation, SF8, BW125 (3125bit/s)
  • ISM KR920-923: LoRa modulation, SF8, BW125 (3125bit/s)
LORAMAC_DR_5 
  • ISM EU863-870: LoRa modulation, SF7, BW125 (5470bit/s)
  • ISM US902-928: reserved for future use
  • ISM CN779-787: LoRa modulation, SF7, BW125 (5470bit/s)
  • ISM EU433: LoRa modulation, SF7, BW125 (5470bit/s)
  • ISM AU915-928: reserved for future use
  • ISM CN470-510: LoRa modulation, SF7, BW125 (5470bit/s)
  • ISM AS923: LoRa modulation, SF7, BW125 (5470bit/s)
  • ISM KR920-923: LoRa modulation, SF7, BW125 (5470bit/s)
LORAMAC_DR_6 
  • ISM EU863-870: LoRa modulation, SF7, BW250 (11000bit/s)
  • ISM US902-928: reserved for future use
  • ISM CN779-787: LoRa modulation, SF7, BW250 (11000bit/s)
  • ISM EU433 : LoRa modulation, SF7, BW250 (11000bit/s)
  • ISM AU915-928: reserved for future use
  • ISM CN470-510: reserved for future use
  • ISM AS923: LoRa modulation, SF7, BW250 (11000bit/s)
  • ISM KR920-923: reserved for future use
LORAMAC_DR_7 
  • ISM EU863-870: FSK modulation (50000bit/s)
  • ISM US902-928: reserved for future use
  • ISM CN779-787: FSK modulation (50000bit/s)
  • ISM EU433: FSK modulation (50000bit/s)
  • ISM AU915-928: reserved for future use
  • ISM CN470-510: reserved for future use
  • ISM AS923: FSK modulation (50000bit/s)
  • ISM KR920-923: reserved for future use
LORAMAC_DR_8 
  • ISM EU863-870: reserved for future use
  • ISM US902-928: LoRa modulation, SF12, BW500 (980bit/s)
  • ISM CN779-787: reserved for future use
  • ISM EU433: reserved for future use
  • ISM AU915-928: LoRa modulation, SF12, BW500 (980bit/s)
  • ISM CN470-510: reserved for future use
  • ISM AS923: reserved for future use
  • ISM KR920-923: reserved for future use
LORAMAC_DR_9 
  • ISM EU863-870: reserved for future use
  • ISM US902-928: LoRa modulation, SF11, BW500 (1760bit/s)
  • ISM CN779-787: reserved for future use
  • ISM EU433: reserved for future use
  • ISM AU915-928: LoRa modulation, SF11, BW500 (1760bit/s)
  • ISM CN470-510: reserved for future use
  • ISM AS923: reserved for future use
  • ISM KR920-923: reserved for future use
LORAMAC_DR_10 
  • ISM EU863-870: reserved for future use
  • ISM US902-928: LoRa modulation, SF10, BW500 (3900bit/s)
  • ISM CN779-787: reserved for future use
  • ISM EU433: reserved for future use
  • ISM AU915-928: LoRa modulation, SF10, BW500 (3900bit/s)
  • ISM CN470-510: reserved for future use
  • ISM AS923: reserved for future use
  • ISM KR920-923: reserved for future use
LORAMAC_DR_11 
  • ISM EU863-870: reserved for future use
  • ISM US902-928: LoRa modulation, SF9, BW500 (7000bit/s)
  • ISM CN779-787: reserved for future use
  • ISM EU433: reserved for future use
  • ISM AU915-928: LoRa modulation, SF9, BW500 (7000bit/s)
  • ISM CN470-510: reserved for future use
  • ISM AS923: reserved for future use
  • ISM KR920-923: reserved for future use
LORAMAC_DR_12 
  • ISM EU863-870: reserved for future use
  • ISM US902-928: LoRa modulation, SF8, BW500 (12500bit/s)
  • ISM CN779-787: reserved for future use
  • ISM EU433: reserved for future use
  • ISM AU915-928: LoRa modulation, SF8, BW500 (12500bit/s)
  • ISM CN470-510: reserved for future use
  • ISM AS923: reserved for future use
  • ISM KR920-923: reserved for future use
LORAMAC_DR_13 
  • ISM EU863-870: reserved for future use
  • ISM US902-928: LoRa modulation, SF7, BW500 (21900bit/s)
  • ISM CN779-787: reserved for future use
  • ISM EU433: reserved for future use
  • ISM AU915-928: LoRa modulation, SF7, BW500 (21900bit/s)
  • ISM CN470-510: reserved for future use
  • ISM AS923: reserved for future use
  • ISM KR920-923: reserved for future use
LORAMAC_DR_14 
  • ISM EU863-870: reserved for future use
  • ISM US902-928: reserved for future use
  • ISM CN779-787: reserved for future use
  • ISM EU433: reserved for future use
  • ISM AU915-928: reserved for future use
  • ISM CN470-510: reserved for future use
  • ISM AS923: reserved for future use
  • ISM KR920-923: reserved for future use
LORAMAC_DR_15 
  • ISM EU863-870: reserved for future use
  • ISM US902-928: reserved for future use
  • ISM CN779-787: reserved for future use
  • ISM EU433: reserved for future use
  • ISM AU915-928: reserved for future use
  • ISM CN470-510: reserved for future use
  • ISM AS923: reserved for future use
  • ISM KR920-923: reserved for future use

Definition at line 345 of file loramac.h.

◆ loramac_join_mode_t

LoRaMAC network join procedure type.

Enumerator
LORAMAC_JOIN_OTAA 

Other-the-air activation.

LORAMAC_JOIN_ABP 

Activation by personnalization.

Definition at line 326 of file loramac.h.

◆ loramac_tx_mode_t

LoRaMAC transmission mode.

Enumerator
LORAMAC_TX_CNF 

Confirmable transmission mode.

LORAMAC_TX_UNCNF 

Unconfirmable transmission mode.

Definition at line 334 of file loramac.h.

◆ loramac_tx_pwr_idx_t

LoRaMAC transmission power indexes.

Each index corresponds to a different modulation, spreading factor and bandwidth depending on the regions.

Enumerator
LORAMAC_TX_PWR_0 
  • EU863-870: 20dBm (if supported)
  • US902-928: 30dBm (if supported)
  • CN779-787: 10dBm
  • EU433: 10dBm
  • AU915-928: 30dBm
  • CN470-510: 17dBm
  • ISM AS923: 14dBm
  • ISM KR920-923: 20dBm
LORAMAC_TX_PWR_1 
  • EU863-870: 14dBm
  • US902-928: 28dBm
  • CN779-787: 7dBm
  • EU433: 7dBm
  • AU915-928: 28dBm
  • CN470-510: 16dBm
  • ISM AS923: 12dBm
  • ISM KR920-923: 14dBm

Default value used

LORAMAC_TX_PWR_2 
  • EU863-870: 11dBm
  • US902-928: 26dBm
  • CN779-787: 4dBm
  • EU433: 4dBm
  • AU915-928: 26dBm
  • CN470-510: 14dBm
  • ISM AS923: 10dBm
  • ISM KR920-923: 10dBm
LORAMAC_TX_PWR_3 
  • EU863-870: 8dBm
  • US902-928: 24dBm
  • CN779-787: 1dBm
  • EU433: 1dBm
  • AU915-928: 24dBm
  • CN470-510: 12dBm
  • ISM AS923: 8dBm
  • ISM KR920-923: 8dBm
LORAMAC_TX_PWR_4 
  • EU863-870: 5dBm
  • US902-928: 22dBm
  • CN779-787: -2dBm
  • EU433: -2dBm
  • AU915-928: 22dBm
  • CN470-510: 10dBm
  • ISM AS923: 6dBm
  • ISM KR920-923: 5dBm
LORAMAC_TX_PWR_5 
  • EU863-870: 2dBm
  • US902-928: 20dBm
  • CN779-787: -5dBm
  • EU433: -5dBm
  • AU915-928: 20dBm
  • CN470-510: 7dBm
  • ISM AS923: 4dBm
  • ISM KR920-923: 2dBm
LORAMAC_TX_PWR_6 
  • EU863-870: Reserved for future use
  • US902-928: 18dBm
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: 18dBm
  • CN470-510: 5dBm
  • ISM AS923: Reserved for future use
  • ISM KR920-923: 0dBm
LORAMAC_TX_PWR_7 
  • EU863-870: Reserved for future use
  • US902-928: 16dBm
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: 16dBm
  • CN470-510: 2dBm
  • ISM AS923: Reserved for future use
  • ISM KR920-923: Reserved for future use
LORAMAC_TX_PWR_8 
  • EU863-870: Reserved for future use
  • US902-928: 14dBm
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: 14dBm
  • CN470-510: Reserved for future use
  • ISM AS923: Reserved for future use
  • ISM KR920-923: Reserved for future use
LORAMAC_TX_PWR_9 
  • EU863-870: Reserved for future use
  • US902-928: 12dBm
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: 12dBm
  • CN470-510: Reserved for future use
  • ISM AS923: Reserved for future use
  • ISM KR920-923: Reserved for future use
LORAMAC_TX_PWR_10 
  • EU863-870: Reserved for future use
  • US902-928: 10dBm
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: 10dBm
  • CN470-510: Reserved for future use
  • ISM AS923: Reserved for future use
  • ISM KR920-923: Reserved for future use
LORAMAC_TX_PWR_11 
  • EU863-870: Reserved for future use
  • US902-928: Reserved for future use
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: Reserved for future use
  • CN470-510: Reserved for future use
  • ISM AS923: Reserved for future use
  • ISM KR920-923: Reserved for future use
LORAMAC_TX_PWR_12 
  • EU863-870: Reserved for future use
  • US902-928: Reserved for future use
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: Reserved for future use
  • CN470-510: Reserved for future use
  • ISM AS923: Reserved for future use
  • ISM KR920-923: Reserved for future use
LORAMAC_TX_PWR_13 
  • EU863-870: Reserved for future use
  • US902-928: Reserved for future use
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: Reserved for future use
  • CN470-510: Reserved for future use
  • ISM AS923: Reserved for future use
  • ISM KR920-923: Reserved for future use
LORAMAC_TX_PWR_14 
  • EU863-870: Reserved for future use
  • US902-928: Reserved for future use
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: Reserved for future use
  • CN470-510: Reserved for future use
  • ISM AS923: Reserved for future use
  • ISM KR920-923: Reserved for future use
LORAMAC_TX_PWR_15 
  • EU863-870: Reserved for future use
  • US902-928: Reserved for future use
  • CN779-787: Reserved for future use
  • EU433: Reserved for future use
  • AU915-928: Reserved for future use
  • CN470-510: Reserved for future use
  • ISM AS923: Reserved for future use
  • ISM KR920-923: Reserved for future use

Definition at line 532 of file loramac.h.