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.
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.
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.
Command Type |
Command Name |
CID |
Operation Mode |
Regional Support |
---|---|---|---|---|
LinkCheckReq |
|
All Classes |
All Regions |
|
DeviceTimeReq |
|
All Classes |
All Regions |
|
PingSlotInfoReq |
|
Class B only |
All Regions |
Command Type |
Command Name |
CID |
Operation Mode |
Regional Support |
---|---|---|---|---|
LinkADRAns |
|
All Classes |
All Regions |
|
RXParamSetupAns |
|
All Classes |
All Regions |
|
RXTimingSetupAns |
|
All Classes |
All Regions |
|
NewChannelAns |
|
All Classes |
Dynamic Channel Plan Regions Only |
|
DlChannelAns |
|
All Classes |
Dynamic Channel Plan Regions Only |
|
TXParamSetupAns |
|
All Classes |
Certain Regions Only |
|
DutyCycleAns |
|
All Classes |
All Regions |
|
DevStatusAns |
|
All Classes |
All Regions |
|
PingSlotChannelAns |
|
Class B Only |
All Regions |
|
BeaconFreqAns |
|
Class B Only |
All Regions |