# Efficient Runtime Firmware Update Mechanism for LoRaWAN Class A Devices
## 3 Developed System
### Background--LoRaWAN Network Specifications  
LoRaWAN defines the communication protocol and network architecture designed to connect devices to the Internet using signals modulated according to LoRa, aiming to provide bidirectional radio communication, security, and mobility [14]. The LoRaWAN network architecture is based on a star-of-stars topology, where gateways connect end devices to a central network server. Gateways are connected to the network server via standard IP connections and act as a transparent bridge, simply converting formatted data packets into modulated radio signals and vice versa into IP packets. Wireless communication takes advantage of the long-range characteristics of the LoRa physical layer, enabling a single-hop connection between the end device and one or multiple gateways. All available modes support bidirectional communication, with the possibility of supporting multicast addressing groups to efficiently use spectrum during tasks such as Firmware Over-The-Air (FOTA) updates or other mass distribution messages [14]. The key elements of a typical LoRaWAN network (Figure 1) include end devices; gateways; the network server; and the application server. End devices can include sensors, actuators, or both, typically powered by batteries. These devices connect to the LoRaWAN network via gateways using RF signals modulated through the Chirp Spread Spectrum (CSS) technique. Gateways, upon registration with a LoRaWAN network server, merely forward messages from end devices to the network server and vice versa. The network server manages all elements of the LoRaWAN network, while the application server processes specific application data messages received from end devices, managing downlink data taken from the application layer and sending it to connected end devices via the network server [15]. Thus, the LoRaWAN network provides an efficient and robust infrastructure for long-range, low-power communications. Each component within this infrastructure fulfils a distinct role, ensuring reliable and secure connectivity, from data acquisition by end devices to the processing and analysis of information on application servers. The LoRaWAN specification defines three distinct classes of end devices to address different needs reflected across a wide range of applications: low-power bidirectional end devices (Class A), bidirectional end devices with deterministic downlink latency (Class B), and bidirectional end devices with the lowest latency (Class C) [14]. Class A is the default class that all LoRaWAN end devices must support. Communication in Class A is always initiated by the end device and is entirely asynchronous. Each uplink transmission can occur at any time and is followed by two short downlink windows, allowing bidirectional communication or network control commands, if necessary. The end device can enter a low-power sleep mode for a time defined by its own application, with no requirement from the network to initiate communication. Class A is therefore the least power-consuming operating mode while still allowing uplink communication at any time. Downlink communication must always follow an uplink transmission and is stored in the network server until the next uplink event [14]. Class B devices, in addition to the reception windows initiated by Class A, can synchronize with the network using periodic beacons and open 'ping slots' for downlink at scheduled times. This allows the network to send downlink communications with deterministic latency, albeit with additional energy consumption on the end device. The latency is programmable up to 128 s to suit different applications, and the additional power consumption is low enough to be feasible for battery-powered applications [14]. Class C devices maintain the Class A uplink structure followed by two downlink windows but further reduce downlink latency by keeping the end device's receive windows open when not transmitting.