Continued. Specification LoRaWAN 1.0.2.
Start:
LoRaWAN Specification. Introduction Endpoint Concepts and ClassesTo join the LoRaWAN network, the end device must go through the End-Device Activation procedure. The specification provides two options for activating devices:
- OTAA, Over-The-Air Activation (a join procedure is required, during which session session encryption keys and a DevAddr address are generated).
- ABP, Activation By Personalization (no need to go through the join procedure, encryption keys and DevAddr address are written to the device in advance (device personalization))
After activation, the device must contain the following values:
- End-device address (DevAddr) - local device address 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) is a [128-bit] network session key used to calculate and verify the message integrity code MIC field when exchanging between a terminal device and a network server (Network Server), and also encrypting MAC-level messages.
- Application session key (AppSKey) - 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 procedure of joining the network each time when session information (local address DevAddr, keys NwkSKey, AppSKey) is absent or irrelevant in the device. Before the attachment procedure, the device should record:
')
- 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) - key [128 bits], which is used in the process of joining the network to obtain session keys NwkSKey and AppSKey.
Attachment Procedure with OTAA Activation
The join 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 number DevNonce:
Join Request8 bytes | 8 bytes | 2 bytes |
AppEUI | DevEUI | Devnonce |
For each endpoint device, the network server remembers the DevNonce values ​​that were used before and ignores queries containing duplicate DevNonce values.
In response to the join request, the server sends a message to accept accept.
Join Accept3 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 is the delay between the end of the transfer of a terminal device and the beginning of the Rx1 receive window (what a receive window is - see the
LoRaWAN Specification. Introduction. Basic concepts and classes of end 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:
Dlsettings7th bit | bits 6 ... 4 | bits 3 ... 0 |
RFU | RX1DRoffset | RX2 Data rate |
Where:
RFU - Reserved for Future Use, not used.
RX1DRoffset is the difference between the data rates on the uplink and downlink, used for the first Rx1 receive window. The default is 0.
RX2 Data rate - the rate used for the second receive window Rx2.
DevNonce and
AppNonce random numbers are used in the calculation of the
NwkSKey and
AppSKey session keys.
Activation by Personalization - Activation By Personalization
“Activation by personalization” means that
DevAddr ,
NwkSKey and
AppSKey values ​​are directly written to the device (the device is being personalized). According to the specification, each device must contain unique values ​​for the NwkSKey and AppSKey session keys, so that the compromise of these values ​​contained in one device does not lead to the compromise of other devices on the network.
With this method of activation, the terminal device does not need to go through the procedure of joining the network, immediately after switching on the device is ready for data transfer.
Related Links: