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.

Calculating the Message Integrity Code

After all the data has been prepared in the fields and the FRMPayload field has been encrypted, as described in the Frame Payload (FRMPayload) section, the end device application can calculate and then set the Message Integrity Code (MIC).

Calculate the MIC over the Mac Header (MHDR), Frame Header (FHDR), Frame Port (FPort), and Frame Payload (FRMPayload) using the NwkSKey following the instructions in Section 4.4, ‘Message Integrity Code specification’ (page 25) of the TS001-1.0.4 LoRaWAN® L2 1.0.4 Specification. The NwkSKey is derived during the activation process, explained in the End Device Activation Book. The network server will then verify the MIC using the same NwkSKey.

Figure 1 highlights the fields used in the MIC calculation.

MIC-Fields-Message

Figure 1: Fields used to calculate the MIC