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.

Composing the Packet

Uplink Bit Fields

The following one-bit-length fields must always be set to 1 or 0 and sent with every uplink broadcast. The end device can also send a message purely for the purpose of communicating one or more of these bit fields, without any application data or MAC commands, if the use case requires it.

uplink-packet-bit-fields

Figure 1: The bit fields highlighted in a LoRaWAN® uplink packet

Frame Acknowledge Bit (ACK)

The ACK bit is found at position 5 in the Frame Control Octet found within the Frame Header inside the MAC Payload, as shown in Figure 1.

The ACK bit is used to acknowledge receipt of a confirmed downlink. Learn how to identify a confirmed downlink by inspecting the FType field in the MAC Header of a downlink in the section Verify the Frame Type (FType) of the Receiving Messages Book.

Set the ACK bit to 1 to confirm receipt of the last received confirmed downlink; otherwise, set ACK to 0.

You will need to decide if you should program your device to wait for the next MAC command or application data broadcast to pass up the Frame Acknowledge Bit, or to send the Frame Acknowledge Bit as soon as it is ready. Waiting to send the field until there is other data to send consumes less overall airtime and battery life, as the device will send fewer messages overall. However, there are certain cases when it may be necessary to send the bit as soon as possible, depending on your use case.

Read more in Section 4.3.1.2, ‘Frame acknowledge bit and acknowledgment procedure’ (page 20) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification.

Adaptive Data Rate Control Bit (ADR)

The Adaptive Data Rate (ADR) bit is found at position 7 in the Frame Control Octet found within the Frame Header inside the MAC Payload, as shown in Figure 1.

When ADR is in use, the network server sends MAC Commands to the end device, instructing it to adjust the uplink channels, data rate and TX Power used when sending uplinks. The benefits of ADR are that it helps preserve the battery life of an end device and reduces network interference, giving all end devices on the network the best chance of communicating successfully.

If your device is always static (i.e., in the same fixed location), then you should always use ADR, and therefore always set the ADR bit on all uplinks. If your end device is mobile, for example, if it is a geolocation tracker, ADR will not be suitable for your use case. Read more in the section Deciding When to Implement ADR of the Adaptive Data Rate Book.

You set ADR to 1 to inform the network server that ADR should be used.

When ADR is set, listen for Link ADR Request (LinkADRReq) MAC commands in downlinks. Implement the changes if possible and respond to the network server. Read the Processing the LinkADRReq MAC Command section of the Adaptive Data Rate Book for more information.

Once any changes to the default settings have been made, it is important to implement ADR backoff to avoid situations where the new settings leave the end-device unable to communicate with the network server. For more information, read the ADR Backoff section of the Adaptive Data Rate Book.

When ADR is not being used, and the ADR bit is set to 0, the end device must transmit using the default TX Power, data rate, and channel list, as described in section Channel, Data Rate, and TX Power Guidelines for Broadcasting.

For more information, read the Adaptive Data Rate Book and Section 4.3.1.1, ‘Adaptive data-rate control in frame header’ (page 18) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification.

Adaptive Data Rate Acknowledgement Request Bit (ADRACKReq)

The ADRACKReq bit is found at position 6 in the Frame Control Octet found within the Frame Header inside the MAC Payload, as shown in Figure 1.

The ADRACKReq bit is used by the adaptive data rate (ADR) feature. The ADRACKReq bit is set when the end device requires a downlink frame to be sent by the network server in response to the message. Set ADRACKReq to 1 to request a downlink frame; otherwise, set ADRACKReq to 0.

For more information, read the ADR Backoff section of the Adaptive Data Rate Book and Section 4.3.1.1, ‘Adaptive data-rate control in frame header’ (page 18) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification.

Class B Enabled Bit (ClassB)

The ClassB bit is found at position 4 in the Frame Control Octet found within the Frame Header inside the MAC Payload, as shown in Figure 1.

The ClassB bit is used to notify the network server that the end device currently has Class B operations enabled. Set ClassB to 1 when the end device wants to enable and use Class B mode, and with every subsequent message until the end device switches back to Class A mode or moves into Class C mode; otherwise, set ClassB to 0.

For more information about enabling Class B mode, read the section Enabling Class B Mode of the Class B Book and Section 4.3.1.7, ‘Class B enabled bit’ (page 23) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification.