2 - Sending Messages

Messages sent from an end device to a network server via one or more nearby gateways are referred to as uplinks.

In this book, you learn the rules and best practices to follow when sending uplinks from your end device using the LoRaWAN® 1.0.4 specification.

Sending MAC Commands

MAC commands are used for efficient network management. The LoRaWAN® specification defines a total of 13 types of MAC commands, which consist of both request and corresponding answer commands. The end device can initiate 3 request commands in total, described in this chapter. There are a further ten request commands that the network server initiates, described in the section Handling MAC Commands of the Receiving Messages Book. The end device may be required to respond to the network server’s request MAC commands with the corresponding answer command, as outlined in this chapter.

MAC commands can be sent individually or in a group of concurrent MAC commands. All MAC commands begin with a single octet containing a Command Identifier (CID). This CID indicates which MAC command type follows in the subsequent octets. The length of the subsequent octets depends on the type of MAC command, as identified in the preceding CID. MAC commands are transmitted using the same method, regardless of whether they are a request or answer.

The diagram below shows the structure of three different MAC command requests and illustrates how each command can have a different length. As mentioned, all MAC commands start with a CID octet. The LinkCheckReq MAC command contains only the CID octet and has no payload. DutyCycleReq contains two octets in total, the CID octet followed by a single octet containing data related to the request. LinkADRReq has a total of five octets, the CID octet followed by four octets containing the data.

Example-Request-MAC-Commands

Figure 1: Structure of the LinkCheckReq , DutyCycleReq, and LinkADRReq MAC Commands

After the end device initiates a MAC command request, the network server sends back a corresponding answer. The answer will be received in the first or second receive windows (RX1 or RX2) immediately following the request. If the answer is not received, the end device should employ a retry mechanism to resend the original request. The processing of MAC Command answers is explained in the section Handling MAC Commands .

The diagram below shows the structure of the three different MAC command answers. LinkCheckAns contains the CID octet, followed by two octets that contain the data requested. DutyCycleAns contains only the CID octet and has no payload. LinkADRAns contains the CID octet, followed by a single octet indicating status.

Example-Answer-MAC-Commands

Figure 2: Structure of the LinkCheckAns , DutyCycleAns, and LinkADRAns MAC Commands

The subsequent sections contain details about each MAC command request the end device may issue, and each possible answer that may need to be sent in response to receiving a command from the network server.

The table below lists each command and links to each section.

Note

Some commands are only supported in certain regions. Based on the regions for your device, it may not be necessary to support all the MAC commands. The availability of MAC commands in different regions is outlined below for reference.

Some MAC commands are only used in Class B operations. Therefore, if your device will not implement Class B functionality it is not necessary to support these commands. The MAC commands that are exclusive to Class B operations are listed below for reference.

MAC Command Requests Issued by the End Device

Command Type

Command Name

CID

Operation Mode

Regional Support

Link Check Request

LinkCheckReq

0x02

All Classes

All Regions

End Device Time Request

DeviceTimeReq

0x0D

All Classes

All Regions

Class B - Ping Slot Information Request

PingSlotInfoReq

0x10

Class B only

All Regions

MAC Command Answers Issued by the End Device

Command Type

Command Name

CID

Operation Mode

Regional Support

Link Adaptive Data Rate (ADR) Answer

LinkADRAns

0x03

All Classes

All Regions

Receive Windows Parameters Setup Answer

RXParamSetupAns

0x05

All Classes

All Regions

Receive Window Timing Setup Answer

RXTimingSetupAns

0x08

All Classes

All Regions

Create / Modify a Channel Answer

NewChannelAns

0x07

All Classes

Dynamic Channel Plan Regions Only

Modify Downlink Channel Frequency Answer

DlChannelAns

0x0A

All Classes

Dynamic Channel Plan Regions Only

End Device Transmit Parameters Answer

TXParamSetupAns

0x09

All Classes

Certain Regions Only

End Device Transmit Duty Cycle Answer

DutyCycleAns

0x04

All Classes

All Regions

End Device Status Answer

DevStatusAns

0x06

All Classes

All Regions

Ping Slot Channel Configuration Answer

PingSlotChannelAns

0x11

Class B Only

All Regions

Beacon Frequency Configuration Answer

BeaconFreqAns

0x13

Class B Only

All Regions