# Firmware Updates over the Air via LoRa: Unicast and Broadcast Combination for Boosting Update Speed
## 1 Introduction
How does the number of nodes modify the problem? As we will see, some architectures and methods for IoT updates [2] have been proposed, which are divided into different stages, such as, e.g., the validation of a manifest, the firmware exchange, the verification of a checksum, and the final secure flashing. It should be noted that the present paper is mainly focused on the firmware exchange stage: the phase in which the firmware chunks are sent through the air from the gateway to each of the devices to be updated. The devices under consideration correspond to a recent project that focuses on the installation of intelligent lighting systems within ATEX zones. The nodes are low-end IoT devices equipped with a microcontroller unit (MCU) of limited capacity, which is capable of collecting data regarding light (consumption metrics, temperature readings, and any detected malfunctions) using the DALI (Digital Addressable Lighting Interface) standard [3]. Furthermore, it is also capable of gathering data from connected sensors. More specific information about the devices is provided in Section 6. As far as communications are concerned, LoRa is chosen for its extensive adoption as a wireless protocol that possesses all the necessary attributes: in the considered industrial environments, it has good penetration, because it works in the license-free sub-gigahertzband. In addition, ATEX elements require an enclosure which absorbs some amount of energy. As we will see, for different reasons, we opt for the use of MiWi [4; 5] above the physical LoRa layer, instead of resorting to the more commonly used LoRaWAN [6; 7]. Although the experiments will be run on a scenario of this kind (LoRa in the EU868 band, in an ATEX scenario), many of the presented findings may also be valid for other ones. The main KPIs (Key Performance Indicators) usually considered for OTA update methods are the update time, the energy consumption, and the update efficiency (the percentage of successfully updated nodes) [8]. In the present case, the energy cost incurred by the firmware update is not relevant, since all the nodes are part of ATEX luminaires connected to the power supply network, so batteries are not required. Another requisite is that the update efficiency must be 100%, i.e., the procedure will not finish until all the nodes have been updated. This leaves the update time as our main KPI. We define it as the time required for updating a whole project, including a number of IoT devices, assuming that the update is completed safely (i.e., the correct firmware is flashed on the device). A reduction in the total update time is also relevant from a cybersecurity point of view: if a new vulnerability is disclosed, the devices must be updated as soon as possible. The total time is closely related to the consumed airtime, considering the limitations imposed by regulations. As an example, the LoRa Alliance limits airtime usage to 1% of the total time, and in certain cases, to 0.1% or 10% of it [9]. As we will see, one approach can be to minimize the total update time, while keeping the airtime usage just below the limit. Therefore, the results will be presented in this paper in terms of the total update time. All in all, the contribution of the paper can be summarized as:  
1. The proposal, definition, and analysis of three methods for OTA firmware updates: an _only unicast_ one; another one that combines a number of initial broadcast stages with a final unicast one, in which the pending chunks are sent individually to each node (it will be called _broadcast + unicast_); and an improved one, in which the firmware chunks are always sent in broadcast frames (_only broadcast_). 2. An extensive evaluation of the different methods via simulation, considering a LoRa scenario in the 868 MHz band. A test battery varying different parameters is carried out. 3. The implementation and evaluation, with real hardware, of the _only unicast_ method in an IoT intelligent lighting system.