1 - End Device Activation

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

Todo

Add more details

Activation By Personalization (ABP)

During activation by personalization (ABP), the session keys (NwkSKey and AppSKey), DevAddr, and DevEUI are stored on the device. There is no further join procedure. These fields cannot be changed once the device has been created unless the device is reprogrammed.

Note

If possible, allow support for OTAA activation in ABP devices by provisioning them with a JoinEUI, and AppKey, as well as ensuring they can handle the OTAA process described above. This allows the device to operate as an OTAA device later. The ability to activate OTAA could be programmed to be activated by a downlink, or from a hard-wired cable.

Keys and Fields to Provision

The session keys (NwkSKey and AppSKey), DevAddr, and DevEUI must all be stored in non-volatile memory (NVM) on the end device during the manufacturing process. In addition, it is recommended you store the frame counters in NVM to ensure that the frame counter value is never reset when the device is reset, which would lead to uplinks being rejected by the network server. These keys are described in this section.

Device EUI (DevEUI)

Follow the instructions in the section Step 1: Provision End Device with Keys to learn how to obtain a DevEUI.

Device Address (DevAddr)

If your device will be registered with a public network, the DevAddr must be supplied by the network server. If the network server is private, you can generate your own DevAddr by following the guidelines in Section 6.1.1, ‘End-device address’ (page 42) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification. Further advice on obtaining a DevAddr is found in Developing LoRaWAN-based Devices: Things to Know, Device Address and Activation by Personalization.

Warning

An ABP device on a public network must use the DevAddr supplied by the network server. This means that the device will be tied to that network and cannot be moved to another network. Support OTAA activation as well, to enable the device to be moved to another network later.

Session Keys (NwkSKey and AppSKey)

The NwkSKey and AppSKey session keys are types of root key. Read Section 2.5.3, ‘Root Keys’ (page 9) of TR007 Developing LoRaWAN® Devices V1.0.0 to learn how to securely generate and store root keys.

Warning

A good practice is to print the DevEUI on the cover of the end device to ease device management. Never include the session keys NwkSKey or AppSKey on the cover of the end device.

Frame Counters (FCntUp and FCntDown)

Set FCntUp and FCntDown to 0, storing them in non-volatile memory (NVM) to ensure they persist when the device is power cycled.

The first uplink sent by the end device must have FCntUp set to 0. FCntUp is incremented by 1 for each subsequent new uplink message.

When each new downlink is received from the network server, the FCntDown is incremented. If the new downlink contains an FCntDown that is lower than the FCntDown in the previous received message, the downlink is ignored.

Learn more about the frame counter in Section 4.3.1.5, ‘Frame Counter’ (page 22) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification.

Warning

If you do not store FCntUp and FCntDown in NVM, when the device is power cycled the FCntUp will be reset to 0, and the network server will reject the uplink since the FCntUp will be lower than the previous. The device will become disconnected. To resolve this, you may be able to modify the settings for the end device in your network server if supported, or you will have to remove and then re-add the device on the network server.