LoRaWAN specification. Terminal Activation
To be continued. LoRaWAN Specification 1.0.2.
Start: LoRaWAN Specification. Introduction Basic concepts and classes of terminals

In order to join the LoRaWAN, the end device must go through the End-Device Activation procedure. The specification provides two options for device activation:
After activation, the device should contain the following values:

When OTAA is activated, the terminal device must go through the network connection procedure every time when session information (local DevAddr address, NwkSKey, AppSKey keys) is absent or irrelevant in the device. Before the connection procedure, the following must be recorded in the device:
The connection procedure is always initiated by the terminal device and consists of two messages exchanged between the terminal device and the network server: join request (device → server) and join accept (server → device).

The join request message contains AppEUI, DevEUI, and a random DevNonce:
For each terminal device, the network server remembers the DevNonce values that were used before and ignores requests that contain duplicate DevNonce values.
In response to the join request, the server sends a join accept message.
where:
AppNonce is a random number.
NetID - network identifier.
DevAddr - device address on the network.
DLSettings - parameters used for downstream messages (server -> device).
RxDelay - the delay between the end of the transmission of the terminal device and the beginning of the Rx1 receive window (what are the receive windows - see LoRaWAN specification. Introduction. Basic concepts and classes of terminal devices ).
CFList - a list of additional frequency channels that can be used by the terminal device.
The DLSettings [8 bit] field has the following format:
where:
RFU - Reserved for Future Use, not used.
RX1DRoffset - the difference between the data rates on the uplink and downlink used for the first Rx1 receive window. The default
value is 0. RX2 Data rate - speed used for the second Rx2 receive window.
Random numbers DevNonce and AppNonce are used in calculating the session keys NwkSKey and AppSKey .
“Activation by personalization” means that the values DevAddr , NwkSKey and AppSKey are directly written to the device (the device is personalized). According to the specification, each device must contain unique NwkSKey and AppSKey session key values so that the compromise of these values contained in one device does not lead to the compromise of other network devices.
With this activation method, the terminal device does not need to go through the network connection procedure, immediately after turning on the device is ready for data transfer.
Related links:
Start: LoRaWAN Specification. Introduction Basic concepts and classes of terminals

In order to join the LoRaWAN, the end device must go through the End-Device Activation procedure. The specification provides two options for device activation:
- OTAA, Over-The-Air Activation (you need to go through the join procedure), during which session encryption keys and the DevAddr address are generated).
- ABP, Activation By Personalization (no need to go through the connection procedure, the encryption keys and the DevAddr address are written to the device in advance (device personalization))
After activation, the device should contain the following values:
- End-device address (DevAddr) - the local address of the device on this network [32 bits]. DevAddr consists of two fields: NwkID (network identifier, bits 31 ... 25) and NwkAddr (network address, bits 24 ... 0).
- Network session key (NwkSKey) - a network session key [128 bit] used to calculate and check the MIC (message integrity code) field of messages during communication between the terminal device and the network server (Network Server), as well as MAC-level message encryption.
- Application session key (AppSKey) - a session key [128 bit] used to encrypt data at the application level (between the terminal device and the application server).
- Also, the device must have an application identifier [64 bits], which is recorded in advance - Application identifier (AppEUI)

Air Activation - Over-The-Air Activation
When OTAA is activated, the terminal device must go through the network connection procedure every time when session information (local DevAddr address, NwkSKey, AppSKey keys) is absent or irrelevant in the device. Before the connection procedure, the following must be recorded in the device:
- End-device identifier (DevEUI) - a unique identifier that is assigned to the device during production [64 bits].
- Application identifier (AppEUI) - the unique identifier of the application [64 bits], which was mentioned earlier.
- Application key (AppKey) - the key [128 bit], which is used in the process of joining the network to obtain the session keys NwkSKey and AppSKey.
OTAA Activation Addition Procedure
The connection procedure is always initiated by the terminal device and consists of two messages exchanged between the terminal device and the network server: join request (device → server) and join accept (server → device).

The join request message contains AppEUI, DevEUI, and a random DevNonce:
8 bytes | 8 bytes | 2 bytes |
AppEUI | DevEUI | Devnonce |
For each terminal device, the network server remembers the DevNonce values that were used before and ignores requests that contain duplicate DevNonce values.
In response to the join request, the server sends a join accept message.
3 bytes | 3 bytes | 4 bytes | 1 byte | 1 byte | 16 bytes |
Appnonce | NetID | Devaddr | Dlsettings | Rxdelay | CFList |
where:
AppNonce is a random number.
NetID - network identifier.
DevAddr - device address on the network.
DLSettings - parameters used for downstream messages (server -> device).
RxDelay - the delay between the end of the transmission of the terminal device and the beginning of the Rx1 receive window (what are the receive windows - see LoRaWAN specification. Introduction. Basic concepts and classes of terminal devices ).
CFList - a list of additional frequency channels that can be used by the terminal device.
The DLSettings [8 bit] field has the following format:
7th bit | bits 6 ... 4 | bits 3 ... 0 |
RFU | RX1DRoffset | RX2 Data rate |
where:
RFU - Reserved for Future Use, not used.
RX1DRoffset - the difference between the data rates on the uplink and downlink used for the first Rx1 receive window. The default
value is 0. RX2 Data rate - speed used for the second Rx2 receive window.
Random numbers DevNonce and AppNonce are used in calculating the session keys NwkSKey and AppSKey .
Activation By Personalization - Activation By Personalization
“Activation by personalization” means that the values DevAddr , NwkSKey and AppSKey are directly written to the device (the device is personalized). According to the specification, each device must contain unique NwkSKey and AppSKey session key values so that the compromise of these values contained in one device does not lead to the compromise of other network devices.
With this activation method, the terminal device does not need to go through the network connection procedure, immediately after turning on the device is ready for data transfer.
Related links:
- LoRaWAN specification. Introduction Basic concepts and classes of terminals
- Multi-Tech Base Stations Deploy LoRaWAN in a Few Clicks
- We configure the LoRaWAN gateway and create our first IoT application
- NB-IoT, Narrow Band Internet of Things. General information and technology features.
- NB-IoT, Narrow Band Internet of Things. Power saving modes and control commands.