In a LoRaWAN network, there are sometimes many different Internet-of-Things (IoT) devices that require regular maintenance. One issue here, for example, is the installation of new firmware. An important requirement may be to be able to perform this process remotely. LoRaWAN provides an efficient and secure method for this using multicast messages. This service is provided by a set of application layer packets. The article provides an outline of the most important aspects of Firmware Update Over-The-Air (FUOTA) and highlights three of the application layer packets in detail. 

6 STEPS TO UPDATE FIRMWARE

  1. Identification of the devices to be updated and classification into multicast groups.
  2. Generation of a binary firmware patch file for the device platform to be updated
  3. Sending the binary file to the group of devices to be updated
  4. The signature to authenticate the file and its origin is verified by each device
  5. Each device installs the firmware update
  6. Reporting the status of the update process (success or failure) by each device

Even though the above steps are very device specific, it is possible to standardize a FUOTA process so that it works for almost any device in a LoRaWAN network. The requirements to run FUOTA are currently given with the STACKFORCE LoRaWAN Stack on the hardware platforms STM32L0+SX126x, STM32WB55+SX126x and STM32WLE/STM32WL55. On request we also offer other platforms.

A certain limitation is the low bit rate at which data is transmitted in a LoRaWAN network. This challenge is countered by multicast messages. These ensure that a given radio packet transmitted over the network can be received by many devices. As a result, only one transmission is sufficient to reach all devices at once.

With LoRaWAN, there are three primary application layer packets for FUOTA:
  • Clock Synchronization
  • Remote Multicast Setup
  • Fragmented Data Block Transport

On the device side, these packets reside at the Application layer. They use the LoRaWAN MAC layer to send and receive messages to and from the network. Additionally, other packets may be present at the Application layer of the device. The first step in updating firmware on a LoRaWAN network is to identify and list the devices to be updated and add them to a LoRaWAN multicast group. This group can be created and set up dynamically.​​​​​

REMOTE MULTICAST SETUP

Each device in a LoRaWAN network is equipped with a unicast identity that is used to uniquely identify and authenticate the device on the network. Within Remote Multicast Setup, the following applications can be performed:

  1. Query the implementation version of the package.
  2. Query the list and status of multicast groups to which a device has been assigned.
  3. Create or modify a multicast group for a specific device.
  4. Delete a multicast group definition from a device.
  5. Define a Class B or Class C session and associate it with a multicast group.

LoRaWAN-based devices are battery-powered and normally wake up only when they have data to transmit, then immediately go back to sleep. Therefore, to transmit a message to an entire group of devices, the system must first ensure that the receivers of all devices within the multicast group are active at the same time and for the same duration.

To synchronize the time of LoRaWAN-based devices with the time of the network, the Clock Synchronization packet is used. Once the device clocks are synchronized, the device management service must program the devices to open their receivers simultaneously and use the same radio channel and data rate. For this purpose, either a Class C or Class B multicast session can be defined using the Remote Multicast Setup package.

The Remote Multicast Setup package makes no assumptions about the content of messages transmitted by the network during a Class C or Class B multicast session. Therefore, during a multicast session, a way must be provided to efficiently fragment a file to ensure complete delivery to each device in the group. The Fragmented Data Block Transport package was created for this purpose.

FRAGMENTED DATA BLOCK TRANSPORT

The use of radio multicast transmissions greatly improves the efficiency of the network. However, the challenge is that not all data packages reach the receiver. To successfully transmit as many data packets as possible, the Fragmented Data Block Transport package implements a "forward error correction code".  

The file to be sent is split into fragments of equal length and the forward error correction code is implemented so that individual fragments can be recovered to ensure transmission of the complete file. In addition, the Fragmented Data Block Transport package provides the following functions:

  • Query the implementation version of the fragmentation package.
  • Create a fragmentation session
  • Query a device or group of devices to determine the status of a fragmentation session
  • Delete a fragmentation session

Before sending a file to a device or group of devices, a fragmentation session must be created. This tells the device or devices the details of the file to be sent. Although multicast transmissions are more efficient for sending the same file to a group of devices, the fragmentation package also allows fragments to be sent over a unicast downlink. Using a unicast or multicast message, the server can query the status of each device after all encoded fragments have been sent. Additional encoded fragments can be sent to devices that have not yet been able to fully reassemble the file. These fragments can be sent as unicast downlinks, or a new multicast session can be established if too many devices have not been able to reassemble the file.

SUMMARY

In this article, we covered the topics of Clock Synchronization, Remote Multicast Setup, and Fragmented Data Block Transport application layer packages. With this packages LoRaWAN provides a reliable service for transmitting fragmented files. The multicast capability of the LoRaWAN protocol combined with an efficient fragment encoding scheme, significantly reduces the number of repetitive transmissions required. This allows the user to easily perform Firmware Updates Over-The-Air.​​​​​​

Source: https://lora-developers.semtech.com/documentation/tech-papers-and-guides/firmware-updates-over-the-air/


Loading Conversation