LoRaMAC  4.4.6
Documentation of the API
LoRa MAC layer implementation

This module specifies the API implementation of the LoRaMAC layer. This is a placeholder for a detailed description of the LoRaMac layer and the supported features. More...

Data Structures

struct  RxChannelParams_t
 
struct  LoRaMacParams_t
 
union  PingSlotInfo_t
 
struct  BeaconInfo_t
 
union  LoRaMacFlags_t
 
struct  LoRaMacNvmDataGroup1_t
 
struct  LoRaMacNvmDataGroup2_t
 
struct  LoRaMacNvmData_t
 
struct  RequestReturnParam_t
 
struct  McpsReqUnconfirmed_t
 
struct  McpsReqConfirmed_t
 
struct  McpsReqProprietary_t
 
struct  McpsReq_t
 
struct  McpsConfirm_t
 
struct  McpsIndication_t
 
struct  MlmeReqJoin_t
 
struct  MlmeReqTxCw_t
 
struct  MlmeReqPingSlotInfo_t
 
struct  MlmeReqDeriveMcKEKey_t
 
struct  MlmeReqDeriveMcSessionKeyPair_t
 
struct  MlmeReq_t
 
struct  MlmeConfirm_t
 
struct  MlmeIndication_t
 
union  MibParam_t
 
struct  MibRequestConfirm_t
 
struct  LoRaMacTxInfo_t
 
struct  LoRaMacPrimitives_t
 
struct  LoRaMacCallback_t
 

Macros

#define MAX_ACK_RETRIES   8
 
#define UP_LINK   0
 
#define DOWN_LINK   1
 
#define LORA_MAC_MLME_CONFIRM_QUEUE_LEN   5
 
#define LORAMAC_CRYPTO_MULTICAST_KEYS   127
 
#define LORA_MAC_COMMAND_MAX_LENGTH   128
 
#define LORAMAC_NVM_NOTIFY_FLAG_NONE   0x00
 
#define LORAMAC_NVM_NOTIFY_FLAG_CRYPTO   0x01
 
#define LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP1   0x02
 
#define LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP2   0x04
 
#define LORAMAC_NVM_NOTIFY_FLAG_SECURE_ELEMENT   0x08
 
#define LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP1   0x10
 
#define LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP2   0x20
 
#define LORAMAC_NVM_NOTIFY_FLAG_CLASS_B   0x40
 

Enumerations

enum  ActivationType_t { ACTIVATION_TYPE_NONE = 0, ACTIVATION_TYPE_ABP = 1, ACTIVATION_TYPE_OTAA = 2 }
 
enum  LoRaMacRxSlot_t {
  RX_SLOT_WIN_1, RX_SLOT_WIN_2, RX_SLOT_WIN_CLASS_C, RX_SLOT_WIN_CLASS_C_MULTICAST,
  RX_SLOT_WIN_CLASS_B_PING_SLOT, RX_SLOT_WIN_CLASS_B_MULTICAST_SLOT, RX_SLOT_NONE
}
 
enum  LoRaMacEventInfoStatus_t {
  LORAMAC_EVENT_INFO_STATUS_OK = 0, LORAMAC_EVENT_INFO_STATUS_ERROR, LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT, LORAMAC_EVENT_INFO_STATUS_RX1_TIMEOUT,
  LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT, LORAMAC_EVENT_INFO_STATUS_RX1_ERROR, LORAMAC_EVENT_INFO_STATUS_RX2_ERROR, LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL,
  LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED, LORAMAC_EVENT_INFO_STATUS_TX_DR_PAYLOAD_SIZE_ERROR, LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOSS, LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL,
  LORAMAC_EVENT_INFO_STATUS_MIC_FAIL, LORAMAC_EVENT_INFO_STATUS_MULTICAST_FAIL, LORAMAC_EVENT_INFO_STATUS_BEACON_LOCKED, LORAMAC_EVENT_INFO_STATUS_BEACON_LOST,
  LORAMAC_EVENT_INFO_STATUS_BEACON_NOT_FOUND
}
 
enum  LoRaMacRegion_t {
  LORAMAC_REGION_AS923, LORAMAC_REGION_AU915, LORAMAC_REGION_CN470, LORAMAC_REGION_CN779,
  LORAMAC_REGION_EU433, LORAMAC_REGION_EU868, LORAMAC_REGION_KR920, LORAMAC_REGION_IN865,
  LORAMAC_REGION_US915, LORAMAC_REGION_RU864
}
 
enum  Mcps_t { MCPS_UNCONFIRMED, MCPS_CONFIRMED, MCPS_MULTICAST, MCPS_PROPRIETARY }
 LoRaMAC data services. More...
 
enum  Mlme_t {
  MLME_UNKNOWN, MLME_JOIN, MLME_REJOIN_0, MLME_REJOIN_1,
  MLME_LINK_CHECK, MLME_TXCW, MLME_TXCW_1, MLME_SCHEDULE_UPLINK,
  MLME_DERIVE_MC_KE_KEY, MLME_DERIVE_MC_KEY_PAIR, MLME_DEVICE_TIME, MLME_BEACON,
  MLME_BEACON_ACQUISITION, MLME_PING_SLOT_INFO, MLME_BEACON_TIMING, MLME_BEACON_LOST
}
 LoRaMAC management services. More...
 
enum  Mib_t {
  MIB_DEVICE_CLASS, MIB_NETWORK_ACTIVATION, MIB_DEV_EUI, MIB_JOIN_EUI,
  MIB_SE_PIN, MIB_ADR, MIB_NET_ID, MIB_DEV_ADDR,
  MIB_APP_KEY, MIB_NWK_KEY, MIB_J_S_INT_KEY, MIB_J_S_ENC_KEY,
  MIB_F_NWK_S_INT_KEY, MIB_S_NWK_S_INT_KEY, MIB_NWK_S_ENC_KEY, MIB_APP_S_KEY,
  MIB_MC_KE_KEY, MIB_MC_KEY_0, MIB_MC_APP_S_KEY_0, MIB_MC_NWK_S_KEY_0,
  MIB_MC_KEY_1, MIB_MC_APP_S_KEY_1, MIB_MC_NWK_S_KEY_1, MIB_MC_KEY_2,
  MIB_MC_APP_S_KEY_2, MIB_MC_NWK_S_KEY_2, MIB_MC_KEY_3, MIB_MC_APP_S_KEY_3,
  MIB_MC_NWK_S_KEY_3, MIB_PUBLIC_NETWORK, MIB_CHANNELS, MIB_RX2_CHANNEL,
  MIB_RX2_DEFAULT_CHANNEL, MIB_RXC_CHANNEL, MIB_RXC_DEFAULT_CHANNEL, MIB_CHANNELS_MASK,
  MIB_CHANNELS_DEFAULT_MASK, MIB_CHANNELS_NB_TRANS, MIB_MAX_RX_WINDOW_DURATION, MIB_RECEIVE_DELAY_1,
  MIB_RECEIVE_DELAY_2, MIB_JOIN_ACCEPT_DELAY_1, MIB_JOIN_ACCEPT_DELAY_2, MIB_CHANNELS_DEFAULT_DATARATE,
  MIB_CHANNELS_DATARATE, MIB_CHANNELS_TX_POWER, MIB_CHANNELS_DEFAULT_TX_POWER, MIB_SYSTEM_MAX_RX_ERROR,
  MIB_MIN_RX_SYMBOLS, MIB_ANTENNA_GAIN, MIB_DEFAULT_ANTENNA_GAIN, MIB_NVM_CTXS,
  MIB_ABP_LORAWAN_VERSION, MIB_LORAWAN_VERSION, MIB_BEACON_INTERVAL, MIB_BEACON_RESERVED,
  MIB_BEACON_GUARD, MIB_BEACON_WINDOW, MIB_BEACON_WINDOW_SLOTS, MIB_PING_SLOT_WINDOW,
  MIB_BEACON_SYMBOL_TO_DEFAULT, MIB_BEACON_SYMBOL_TO_EXPANSION_MAX, MIB_PING_SLOT_SYMBOL_TO_EXPANSION_MAX, MIB_BEACON_SYMBOL_TO_EXPANSION_FACTOR,
  MIB_PING_SLOT_SYMBOL_TO_EXPANSION_FACTOR, MIB_MAX_BEACON_LESS_PERIOD, MIB_PING_SLOT_DATARATE
}
 
enum  LoRaMacStatus_t {
  LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID,
  LORAMAC_STATUS_FREQUENCY_INVALID, LORAMAC_STATUS_DATARATE_INVALID, LORAMAC_STATUS_FREQ_AND_DR_INVALID, LORAMAC_STATUS_NO_NETWORK_JOINED,
  LORAMAC_STATUS_LENGTH_ERROR, LORAMAC_STATUS_REGION_NOT_SUPPORTED, LORAMAC_STATUS_SKIPPED_APP_DATA, LORAMAC_STATUS_DUTYCYCLE_RESTRICTED,
  LORAMAC_STATUS_NO_CHANNEL_FOUND, LORAMAC_STATUS_NO_FREE_CHANNEL_FOUND, LORAMAC_STATUS_BUSY_BEACON_RESERVED_TIME, LORAMAC_STATUS_BUSY_PING_SLOT_WINDOW_TIME,
  LORAMAC_STATUS_BUSY_UPLINK_COLLISION, LORAMAC_STATUS_CRYPTO_ERROR, LORAMAC_STATUS_FCNT_HANDLER_ERROR, LORAMAC_STATUS_MAC_COMMAD_ERROR,
  LORAMAC_STATUS_CLASS_B_ERROR, LORAMAC_STATUS_CONFIRM_QUEUE_ERROR, LORAMAC_STATUS_MC_GROUP_UNDEFINED, LORAMAC_STATUS_ERROR
}
 

Functions

LoRaMacStatus_t LoRaMacInitialization (LoRaMacPrimitives_t *primitives, LoRaMacCallback_t *callbacks, LoRaMacRegion_t region)
 LoRaMAC layer initialization. More...
 
LoRaMacStatus_t LoRaMacStart (void)
 Starts LoRaMAC layer. More...
 
LoRaMacStatus_t LoRaMacStop (void)
 Stops LoRaMAC layer. More...
 
bool LoRaMacIsBusy (void)
 Returns a value indicating if the MAC layer is busy or not. More...
 
void LoRaMacProcess (void)
 
LoRaMacStatus_t LoRaMacQueryTxPossible (uint8_t size, LoRaMacTxInfo_t *txInfo)
 Queries the LoRaMAC if it is possible to send the next frame with a given application data payload size. The LoRaMAC takes scheduled MAC commands into account and reports, when the frame can be send or not. More...
 
LoRaMacStatus_t LoRaMacChannelAdd (uint8_t id, ChannelParams_t params)
 LoRaMAC channel add service. More...
 
LoRaMacStatus_t LoRaMacChannelRemove (uint8_t id)
 LoRaMAC channel remove service. More...
 
LoRaMacStatus_t LoRaMacMcChannelSetup (McChannelParams_t *channel)
 LoRaMAC multicast channel setup service. More...
 
LoRaMacStatus_t LoRaMacMcChannelDelete (AddressIdentifier_t groupID)
 LoRaMAC multicast channel removal service. More...
 
uint8_t LoRaMacMcChannelGetGroupId (uint32_t mcAddress)
 LoRaMAC multicast channel get groupId from MC address. More...
 
LoRaMacStatus_t LoRaMacMcChannelSetupRxParams (AddressIdentifier_t groupID, McRxParams_t *rxParams, uint8_t *status)
 LoRaMAC multicast channel Rx parameters setup service. More...
 
LoRaMacStatus_t LoRaMacMibGetRequestConfirm (MibRequestConfirm_t *mibGet)
 LoRaMAC MIB-Get. More...
 
LoRaMacStatus_t LoRaMacMibSetRequestConfirm (MibRequestConfirm_t *mibSet)
 LoRaMAC MIB-Set. More...
 
LoRaMacStatus_t LoRaMacMlmeRequest (MlmeReq_t *mlmeRequest)
 LoRaMAC MLME-Request. More...
 
LoRaMacStatus_t LoRaMacMcpsRequest (McpsReq_t *mcpsRequest)
 LoRaMAC MCPS-Request. More...
 
LoRaMacStatus_t LoRaMacDeInitialization (void)
 LoRaMAC deinitialization. More...
 

Detailed Description

This module specifies the API implementation of the LoRaMAC layer. This is a placeholder for a detailed description of the LoRaMac layer and the supported features.


Data Structure Documentation

◆ RxChannelParams_t

struct RxChannelParams_t

LoRaMAC receive window channel parameters

Data Fields
uint32_t Frequency

Frequency in Hz

uint8_t Datarate

Data rate

LoRaWAN Regional Parameters V1.0.2rB

The allowed ranges are region specific. Please refer to DR_0 to DR_15 for details.

◆ LoRaMacParams_t

struct LoRaMacParams_t

Global MAC layer parameters

Data Fields
uint32_t SystemMaxRxError

System overall timing error in milliseconds. [-SystemMaxRxError : +SystemMaxRxError] Default: +/-10 ms

uint8_t MinRxSymbols

Minimum required number of symbols to detect an Rx frame Default: 6 symbols

uint32_t MaxRxWindow

LoRaMac maximum time a reception window stays open

uint32_t ReceiveDelay1

Receive delay 1

uint32_t ReceiveDelay2

Receive delay 2

uint32_t JoinAcceptDelay1

Join accept delay 1

uint32_t JoinAcceptDelay2

Join accept delay 1

uint8_t ChannelsNbTrans

Number of uplink messages repetitions [1:15] (unconfirmed messages only)

uint8_t Rx1DrOffset

Datarate offset between uplink and downlink on first window

RxChannelParams_t Rx2Channel

LoRaMAC 2nd reception window settings

RxChannelParams_t RxCChannel

LoRaMAC continuous reception window settings

uint8_t UplinkDwellTime

Uplink dwell time configuration. 0: No limit, 1: 400ms

uint8_t DownlinkDwellTime

Downlink dwell time configuration. 0: No limit, 1: 400ms

float MaxEirp

Maximum possible EIRP

float AntennaGain

Antenna gain of the node

◆ PingSlotInfo_t

union PingSlotInfo_t

LoRaMAC data structure for a PingSlotInfoReq MLME_PING_SLOT_INFO

LoRaWAN Specification

Data Fields
uint8_t Value

Parameter for byte access

struct sInfoFields Fields

◆ BeaconInfo_t

struct BeaconInfo_t

LoRaMAC data structure for the MLME_BEACON MLME-Indication

LoRaWAN Specification

Data Fields
SysTime_t Time

Timestamp in seconds since 00:00:00, Sunday 6th of January 1980 (start of the GPS epoch) modulo 2^32

uint32_t Frequency

Frequency

uint8_t Datarate

Datarate

int16_t Rssi

RSSI

int8_t Snr

SNR

struct sGwSpecific GwSpecific

◆ LoRaMacFlags_t

union LoRaMacFlags_t

LoRaMac tx/rx operation state

Data Fields
uint8_t Value

Byte-access to the bits

struct sMacFlagBits Bits

◆ LoRaMacNvmDataGroup1_t

struct LoRaMacNvmDataGroup1_t
Data Fields
uint32_t AdrAckCounter

Counts the number of missed ADR acknowledgements

TimerTime_t LastTxDoneTime

Last transmission time.

TimerTime_t AggregatedTimeOff

Aggregated time off.

uint32_t LastRxMic

Last received Message integrity Code (MIC)

int8_t ChannelsTxPower

Channels TX power

int8_t ChannelsDatarate

Channels data rate

bool SrvAckRequested

If the server has sent a FRAME_TYPE_DATA_CONFIRMED_DOWN this variable indicates if the ACK bit must be set for the next transmission

uint32_t Crc32

CRC32 value of the MacGroup1 data structure.

◆ LoRaMacNvmDataGroup2_t

struct LoRaMacNvmDataGroup2_t
Data Fields
LoRaMacRegion_t Region
LoRaMacParams_t MacParams
LoRaMacParams_t MacParamsDefaults
int8_t ChannelsTxPowerDefault

Channels TX power

int8_t ChannelsDatarateDefault

Channels data rate

uint32_t NetID
uint32_t DevAddr
MulticastCtx_t MulticastChannelList[LORAMAC_MAX_MC_CTX]

Multicast channel list

DeviceClass_t DeviceClass
bool PublicNetwork
bool AdrCtrlOn
uint8_t MaxDCycle
bool DutyCycleOn
uint16_t AggregatedDCycle
SysTime_t InitializationTime
Version_t Version
ActivationType_t NetworkActivation
uint32_t Crc32

CRC32 value of the MacGroup2 data structure.

◆ LoRaMacNvmData_t

struct LoRaMacNvmData_t

LoRaMAC data structure for non-volatile memory (NVM). This structure contains data which must be stored in NVM.

Data Fields
LoRaMacCryptoNvmData_t Crypto

Parameters related to the crypto layer. Change with every TX/RX procedure.

LoRaMacNvmDataGroup1_t MacGroup1

Parameters related to the MAC which change with high probability after every TX/RX procedure.

LoRaMacNvmDataGroup2_t MacGroup2

Parameters related to the MAC which do not change very likely with every TX/RX procedure.

SecureElementNvmData_t SecureElement

Parameters related to the secure-element.

RegionNvmDataGroup1_t RegionGroup1

Parameters related to the regional implementation which change with high probability after every TX/RX procedure.

RegionNvmDataGroup2_t RegionGroup2

Parameters related to the regional implementation which do not change very likely with every TX/RX procedure.

LoRaMacClassBNvmData_t ClassB

Parameters related to class b.

◆ RequestReturnParam_t

struct RequestReturnParam_t

Structure which defines return parameters for requests.

Data Fields
TimerTime_t DutyCycleWaitTime

This value reports the time in milliseconds which an application must wait before its possible to send the next uplink.

◆ McpsReqUnconfirmed_t

struct McpsReqUnconfirmed_t

LoRaMAC MCPS-Request for an unconfirmed frame

Data Fields
uint8_t fPort

Frame port field. Must be set if the payload is not empty. Use the application specific frame port values: [1...223]

LoRaWAN Specification V1.0.2, chapter 4.3.2

void * fBuffer

Pointer to the buffer of the frame payload

uint16_t fBufferSize

Size of the frame payload

int8_t Datarate

Uplink datarate, if ADR is off

◆ McpsReqConfirmed_t

struct McpsReqConfirmed_t

LoRaMAC MCPS-Request for a confirmed frame

Data Fields
uint8_t fPort

Frame port field. Must be set if the payload is not empty. Use the application specific frame port values: [1...223]

LoRaWAN Specification V1.0.2, chapter 4.3.2

void * fBuffer

Pointer to the buffer of the frame payload

uint16_t fBufferSize

Size of the frame payload

int8_t Datarate

Uplink datarate, if ADR is off

uint8_t NbTrials

Number of trials to transmit the frame, if the LoRaMAC layer did not receive an acknowledgment. The MAC performs a datarate adaptation, according to the LoRaWAN Specification V1.0.2, chapter 18.4, according to the following table:

Transmission nb Data Rate
1 (first) DR
2 DR
3 max(DR-1,0)
4 max(DR-1,0)
5 max(DR-2,0)
6 max(DR-2,0)
7 max(DR-3,0)
8 max(DR-3,0)

Note, that if NbTrials is set to 1 or 2, the MAC will not decrease the datarate, in case the LoRaMAC layer did not receive an acknowledgment

◆ McpsReqProprietary_t

struct McpsReqProprietary_t

LoRaMAC MCPS-Request for a proprietary frame

Data Fields
void * fBuffer

Pointer to the buffer of the frame payload

uint16_t fBufferSize

Size of the frame payload

int8_t Datarate

Uplink datarate, if ADR is off

◆ McpsReq_t

◆ McpsConfirm_t

struct McpsConfirm_t

LoRaMAC MCPS-Confirm

Data Fields
Mcps_t McpsRequest

Holds the previously performed MCPS-Request

LoRaMacEventInfoStatus_t Status

Status of the operation

uint8_t Datarate

Uplink datarate

int8_t TxPower

Transmission power

bool AckReceived

Set if an acknowledgement was received

uint8_t NbRetries

Provides the number of retransmissions

TimerTime_t TxTimeOnAir

The transmission time on air of the frame

uint32_t UpLinkCounter

The uplink counter value related to the frame

uint32_t Channel

The uplink channel related to the frame

◆ McpsIndication_t

struct McpsIndication_t

LoRaMAC MCPS-Indication primitive

Data Fields
Mcps_t McpsIndication

MCPS-Indication type

LoRaMacEventInfoStatus_t Status

Status of the operation

uint8_t Multicast

Multicast

uint8_t Port

Application port

uint8_t RxDatarate

Downlink datarate

uint8_t FramePending

Frame pending status

uint8_t * Buffer

Pointer to the received data stream

uint8_t BufferSize

Size of the received data stream

bool RxData

Indicates, if data is available

int16_t Rssi

Rssi of the received packet

int8_t Snr

Snr of the received packet

LoRaMacRxSlot_t RxSlot

Receive window

bool AckReceived

Set if an acknowledgement was received

uint32_t DownLinkCounter

The downlink counter value for the received frame

uint32_t DevAddress

The device address of the frame

bool DeviceTimeAnsReceived

Set if a DeviceTimeAns MAC command was received.

◆ MlmeReqJoin_t

struct MlmeReqJoin_t

LoRaMAC MLME-Request for the join service

Data Fields
uint8_t Datarate

Datarate used for join request.

◆ MlmeReqTxCw_t

struct MlmeReqTxCw_t

LoRaMAC MLME-Request for Tx continuous wave mode

Data Fields
uint16_t Timeout

Time in seconds while the radio is kept in continuous wave mode

uint32_t Frequency

RF frequency to set (Only used with new way)

int8_t Power

RF output power to set (Only used with new way)

◆ MlmeReqPingSlotInfo_t

struct MlmeReqPingSlotInfo_t

LoRaMAC MLME-Request for the ping slot info service

Data Fields
PingSlotInfo_t PingSlot

◆ MlmeReqDeriveMcKEKey_t

struct MlmeReqDeriveMcKEKey_t

LoRaMAC MLME-Request to derive the McKEKey from the AppKey or NwkKey

Data Fields
KeyIdentifier_t KeyID

Key identifier of the root key to use to perform the derivation ( NwkKey or AppKey )

uint16_t Nonce

Nonce value ( nonce <= 15)

uint8_t * DevEUI

DevEUI Value

◆ MlmeReqDeriveMcSessionKeyPair_t

struct MlmeReqDeriveMcSessionKeyPair_t

LoRaMAC MLME-Request to derive a Multicast group key pair ( McAppSKey, McNwkSKey ) from McKey

Data Fields
AddressIdentifier_t GroupID

Address identifier to select the multicast group

◆ MlmeReq_t

◆ MlmeConfirm_t

struct MlmeConfirm_t

LoRaMAC MLME-Confirm primitive

Data Fields
Mlme_t MlmeRequest

Holds the previously performed MLME-Request

LoRaMacEventInfoStatus_t Status

Status of the operation

TimerTime_t TxTimeOnAir

The transmission time on air of the frame

uint8_t DemodMargin

Demodulation margin. Contains the link margin [dB] of the last successfully received LinkCheckReq

uint8_t NbGateways

Number of gateways which received the last LinkCheckReq

uint8_t NbRetries

Provides the number of retransmissions

TimerTime_t BeaconTimingDelay

The delay which we have received through the BeaconTimingAns

uint8_t BeaconTimingChannel

The channel of the next beacon

◆ MlmeIndication_t

struct MlmeIndication_t

LoRaMAC MLME-Indication primitive

Data Fields
Mlme_t MlmeIndication

MLME-Indication type

LoRaMacEventInfoStatus_t Status

Status of the operation

BeaconInfo_t BeaconInfo

Beacon information. Only valid for MLME_BEACON, status LORAMAC_EVENT_INFO_STATUS_BEACON_LOCKED

◆ MibParam_t

union MibParam_t

LoRaMAC MIB parameters

Data Fields
DeviceClass_t Class

LoRaWAN device class

Related MIB type: MIB_DEVICE_CLASS

ActivationType_t NetworkActivation

LoRaWAN Network End-Device Activation ( ACTIVATION_TYPE_NONE, ACTIVATION_TYPE_ABP or OTTA )

Related MIB type: MIB_NETWORK_ACTIVATION

uint8_t * DevEui

LoRaWAN device EUI

Related MIB type: MIB_DEV_EUI

uint8_t * JoinEui

LoRaWAN Join server EUI

Related MIB type: MIB_JOIN_EUI

uint8_t * SePin

Secure-element pin

Related MIB type: MIB_SE_PIN

bool AdrEnable

Activation state of ADR

Related MIB type: MIB_ADR

uint32_t NetID

Network identifier

Related MIB type: MIB_NET_ID

uint32_t DevAddr

End-device address

Related MIB type: MIB_DEV_ADDR

uint8_t * AppKey

Application root key

Related MIB type: MIB_APP_KEY

uint8_t * NwkKey

Network root key

Related MIB type: MIB_NWK_KEY

uint8_t * JSIntKey

Join session integrity key

Related MIB type: MIB_J_S_INT_KEY

uint8_t * JSEncKey

Join session encryption key

Related MIB type: MIB_J_S_ENC_KEY

uint8_t * FNwkSIntKey

Forwarding Network session integrity key

Related MIB type: MIB_F_NWK_S_INT_KEY

uint8_t * SNwkSIntKey

Serving Network session integrity key

Related MIB type: MIB_S_NWK_S_INT_KEY

uint8_t * NwkSEncKey

Network session encryption key

Related MIB type: MIB_NWK_S_ENC_KEY

uint8_t * AppSKey

Application session key

Related MIB type: MIB_APP_S_KEY

uint8_t * McKEKey

Multicast key encryption key

Related MIB type: MIB_MC_KE_KEY

uint8_t * McKey0

Multicast root key index 0

Related MIB type: MIB_MC_KEY_0

uint8_t * McAppSKey0

Multicast Application session key index 0

Related MIB type: MIB_MC_APP_S_KEY_0

uint8_t * McNwkSKey0

Multicast Network session key index 0

Related MIB type: MIB_MC_NWK_S_KEY_0

uint8_t * McKey1

Multicast root key index 0

Related MIB type: MIB_MC_KEY_0

uint8_t * McAppSKey1

Multicast Application session key index 1

Related MIB type: MIB_MC_APP_S_KEY_1

uint8_t * McNwkSKey1

Multicast Network session key index 1

Related MIB type: MIB_MC_NWK_S_KEY_1

uint8_t * McKey2

Multicast root key index 2

Related MIB type: MIB_MC_KEY_2

uint8_t * McAppSKey2

Multicast Application session key index 2

Related MIB type: MIB_MC_APP_S_KEY_2

uint8_t * McNwkSKey2

Multicast Network session key index 2

Related MIB type: MIB_MC_NWK_S_KEY_2

uint8_t * McKey3

Multicast root key index 2

Related MIB type: MIB_MC_KEY_2

uint8_t * McAppSKey3

Multicast Application session key index 2

Related MIB type: MIB_MC_APP_S_KEY_2

uint8_t * McNwkSKey3

Multicast Network session key index 2

Related MIB type: MIB_MC_NWK_S_KEY_2

bool EnablePublicNetwork

Enable or disable a public network

Related MIB type: MIB_PUBLIC_NETWORK

ChannelParams_t * ChannelList

LoRaWAN Channel

Related MIB type: MIB_CHANNELS

RxChannelParams_t Rx2Channel

Channel for the receive window 2

Related MIB type: MIB_RX2_CHANNEL

RxChannelParams_t Rx2DefaultChannel

Channel for the receive window 2

Related MIB type: MIB_RX2_DEFAULT_CHANNEL

RxChannelParams_t RxCChannel

Channel for the receive window C

Related MIB type: MIB_RXC_CHANNEL

RxChannelParams_t RxCDefaultChannel

Channel for the receive window C

Related MIB type: MIB_RXC_DEFAULT_CHANNEL

uint16_t * ChannelsMask

Channel mask

Related MIB type: MIB_CHANNELS_MASK

uint16_t * ChannelsDefaultMask

Default channel mask

Related MIB type: MIB_CHANNELS_DEFAULT_MASK

uint8_t ChannelsNbTrans

Number of frame repetitions

Related MIB type: MIB_CHANNELS_NB_TRANS

uint32_t MaxRxWindow

Maximum receive window duration

Related MIB type: MIB_MAX_RX_WINDOW_DURATION

uint32_t ReceiveDelay1

Receive delay 1

Related MIB type: MIB_RECEIVE_DELAY_1

uint32_t ReceiveDelay2

Receive delay 2

Related MIB type: MIB_RECEIVE_DELAY_2

uint32_t JoinAcceptDelay1

Join accept delay 1

Related MIB type: MIB_JOIN_ACCEPT_DELAY_1

uint32_t JoinAcceptDelay2

Join accept delay 2

Related MIB type: MIB_JOIN_ACCEPT_DELAY_2

int8_t ChannelsDefaultDatarate

Channels data rate

Related MIB type: MIB_CHANNELS_DEFAULT_DATARATE

int8_t ChannelsDatarate

Channels data rate

Related MIB type: MIB_CHANNELS_DATARATE

int8_t ChannelsDefaultTxPower

Channels TX power

Related MIB type: MIB_CHANNELS_DEFAULT_TX_POWER

int8_t ChannelsTxPower

Channels TX power

Related MIB type: MIB_CHANNELS_TX_POWER

McChannelParams_t MulticastChannel

Multicast channels

Related MIB type: MIB_MULTICAST_CHANNEL

uint32_t SystemMaxRxError

System overall timing error in milliseconds.

Related MIB type: MIB_SYSTEM_MAX_RX_ERROR

uint8_t MinRxSymbols

Minimum required number of symbols to detect an Rx frame

Related MIB type: MIB_MIN_RX_SYMBOLS

float AntennaGain

Antenna gain

Related MIB type: MIB_ANTENNA_GAIN

float DefaultAntennaGain

Default antenna gain

Related MIB type: MIB_DEFAULT_ANTENNA_GAIN

LoRaMacNvmData_t * Contexts

Returns a pointer to the structure holding all data which shall be stored in the NVM.

Related MIB type: MIB_NVM_CTXS

Version_t AbpLrWanVersion
struct sLrWanVersion LrWanVersion
uint32_t BeaconInterval

Beacon interval in ms

Related MIB type: MIB_BEACON_INTERVAL

uint32_t BeaconReserved

Beacon reserved time in ms

Related MIB type: MIB_BEACON_RESERVED

uint32_t BeaconGuard

Beacon guard time in ms

Related MIB type: MIB_BEACON_GUARD

uint32_t BeaconWindow

Beacon window time in ms

Related MIB type: MIB_BEACON_WINDOW

uint32_t BeaconWindowSlots

Beacon window time in number of slots

Related MIB type: MIB_BEACON_WINDOW_SLOTS

uint32_t PingSlotWindow

Ping slot length time in ms

Related MIB type: MIB_PING_SLOT_WINDOW

uint32_t BeaconSymbolToDefault

Default symbol timeout for beacons and ping slot windows

Related MIB type: MIB_BEACON_SYMBOL_TO_DEFAULT

uint32_t BeaconSymbolToExpansionMax

Maximum symbol timeout for beacons

Related MIB type: MIB_BEACON_SYMBOL_TO_EXPANSION_MAX

uint32_t PingSlotSymbolToExpansionMax

Maximum symbol timeout for ping slots

Related MIB type: MIB_PING_SLOT_SYMBOL_TO_EXPANSION_MAX

uint32_t BeaconSymbolToExpansionFactor

Symbol expansion value for beacon windows in case of beacon loss in symbols

Related MIB type: MIB_BEACON_SYMBOL_TO_EXPANSION_FACTOR

uint32_t PingSlotSymbolToExpansionFactor

Symbol expansion value for ping slot windows in case of beacon loss in symbols

Related MIB type: MIB_PING_SLOT_SYMBOL_TO_EXPANSION_FACTOR

uint32_t MaxBeaconLessPeriod

Maximum allowed beacon less time in ms

Related MIB type: MIB_MAX_BEACON_LESS_PERIOD

int8_t PingSlotDatarate

Ping slots data rate

Related MIB type: MIB_PING_SLOT_DATARATE

◆ MibRequestConfirm_t

struct MibRequestConfirm_t

LoRaMAC MIB-RequestConfirm structure

Examples
periodic-uplink-lpp/NAMote72/main.c.
Data Fields
Mib_t Type

MIB-Request type

MibParam_t Param

MLME-RequestConfirm parameters

◆ LoRaMacTxInfo_t

struct LoRaMacTxInfo_t

LoRaMAC tx information

Data Fields
uint8_t MaxPossibleApplicationDataSize

Size of the application data payload which can be transmitted.

uint8_t CurrentPossiblePayloadSize

The current maximum possible payload size without MAC commands which is dependent on the current datarate.

Macro Definition Documentation

◆ MAX_ACK_RETRIES

#define MAX_ACK_RETRIES   8

Maximum number of times the MAC layer tries to get an acknowledge.

◆ UP_LINK

#define UP_LINK   0

Frame direction definition for up-link communications

◆ DOWN_LINK

#define DOWN_LINK   1

Frame direction definition for down-link communications

◆ LORA_MAC_MLME_CONFIRM_QUEUE_LEN

#define LORA_MAC_MLME_CONFIRM_QUEUE_LEN   5

LoRaMac MLME-Confirm queue length

◆ LORAMAC_CRYPTO_MULTICAST_KEYS

#define LORAMAC_CRYPTO_MULTICAST_KEYS   127

Start value for multicast keys enumeration

◆ LORA_MAC_COMMAND_MAX_LENGTH

#define LORA_MAC_COMMAND_MAX_LENGTH   128

Maximum MAC commands buffer size

◆ LORAMAC_NVM_NOTIFY_FLAG_NONE

#define LORAMAC_NVM_NOTIFY_FLAG_NONE   0x00

Bitmap value

◆ LORAMAC_NVM_NOTIFY_FLAG_CRYPTO

#define LORAMAC_NVM_NOTIFY_FLAG_CRYPTO   0x01

Bitmap value for the NVM group crypto.

◆ LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP1

#define LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP1   0x02

Bitmap value for the NVM group MAC 1.

◆ LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP2

#define LORAMAC_NVM_NOTIFY_FLAG_MAC_GROUP2   0x04

Bitmap value for the NVM group MAC 2.

◆ LORAMAC_NVM_NOTIFY_FLAG_SECURE_ELEMENT

#define LORAMAC_NVM_NOTIFY_FLAG_SECURE_ELEMENT   0x08

Bitmap value for the NVM group secure element.

◆ LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP1

#define LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP1   0x10

Bitmap value for the NVM group 1 region.

◆ LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP2

#define LORAMAC_NVM_NOTIFY_FLAG_REGION_GROUP2   0x20

Bitmap value for the NVM group 2 region.

◆ LORAMAC_NVM_NOTIFY_FLAG_CLASS_B

#define LORAMAC_NVM_NOTIFY_FLAG_CLASS_B   0x40

Bitmap value for the NVM group class b.

Enumeration Type Documentation

◆ ActivationType_t

End-Device activation type

Enumerator
ACTIVATION_TYPE_NONE 

None

ACTIVATION_TYPE_ABP 

Activation By Personalization (ACTIVATION_TYPE_ABP)

ACTIVATION_TYPE_OTAA 

Over-The-Air Activation (ACTIVATION_TYPE_OTAA)

◆ LoRaMacRxSlot_t

LoRaMAC receive window enumeration

Enumerator
RX_SLOT_WIN_1 

LoRaMAC receive window 1

RX_SLOT_WIN_2 

LoRaMAC receive window 2

RX_SLOT_WIN_CLASS_C 

LoRaMAC receive window 2 for class c - continuous listening

RX_SLOT_WIN_CLASS_C_MULTICAST 

LoRaMAC class c multicast downlink

RX_SLOT_WIN_CLASS_B_PING_SLOT 

LoRaMAC class b ping slot window

RX_SLOT_WIN_CLASS_B_MULTICAST_SLOT 

LoRaMAC class b multicast slot window

RX_SLOT_NONE 

LoRaMAC no active receive window

◆ LoRaMacEventInfoStatus_t

Enumeration containing the status of the operation of a MAC service

Enumerator
LORAMAC_EVENT_INFO_STATUS_OK 

Service performed successfully

LORAMAC_EVENT_INFO_STATUS_ERROR 

An error occurred during the execution of the service

LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT 

A Tx timeout occurred

LORAMAC_EVENT_INFO_STATUS_RX1_TIMEOUT 

An Rx timeout occurred on receive window 1

LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT 

An Rx timeout occurred on receive window 2

LORAMAC_EVENT_INFO_STATUS_RX1_ERROR 

An Rx error occurred on receive window 1

LORAMAC_EVENT_INFO_STATUS_RX2_ERROR 

An Rx error occurred on receive window 2

LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL 

An error occurred in the join procedure

LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED 

A frame with an invalid downlink counter was received. The downlink counter of the frame was equal to the local copy of the downlink counter of the node.

LORAMAC_EVENT_INFO_STATUS_TX_DR_PAYLOAD_SIZE_ERROR 

The MAC could not retransmit a frame since the MAC decreased the datarate. The payload size is not applicable for the datarate.

LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOSS 

The node has lost MAX_FCNT_GAP or more frames.

LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL 

An address error occurred

LORAMAC_EVENT_INFO_STATUS_MIC_FAIL 

Message integrity check failure

LORAMAC_EVENT_INFO_STATUS_MULTICAST_FAIL 

ToDo

LORAMAC_EVENT_INFO_STATUS_BEACON_LOCKED 

ToDo

LORAMAC_EVENT_INFO_STATUS_BEACON_LOST 

ToDo

LORAMAC_EVENT_INFO_STATUS_BEACON_NOT_FOUND 

ToDo

◆ LoRaMacRegion_t

LoRaMAC region enumeration

Enumerator
LORAMAC_REGION_AS923 

AS band on 923MHz

LORAMAC_REGION_AU915 

Australian band on 915MHz

LORAMAC_REGION_CN470 

Chinese band on 470MHz

LORAMAC_REGION_CN779 

Chinese band on 779MHz

LORAMAC_REGION_EU433 

European band on 433MHz

LORAMAC_REGION_EU868 

European band on 868MHz

LORAMAC_REGION_KR920 

South korean band on 920MHz

LORAMAC_REGION_IN865 

India band on 865MHz

LORAMAC_REGION_US915 

North american band on 915MHz

LORAMAC_REGION_RU864 

Russia band on 864MHz

◆ Mcps_t

enum Mcps_t

LoRaMAC data services.

The following table list the primitives which are supported by the specific MAC data service:

Name Request Indication Response Confirm
MCPS_UNCONFIRMED YES YES NO YES
MCPS_CONFIRMED YES YES NO YES
MCPS_MULTICAST NO YES NO NO
MCPS_PROPRIETARY YES YES NO YES

The following table provides links to the function implementations of the related MCPS primitives:

Primitive Function
MCPS-Request LoRaMacMlmeRequest
MCPS-Confirm MacMcpsConfirm in LoRaMacPrimitives_t
MCPS-Indication MacMcpsIndication in LoRaMacPrimitives_t
Enumerator
MCPS_UNCONFIRMED 

Unconfirmed LoRaMAC frame

MCPS_CONFIRMED 

Confirmed LoRaMAC frame

MCPS_MULTICAST 

Multicast LoRaMAC frame

MCPS_PROPRIETARY 

Proprietary frame

◆ Mlme_t

enum Mlme_t

LoRaMAC management services.

The following table list the primitives which are supported by the specific MAC management service:

Name Request Indication Response Confirm
MLME_JOIN YES NO NO YES
MLME_LINK_CHECK YES NO NO YES
MLME_TXCW YES NO NO YES
MLME_SCHEDULE_UPLINK NO YES NO NO
MLME_DERIVE_MC_KE_KEY YES NO NO YES
MLME_DERIVE_MC_KEY_PAIR YES NO NO YES

The following table provides links to the function implementations of the related MLME primitives.

Primitive Function
MLME-Request LoRaMacMlmeRequest
MLME-Confirm MacMlmeConfirm in LoRaMacPrimitives_t
MLME-Indication MacMlmeIndication in LoRaMacPrimitives_t
Enumerator
MLME_UNKNOWN 

An unknown MLME service

MLME_JOIN 

Initiates the Over-the-Air activation

LoRaWAN Specification V1.0.2, chapter 6.2

MLME_REJOIN_0 

Initiates sending a ReJoin-request type 0

LoRaWAN Specification V1.1.0, chapter 6.2.4.1

MLME_REJOIN_1 

Initiates sending a ReJoin-request type 1

LoRaWAN Specification V1.1.0, chapter 6.2.4.2

MLME_LINK_CHECK 

LinkCheckReq - Connectivity validation

LoRaWAN Specification V1.0.2, chapter 5, table 4

MLME_TXCW 

Sets Tx continuous wave mode

LoRaWAN end-device certification

MLME_TXCW_1 

Sets Tx continuous wave mode (new LoRa-Alliance CC definition)

LoRaWAN end-device certification

MLME_SCHEDULE_UPLINK 

Indicates that the application shall perform an uplink as soon as possible.

MLME_DERIVE_MC_KE_KEY 

Derives the McKEKey from the AppKey or NwkKey.

MLME_DERIVE_MC_KEY_PAIR 

Derives a Multicast group key pair ( McAppSKey, McNwkSKey ) from McKey

MLME_DEVICE_TIME 

Initiates a DeviceTimeReq

LoRaWAN end-device certification

MLME_BEACON 

The MAC uses this MLME primitive to indicate a beacon reception status.

LoRaWAN end-device certification

MLME_BEACON_ACQUISITION 

Initiate a beacon acquisition. The MAC will search for a beacon. It will search for XX_BEACON_INTERVAL milliseconds.

LoRaWAN end-device certification

MLME_PING_SLOT_INFO 

Initiates a PingSlotInfoReq

LoRaWAN end-device certification

MLME_BEACON_TIMING 

Initiates a BeaconTimingReq

LoRaWAN end-device certification

MLME_BEACON_LOST 

Primitive which indicates that the beacon has been lost

Remarks
The upper layer is required to switch the device class to ClassA

LoRaWAN end-device certification

◆ Mib_t

enum Mib_t

LoRa Mac Information Base (MIB)

The following table lists the MIB parameters and the related attributes:

Attribute Get Set
MIB_DEVICE_CLASS YES YES
MIB_NETWORK_ACTIVATION YES YES
MIB_DEV_EUI YES YES
MIB_JOIN_EUI YES YES
MIB_SE_PIN YES YES
MIB_ADR YES YES
MIB_NET_ID YES YES
MIB_DEV_ADDR YES YES
MIB_APP_KEY NO YES
MIB_NWK_KEY NO YES
MIB_J_S_INT_KEY NO YES
MIB_J_S_ENC_KEY NO YES
MIB_F_NWK_S_INT_KEY NO YES
MIB_S_NWK_S_INT_KEY NO YES
MIB_NWK_S_ENC_KEY NO YES
MIB_APP_S_KEY NO YES
MIB_MC_KE_KEY NO YES
MIB_MC_KEY_0 NO YES
MIB_MC_APP_S_KEY_0 NO YES
MIB_MC_NWK_S_KEY_0 NO YES
MIB_MC_KEY_1 NO YES
MIB_MC_APP_S_KEY_1 NO YES
MIB_MC_NWK_S_KEY_1 NO YES
MIB_MC_KEY_2 NO YES
MIB_MC_APP_S_KEY_2 NO YES
MIB_MC_NWK_S_KEY_2 NO YES
MIB_MC_KEY_3 NO YES
MIB_MC_APP_S_KEY_3 NO YES
MIB_MC_NWK_S_KEY_3 NO YES
MIB_PUBLIC_NETWORK YES YES
MIB_CHANNELS YES NO
MIB_RX2_CHANNEL YES YES
MIB_RX2_DFAULT_CHANNEL YES YES
MIB_RXC_CHANNEL YES YES
MIB_RXC_DFAULT_CHANNEL YES YES
MIB_CHANNELS_MASK YES YES
MIB_CHANNELS_DEFAULT_MASK YES YES
MIB_CHANNELS_NB_TRANS YES YES
MIB_MAX_RX_WINDOW_DURATION YES YES
MIB_RECEIVE_DELAY_1 YES YES
MIB_RECEIVE_DELAY_2 YES YES
MIB_JOIN_ACCEPT_DELAY_1 YES YES
MIB_JOIN_ACCEPT_DELAY_2 YES YES
MIB_CHANNELS_DATARATE YES YES
MIB_CHANNELS_DEFAULT_DATARATE YES YES
MIB_CHANNELS_TX_POWER YES YES
MIB_CHANNELS_DEFAULT_TX_POWER YES YES
MIB_SYSTEM_MAX_RX_ERROR YES YES
MIB_MIN_RX_SYMBOLS YES YES
MIB_BEACON_INTERVAL YES YES
MIB_BEACON_RESERVED YES YES
MIB_BEACON_GUARD YES YES
MIB_BEACON_WINDOW YES YES
MIB_BEACON_WINDOW_SLOTS YES YES
MIB_PING_SLOT_WINDOW YES YES
MIB_BEACON_SYMBOL_TO_DEFAULT YES YES
MIB_BEACON_SYMBOL_TO_EXPANSION_MAX YES YES
MIB_PING_SLOT_SYMBOL_TO_EXPANSION_MAX YES YES
MIB_BEACON_SYMBOL_TO_EXPANSION_FACTOR YES YES
MIB_PING_SLOT_SYMBOL_TO_EXPANSION_FACTOR YES YES
MIB_MAX_BEACON_LESS_PERIOD YES YES
MIB_ANTENNA_GAIN YES YES
MIB_DEFAULT_ANTENNA_GAIN YES YES
MIB_NVM_CTXS YES YES
MIB_ABP_LORAWAN_VERSION NO YES
MIB_LORAWAN_VERSION YES NO

The following table provides links to the function implementations of the related MIB primitives:

Primitive Function
MIB-Set LoRaMacMibSetRequestConfirm
MIB-Get LoRaMacMibGetRequestConfirm
Enumerator
MIB_DEVICE_CLASS 

LoRaWAN device class

LoRaWAN Specification V1.0.2

MIB_NETWORK_ACTIVATION 

LoRaWAN Network End-Device Activation

LoRaWAN Specification V1.0.2

MIB_DEV_EUI 

LoRaWAN device EUI

LoRaWAN Specification V1.0.2

MIB_JOIN_EUI 

LoRaWAN join EUI

LoRaWAN Specification V1.0.2

MIB_SE_PIN 

Secure-element pin

MIB_ADR 

Adaptive data rate

LoRaWAN Specification V1.0.2, chapter 4.3.1.1

[true: ADR enabled, false: ADR disabled]

MIB_NET_ID 

Network identifier

LoRaWAN Specification V1.0.2, chapter 6.1.1

MIB_DEV_ADDR 

End-device address

LoRaWAN Specification V1.0.2, chapter 6.1.1

MIB_APP_KEY 

Application root key

LoRaWAN Specification V1.1.0, chapter 6.1.1.3

MIB_NWK_KEY 

Network root key

LoRaWAN Specification V1.1.0, chapter 6.1.1.3

MIB_J_S_INT_KEY 

Join session integrity key

LoRaWAN Specification V1.1.0, chapter 6.1.1.4

MIB_J_S_ENC_KEY 

Join session encryption key

LoRaWAN Specification V1.1.0, chapter 6.1.1.4

MIB_F_NWK_S_INT_KEY 

Forwarding Network session integrity key

LoRaWAN Specification V1.1.0, chapter 6.1.2.2

MIB_S_NWK_S_INT_KEY 

Serving Network session integrity key

LoRaWAN Specification V1.1.0, chapter 6.1.2.3

MIB_NWK_S_ENC_KEY 

Network session encryption key

LoRaWAN Specification V1.1.0, chapter 6.1.2.4

MIB_APP_S_KEY 

Application session key

LoRaWAN Specification V1.1.0, chapter 6.1.1.3

MIB_MC_KE_KEY 

Multicast key encryption key

LoRaWAN - Secure element specification v1

MIB_MC_KEY_0 

Multicast root key index 0

LoRaWAN - Secure element specification v1

MIB_MC_APP_S_KEY_0 

Multicast Application session key index 0

LoRaWAN - Secure element specification v1

MIB_MC_NWK_S_KEY_0 

Multicast Network session key index 0

LoRaWAN - Secure element specification v1

MIB_MC_KEY_1 

Multicast root key index 1

LoRaWAN - Secure element specification v1

MIB_MC_APP_S_KEY_1 

Multicast Application session key index 1

LoRaWAN - Secure element specification v1

MIB_MC_NWK_S_KEY_1 

Multicast Network session key index 1

LoRaWAN - Secure element specification v1

MIB_MC_KEY_2 

Multicast root key index 2

LoRaWAN - Secure element specification v1

MIB_MC_APP_S_KEY_2 

Multicast Application session key index 2

LoRaWAN - Secure element specification v1

MIB_MC_NWK_S_KEY_2 

Multicast Network session key index 2

LoRaWAN - Secure element specification v1

MIB_MC_KEY_3 

Multicast root key index 3

LoRaWAN - Secure element specification v1

MIB_MC_APP_S_KEY_3 

Multicast Application session key index 3

LoRaWAN - Secure element specification v1

MIB_MC_NWK_S_KEY_3 

Multicast Network session key index 3

LoRaWAN - Secure element specification v1

MIB_PUBLIC_NETWORK 

Set the network type to public or private

LoRaWAN Regional Parameters V1.0.2rB

[true: public network, false: private network]

MIB_CHANNELS 

Communication channels. A get request will return a pointer which references the first entry of the channel list. The list is of size LORA_MAX_NB_CHANNELS

LoRaWAN Regional Parameters V1.0.2rB

MIB_RX2_CHANNEL 

Set receive window 2 channel

LoRaWAN Specification V1.0.2, chapter 3.3.1

MIB_RX2_DEFAULT_CHANNEL 

Set receive window 2 channel

LoRaWAN Specification V1.0.2, chapter 3.3.2

MIB_RXC_CHANNEL 

Set receive window C channel

LoRaWAN Specification V1.0.2, chapter 3.3.1

MIB_RXC_DEFAULT_CHANNEL 

Set receive window C channel

LoRaWAN Specification V1.0.2, chapter 3.3.2

MIB_CHANNELS_MASK 

LoRaWAN channels mask

LoRaWAN Regional Parameters V1.0.2rB

MIB_CHANNELS_DEFAULT_MASK 

LoRaWAN default channels mask

LoRaWAN Regional Parameters V1.0.2rB

MIB_CHANNELS_NB_TRANS 

Set the number of repetitions on a channel

LoRaWAN Specification V1.0.2, chapter 5.2

MIB_MAX_RX_WINDOW_DURATION 

Maximum receive window duration in [ms]

LoRaWAN Specification V1.0.2, chapter 3.3.3

MIB_RECEIVE_DELAY_1 

Receive delay 1 in [ms]

LoRaWAN Regional Parameters V1.0.2rB

MIB_RECEIVE_DELAY_2 

Receive delay 2 in [ms]

LoRaWAN Regional Parameters V1.0.2rB

MIB_JOIN_ACCEPT_DELAY_1 

Join accept delay 1 in [ms]

LoRaWAN Regional Parameters V1.0.2rB

MIB_JOIN_ACCEPT_DELAY_2 

Join accept delay 2 in [ms]

LoRaWAN Regional Parameters V1.0.2rB

MIB_CHANNELS_DEFAULT_DATARATE 

Default Data rate of a channel

LoRaWAN Regional Parameters V1.0.2rB

The allowed ranges are region specific. Please refer to DR_0 to DR_15 for details.

MIB_CHANNELS_DATARATE 

Data rate of a channel

LoRaWAN Regional Parameters V1.0.2rB

The allowed ranges are region specific. Please refer to DR_0 to DR_15 for details.

MIB_CHANNELS_TX_POWER 

Transmission power of a channel

LoRaWAN Regional Parameters V1.0.2rB

The allowed ranges are region specific. Please refer to TX_POWER_0 to TX_POWER_15 for details.

MIB_CHANNELS_DEFAULT_TX_POWER 

Transmission power of a channel

LoRaWAN Regional Parameters V1.0.2rB

The allowed ranges are region specific. Please refer to TX_POWER_0 to TX_POWER_15 for details.

MIB_SYSTEM_MAX_RX_ERROR 

System overall timing error in milliseconds. [-SystemMaxRxError : +SystemMaxRxError] Default: +/-10 ms

MIB_MIN_RX_SYMBOLS 

Minimum required number of symbols to detect an Rx frame Default: 6 symbols

MIB_ANTENNA_GAIN 

Antenna gain of the node. Default value is region specific. The antenna gain is used to calculate the TX power of the node. The formula is: radioTxPower = ( int8_t )floor( maxEirp - antennaGain )

Remarks
The antenna gain value is referenced to the isotropic antenna. The value is in dBi. MIB_ANTENNA_GAIN[dBi] = measuredAntennaGain[dBd] + 2.15
MIB_DEFAULT_ANTENNA_GAIN 

Default antenna gain of the node. Default value is region specific. The antenna gain is used to calculate the TX power of the node. The formula is: radioTxPower = ( int8_t )floor( maxEirp - antennaGain )

Remarks
The antenna gain value is referenced to the isotropic antenna. The value is in dBi. MIB_DEFAULT_ANTENNA_GAIN[dBi] = measuredAntennaGain[dBd] + 2.15
MIB_NVM_CTXS 

Structure holding pointers to internal contexts and its size

MIB_ABP_LORAWAN_VERSION 

LoRaWAN MAC layer operating version when activated by ABP.

MIB_LORAWAN_VERSION 

LoRaWAN MAC and regional parameter version.

MIB_BEACON_INTERVAL 

Beacon interval in ms

MIB_BEACON_RESERVED 

Beacon reserved time in ms

MIB_BEACON_GUARD 

Beacon guard time in ms

MIB_BEACON_WINDOW 

Beacon window time in ms

MIB_BEACON_WINDOW_SLOTS 

Beacon window time in number of slots

MIB_PING_SLOT_WINDOW 

Ping slot length time in ms

MIB_BEACON_SYMBOL_TO_DEFAULT 

Default symbol timeout for beacons and ping slot windows

MIB_BEACON_SYMBOL_TO_EXPANSION_MAX 

Maximum symbol timeout for beacons

MIB_PING_SLOT_SYMBOL_TO_EXPANSION_MAX 

Maximum symbol timeout for ping slots

MIB_BEACON_SYMBOL_TO_EXPANSION_FACTOR 

Symbol expansion value for beacon windows in case of beacon loss in symbols

MIB_PING_SLOT_SYMBOL_TO_EXPANSION_FACTOR 

Symbol expansion value for ping slot windows in case of beacon loss in symbols

MIB_MAX_BEACON_LESS_PERIOD 

Maximum allowed beacon less time in ms

MIB_PING_SLOT_DATARATE 

Ping slot data rate

LoRaWAN Regional Parameters V1.0.2rB

The allowed ranges are region specific. Please refer to DR_0 to DR_15 for details.

◆ LoRaMacStatus_t

LoRaMAC Status

Enumerator
LORAMAC_STATUS_OK 

Service started successfully

LORAMAC_STATUS_BUSY 

Service not started - LoRaMAC is busy

LORAMAC_STATUS_SERVICE_UNKNOWN 

Service unknown

LORAMAC_STATUS_PARAMETER_INVALID 

Service not started - invalid parameter

LORAMAC_STATUS_FREQUENCY_INVALID 

Service not started - invalid frequency

LORAMAC_STATUS_DATARATE_INVALID 

Service not started - invalid datarate

LORAMAC_STATUS_FREQ_AND_DR_INVALID 

Service not started - invalid frequency and datarate

LORAMAC_STATUS_NO_NETWORK_JOINED 

Service not started - the device is not in a LoRaWAN

LORAMAC_STATUS_LENGTH_ERROR 

Service not started - payload length error

LORAMAC_STATUS_REGION_NOT_SUPPORTED 

Service not started - the specified region is not supported or not activated with preprocessor definitions.

LORAMAC_STATUS_SKIPPED_APP_DATA 

The application data was not transmitted because prioritized pending MAC commands had to be sent.

LORAMAC_STATUS_DUTYCYCLE_RESTRICTED 

An MCPS or MLME request can return this status. In this case, the MAC cannot send the frame, as the duty cycle limits all available bands. When a request returns this value, the variable "DutyCycleWaitTime" in "ReqReturn" of the input parameters contains the remaining time to wait. If the value is constant and does not change, the expected time on air for this frame is exceeding the maximum permitted time according to the duty cycle time period, defined in Region.h, DUTY_CYCLE_TIME_PERIOD. By default this time is 1 hour, and a band with 1% duty cycle is then allowed to use an air time of 36 seconds.

LORAMAC_STATUS_BUSY_BEACON_RESERVED_TIME 

ToDo

LORAMAC_STATUS_BUSY_PING_SLOT_WINDOW_TIME 

ToDo

LORAMAC_STATUS_BUSY_UPLINK_COLLISION 

ToDo

LORAMAC_STATUS_CRYPTO_ERROR 

An error in the cryptographic module is occurred

LORAMAC_STATUS_FCNT_HANDLER_ERROR 

An error in the frame counter handler module is occurred

LORAMAC_STATUS_MAC_COMMAD_ERROR 

An error in the MAC command module is occurred

LORAMAC_STATUS_CLASS_B_ERROR 

An error in the Class B module is occurred

LORAMAC_STATUS_CONFIRM_QUEUE_ERROR 

An error in the Confirm Queue module is occurred

LORAMAC_STATUS_MC_GROUP_UNDEFINED 

The multicast group doesn't exist

LORAMAC_STATUS_ERROR 

Undefined error occurred

Function Documentation

◆ LoRaMacInitialization()

LoRaMacStatus_t LoRaMacInitialization ( LoRaMacPrimitives_t primitives,
LoRaMacCallback_t callbacks,
LoRaMacRegion_t  region 
)

LoRaMAC layer initialization.

In addition to the initialization of the LoRaMAC layer, this function initializes the callback primitives of the MCPS and MLME services. Every data field of LoRaMacPrimitives_t must be set to a valid callback function.

Parameters
[IN]primitives - Pointer to a structure defining the LoRaMAC event functions. Refer to LoRaMacPrimitives_t.
[IN]callbacks - Pointer to a structure defining the LoRaMAC callback functions. Refer to LoRaMacCallback_t.
[IN]region - The region to start.
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_PARAMETER_INVALID, LORAMAC_STATUS_REGION_NOT_SUPPORTED.

◆ LoRaMacStart()

LoRaMacStatus_t LoRaMacStart ( void  )

Starts LoRaMAC layer.

Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: returns are: LORAMAC_STATUS_OK,

◆ LoRaMacStop()

LoRaMacStatus_t LoRaMacStop ( void  )

Stops LoRaMAC layer.

Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: returns are: LORAMAC_STATUS_OK,

◆ LoRaMacIsBusy()

bool LoRaMacIsBusy ( void  )

Returns a value indicating if the MAC layer is busy or not.

Return values
isBusyMac layer is busy.

◆ LoRaMacProcess()

void LoRaMacProcess ( void  )

Processes the LoRaMac events.

Remarks
This function must be called in the main loop.

◆ LoRaMacQueryTxPossible()

LoRaMacStatus_t LoRaMacQueryTxPossible ( uint8_t  size,
LoRaMacTxInfo_t txInfo 
)

Queries the LoRaMAC if it is possible to send the next frame with a given application data payload size. The LoRaMAC takes scheduled MAC commands into account and reports, when the frame can be send or not.

Parameters
[IN]size - Size of application data payload to be send next
[OUT]txInfo - The structure LoRaMacTxInfo_t contains information about the actual maximum payload possible ( according to the configured datarate or the next datarate according to ADR ), and the maximum frame size, taking the scheduled MAC commands into account.
Return values
LoRaMacStatus_tStatus of the operation. When the parameters are not valid, the function returns LORAMAC_STATUS_PARAMETER_INVALID. In case of a length error caused by the application data payload in combination with the MAC commands, the function returns LORAMAC_STATUS_LENGTH_ERROR. In this case its recommended to send a frame without application data to flush the MAC commands. Otherwise the LoRaMAC will prioritize the MAC commands and if needed it will skip the application data. Please note that if MAC commands do not fit at all into the payload size on the related datarate, the LoRaMAC will automatically clip the MAC commands. In case the query is valid, and the LoRaMAC is able to send the frame, the function returns LORAMAC_STATUS_OK.

◆ LoRaMacChannelAdd()

LoRaMacStatus_t LoRaMacChannelAdd ( uint8_t  id,
ChannelParams_t  params 
)

LoRaMAC channel add service.

Adds a new channel to the channel list and activates the id in the channel mask. Please note that this functionality is not available on all regions. Information about allowed ranges are available at the LoRaWAN Regional Parameters V1.0.2rB

Parameters
[IN]id - Id of the channel.
[IN]params - Channel parameters to set.
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_PARAMETER_INVALID.

◆ LoRaMacChannelRemove()

LoRaMacStatus_t LoRaMacChannelRemove ( uint8_t  id)

LoRaMAC channel remove service.

Deactivates the id in the channel mask.

Parameters
[IN]id - Id of the channel.
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_PARAMETER_INVALID.

◆ LoRaMacMcChannelSetup()

LoRaMacStatus_t LoRaMacMcChannelSetup ( McChannelParams_t channel)

LoRaMAC multicast channel setup service.

Sets up a multicast channel.

Parameters
[IN]channel - Multicast channel to set.
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_PARAMETER_INVALID, LORAMAC_STATUS_MC_GROUP_UNDEFINED.

◆ LoRaMacMcChannelDelete()

LoRaMacStatus_t LoRaMacMcChannelDelete ( AddressIdentifier_t  groupID)

LoRaMAC multicast channel removal service.

Removes/Disables a multicast channel.

Parameters
[IN]groupID - Multicast channel ID to be removed/disabled
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_MC_GROUP_UNDEFINED.

◆ LoRaMacMcChannelGetGroupId()

uint8_t LoRaMacMcChannelGetGroupId ( uint32_t  mcAddress)

LoRaMAC multicast channel get groupId from MC address.

Parameters
[IN]mcAddress - Multicast address to be checked
Return values
groupIDMulticast channel ID associated to the address. Returns 0xFF if the address isn't found.

◆ LoRaMacMcChannelSetupRxParams()

LoRaMacStatus_t LoRaMacMcChannelSetupRxParams ( AddressIdentifier_t  groupID,
McRxParams_t rxParams,
uint8_t *  status 
)

LoRaMAC multicast channel Rx parameters setup service.

Sets up a multicast channel reception parameters.

Parameters
[IN]groupID - Multicast channel ID
[IN]rxParams - Reception parameters
[OUT]status - Status mask [UNDEF_ID | FREQ_ERR | DR_ERR | GROUP_ID]
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_PARAMETER_INVALID, LORAMAC_STATUS_MC_GROUP_UNDEFINED.

◆ LoRaMacMibGetRequestConfirm()

LoRaMacStatus_t LoRaMacMibGetRequestConfirm ( MibRequestConfirm_t mibGet)

LoRaMAC MIB-Get.

The mac information base service to get attributes of the LoRaMac layer.

The following code-snippet shows how to use the API to get the parameter AdrEnable, defined by the enumeration type MIB_ADR.

mibReq.Type = MIB_ADR;
{
// LoRaMAC updated the parameter mibParam.AdrEnable
}
Parameters
[IN]mibRequest - MIB-GET-Request to perform. Refer to MibRequestConfirm_t.
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID.
Examples
periodic-uplink-lpp/NAMote72/main.c.

◆ LoRaMacMibSetRequestConfirm()

LoRaMacStatus_t LoRaMacMibSetRequestConfirm ( MibRequestConfirm_t mibSet)

LoRaMAC MIB-Set.

The mac information base service to set attributes of the LoRaMac layer.

The following code-snippet shows how to use the API to set the parameter AdrEnable, defined by the enumeration type MIB_ADR.

mibReq.Type = MIB_ADR;
mibReq.Param.AdrEnable = true;
{
// LoRaMAC updated the parameter
}
Parameters
[IN]mibRequest - MIB-SET-Request to perform. Refer to MibRequestConfirm_t.
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID.
Examples
periodic-uplink-lpp/NAMote72/main.c.

◆ LoRaMacMlmeRequest()

LoRaMacStatus_t LoRaMacMlmeRequest ( MlmeReq_t mlmeRequest)

LoRaMAC MLME-Request.

The Mac layer management entity handles management services. The following code-snippet shows how to use the API to perform a network join request. Please note that for a join request, the DevEUI and the JoinEUI must be set previously via the MIB. Please also refer to the sample implementations.

MlmeReq_t mlmeReq;
mlmeReq.Type = MLME_JOIN;
mlmeReq.Req.Join.Datarate = LORAWAN_DEFAULT_DATARATE;
{
// Service started successfully. Waiting for the Mlme-Confirm event
}
Parameters
[IN]mlmeRequest - MLME-Request to perform. Refer to MlmeReq_t.
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID, LORAMAC_STATUS_NO_NETWORK_JOINED, LORAMAC_STATUS_LENGTH_ERROR,

◆ LoRaMacMcpsRequest()

LoRaMacStatus_t LoRaMacMcpsRequest ( McpsReq_t mcpsRequest)

LoRaMAC MCPS-Request.

The Mac Common Part Sublayer handles data services. The following code-snippet shows how to use the API to send an unconfirmed LoRaMAC frame.

uint8_t myBuffer[] = { 1, 2, 3 };
McpsReq_t mcpsReq;
mcpsReq.Req.Unconfirmed.fPort = 1;
mcpsReq.Req.Unconfirmed.fBuffer = myBuffer;
mcpsReq.Req.Unconfirmed.fBufferSize = sizeof( myBuffer );
{
// Service started successfully. Waiting for the MCPS-Confirm event
}
Parameters
[IN]mcpsRequest - MCPS-Request to perform. Refer to McpsReq_t.
Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID, LORAMAC_STATUS_NO_NETWORK_JOINED, LORAMAC_STATUS_LENGTH_ERROR,

◆ LoRaMacDeInitialization()

LoRaMacStatus_t LoRaMacDeInitialization ( void  )

LoRaMAC deinitialization.

This function stops the timers, re-initializes MAC & regional parameters to default and sets radio into sleep state.

Return values
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY
McpsReq_t::Type
Mcps_t Type
Definition: LoRaMac.h:853
LoRaMacMcpsRequest
LoRaMacStatus_t LoRaMacMcpsRequest(McpsReq_t *mcpsRequest)
LoRaMAC MCPS-Request.
MCPS_UNCONFIRMED
Definition: LoRaMac.h:725
MlmeReqJoin_t::Datarate
uint8_t Datarate
Definition: LoRaMac.h:1123
MIB_ADR
Definition: LoRaMac.h:1406
MibRequestConfirm_t::Type
Mib_t Type
Definition: LoRaMac.h:2200
MibRequestConfirm_t::Param
MibParam_t Param
Definition: LoRaMac.h:2205
MlmeReq_t
Definition: LoRaMac.h:1186
MlmeReq_t::uMlmeParam::Join
MlmeReqJoin_t Join
Definition: LoRaMac.h:1201
MlmeReq_t::Type
Mlme_t Type
Definition: LoRaMac.h:1191
MibRequestConfirm_t
Definition: LoRaMac.h:2195
MLME_JOIN
Definition: LoRaMac.h:1029
McpsReqUnconfirmed_t::fBuffer
void * fBuffer
Definition: LoRaMac.h:768
McpsReqUnconfirmed_t::fPort
uint8_t fPort
Definition: LoRaMac.h:764
MibParam_t::AdrEnable
bool AdrEnable
Definition: LoRaMac.h:1810
McpsReqUnconfirmed_t::fBufferSize
uint16_t fBufferSize
Definition: LoRaMac.h:772
LoRaMacMlmeRequest
LoRaMacStatus_t LoRaMacMlmeRequest(MlmeReq_t *mlmeRequest)
LoRaMAC MLME-Request.
LORAMAC_STATUS_OK
Definition: LoRaMac.h:2232
LoRaMacMibGetRequestConfirm
LoRaMacStatus_t LoRaMacMibGetRequestConfirm(MibRequestConfirm_t *mibGet)
LoRaMAC MIB-Get.
McpsReq_t::uMcpsParam::Unconfirmed
McpsReqUnconfirmed_t Unconfirmed
Definition: LoRaMac.h:863
McpsReq_t
Definition: LoRaMac.h:848