1 - End Device Activation

This book covers LoRaWAN® end-device activation in depth.

Todo

Add more details

Over-the-Air Activation (OTAA) Device Provisioning

Step 3A: End Device Sends Join Request

To initiate the join procedure, the end device issues a Join Request frame containing the JoinEUI, DevEUI, and a DevNonce, as shown in Figure 1.

Join-Request-format
Figure 1: Join Request payload shown within the PHY Payload in the LoRaWAN® Packet
Join Request Payload Fields

The JoinEUI and DevEUI are stored on the device as explained in section Step 1: Provision End Device with Keys. The code handling the Join Request retrieves these keys from the device.

The DevNonce is a counter that must start from 0 and be incremented with every single Join Request that is sent to the network server. The DevNonce must never be reused. If no Join Accept message is received, and the same Join Request is repeated, then the DevNonce must still be incremented.

Warning

The network server must reject a request that is sent using a previously used DevNonce, so store the DevNonce in non-volatile memory (NVM) that persists between power cycles. If the DevNonce is reset to 0 after a power cycle, and the network server is conforming to the LoRaWAN 1.0.4 specification, the device will be unable to rejoin that network because the DevNonce has not been incremented.

Calculating the Message Integrity Code (MIC)

Calculate the message integrity code (MIC) over the Mac Header (MHDR), JoinEUI, DevEUI, and DevNonce using the AppKey following the instructions in Section 6.2.5, Join-Request Frame (page 45) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification. The MIC is used by the network server to ensure the message has not been modified in transit.

Join Request Transmission

This section explains the timing, channel, data rate, and TX Power to use when transmitting the Join Request.

Timing

Follow the timing indicated in Section 7, Retransmissions Backoff (page 49) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification. These guidelines ensure that the transmission timing across multiple end devices is random enough to avoid flooding the network if they all try to join at the same time.

Channel and Data Rate

To find the channel frequencies and data rates to use to send the Join Request, open RP002-1.0.4 LoRaWAN Regional Parameters specification, locate the section for the region your device will operate in, and find the subsection entitled ‘REGION NAME Band Channel Frequencies’. For example, for the region EU863-870, the section title is ‘EU863-870 Band Channel Frequencies’ on page 25.

Note

If you cannot find the Join Request channel frequencies and data rates for your region, use all available channels and permitted data rates for that region, as described in Section 6.2.5, ‘Join-Request Frame’ (page 45) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification.

The device should generate a pseudo-randomly sorted list of the channels available for its region and then iterate through each channel in this list with each broadcast of the Join Request, as described in Section 3.7, ‘Avoiding Synchronous Behavior’ (page 16) of the TR007 Developing LoRaWAN® Devices V1.0.0. This minimizes the risk of multiple end devices all broadcasting on the same channel, increasing the chance of Join Request messages reaching a gateway.

Some regions identify the exact data rate that must be used when broadcasting the Join Request on a channel, other regions specify a range of data rates that can be used, associated with one or more groups of channel frequencies.

If the region specifies an exact data rate for a channel, send the Join Request at that data rate.

If the region you are using permits a range of data rates per channel, you can increase the chance of the Join Request reaching a gateway by transmitting each broadcast at the lowest permitted data rate, at least for the first iteration through the channel list. On subsequent iterations, the device should vary the data rate, so that the Join Requests are eventually transmitted across all available channels at all available data rates.

If you operate in regions US915 or AU915, read more about use of channels in Section 3.2, ‘Fixed Channel Plan Join Process Optimization’ (page 12) of the document TR007 Developing LoRaWAN® Devices.

TX Power

The end device should broadcast the Join Request using the maximum power level it can support and is permitted for the region in which it will operate. Find the guidelines in the ‘Data Rate and End-device Output Power encoding’ subsection for a given region in the RP002-1.0.4 LoRaWAN Regional Parameters specification.

Note

Remember to increment the DevNonce value with every transmission of the Join Request.