3 - Receiving Messages

Messages sent from a network server to an end device are referred to as downlinks. These are sent to the end device via a single gateway. If there are multiple gateways near a device, the network server will select the most suitable gateway to broadcast from. This means the end device does not need to consider de-duping.

Devices operating in Class A mode only receive downlinks during the receive windows opened following an uplink, as described in the section Opening Receive Windows of the Sending Messages Book.

Devices that support Class B mode as well as Class A can receive additional downlinks in receive windows opened at fixed time slots. Read more about Class B mode in the Class B Book.

Devices that support Class C mode as well as Class A can receive additional downlinks at any time. Read more in the Class C: Continuously Listening for Downlinks book.

Todo

Fix link

In this book, you learn how to receive and handle downlink packets using the LoRaWAN® 1.0.4 specification.

Handling MAC Commands

MAC commands are used to manage the network. There are 13 types of commands, each having a request command and an answer command. There are ten request commands that the end device may receive from the network server, each requiring processing, the outcome of which may require an action to be taken, and a possible answer to be sent. There are three answers that the end device may receive from the network server in return from requests it has initiated. Sending answers and requests from the end device was covered in the section Sending MAC Commands of the Sending Messages Book.

MAC commands can be received 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 received in the same way, 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

The subsequent sections contain details about each MAC command request or answer the end device may receive. The table below lists each command and links to each section.

Note

Some commands are only supported in certain regions. Depending on the regions you intend to sell your device in, you may not need to support all the commands.

Some commands are only used in Class B operations, and only require supporting if Class B operations will be used.

MAC Command Requests Received by the End Device

Command Type

Command Pair

CID

Operation Mode

Regional Support

Link Adaptive Data Rate (ADR) Request

LinkADRReq

0x03

All Classes

All Regions

Receive Windows Parameters Setup Request

RXParamSetupReq

0x05

All Classes

All Regions

Receive Window Timing Setup Request

RXTimingSetupReq

0x08

All Classes

All Regions

Create / Modify a Channel Request

NewChannelReq

0x07

All Classes

Dynamic Channel Plan Regions Only

Modify Downlink Channel Frequency Request

DlChannelReq

0x0A

All Classes

Dynamic Channel Plan Regions Only

End Device Transmit Parameters Answer

TXParamSetupReq

0x09

All Classes

Certain Regions Only

End Device Transmit Duty Cycle Request

DutyCycleReq

0x04

All Classes

All Regions

End Device Status Request

DevStatusReq

0x06

All Classes

All Regions

Ping Slot Channel Configuration Request

PingSlotChannelReq

0x11

Class B Only

All Regions

Beacon Frequency Configuration Request

BeaconFreqReq

0x13

Class B Only

All Regions

MAC Command Answers Received by the End Device

Command Type

Command Name

CID

Operation Mode

Regional Support

Link Check Answer

LinkCheckAns

0x02

All Classes

All Regions

End Device Time Answer

DeviceTimeAns

0x0D

All Classes

All Regions

Class B - Ping Slot Information Answer

PingSlotInfoAns

0x10

Class B only

All Regions