LoRaWAN FUOTA: Airtime, Fragments and What a Firmware Update Really Costs a Fleet

The bug report arrives on a Tuesday. A sensor reading on five hundred pond and shed nodes drifts high after a firmware timer wraps, and the fix is eleven lines of code. The release build is 128 kilobytes. The nodes sit on poles, rooftops and pond bunds across several districts, and none of them has a cable to plug into.
Over LoRaWAN, that 128 kB image becomes 1,171 separate downlink frames of 112 bytes each at a middling data rate. Each takes about two-thirds of a second on air, and each has to arrive intact at a receiver that spends most of its life asleep. That is just over thirteen minutes of transmitter time, which sounds friendly until the next questions arrive. How long until every node has the image, when a gateway may transmit for only a fraction of each hour? How much battery does it cost to hold a receiver open? And what happens to the node behind the water tank that misses fifty frames?
This guide answers those questions with arithmetic rather than with a vendor's console. It covers what the LoRa Alliance specifications provide, the airtime and duty-cycle sums that turn minutes into hours, the redundancy a fleet needs against loss, the energy a listening node spends, and the verification and rollback that decide whether a failed update costs a retry or a site visit. Loss rates, fleet sizes and receive currents are planning assumptions, and the planner script is included so you can replace them with your own.
What the Standards Give You and What They Leave to You
LoRa Alliance working groups have published a set of application-layer building blocks for firmware updates. The set the FUOTA working group lists includes clock synchronisation (TS003), fragmented data block transport (TS004), remote multicast setup (TS005), firmware management (TS006) and multi-package access (TS007). Versions 1.0.0 and 2.0.0 of the first three exist in the wild, and network servers and device stacks do not all support the same version, so the first compatibility check is a plain one: which version does your server speak, and which does your device stack implement?
These specifications define messages that travel on application ports. They do not define most of what makes an update safe. The table below separates the two.
Piece | What the specifications cover | What stays your job |
Clock synchronisation | A way for a device to learn network time to within a few seconds | Deciding how often to run it and what to do when it fails |
Fragmented data block transport | Splitting a block into numbered fragments, forward error correction, a status report | Image format, manifest, size limits, memory for recovery |
Remote multicast setup | Creating a temporary multicast group and a Class B or Class C session on the device | Choosing the data rate, channel, start time and duration |
Firmware management | Querying versions and asking a device to reboot | Policy: who may trigger it and when |
Image authenticity | Nothing | Signing, verification and key management |
Swap and rollback | Nothing | Bootloader behaviour, confirmation window, failure recovery |
The bottom two rows are where updates go wrong. The transport can be flawless and the product can still brick a node, because the standards move bytes and leave trust and recovery to the device. Anything in this guide that says "verify" or "roll back" is therefore your own engineering, and the post on secure boot and firmware signing covers its key management.
A word on terms. A fragmentation session carries one data block, usually the firmware image, to one device or to a multicast group. A multicast group is a set of devices that share a temporary address and keys so a single downlink can reach all of them. A Class C session keeps the receiver open continuously for its duration. A Class B session opens the receiver at scheduled ping slots, synchronised to a gateway beacon. The two classes trade update speed against energy, and later sections price the trade.
The Radio Arithmetic in One Page
LoRa time on air follows a published formula. The symbol time is 2 to the power SF, divided by bandwidth. The preamble lasts 12.25 symbols for the default eight-symbol preamble. The payload takes a number of symbols that depends on the payload length, the spreading factor, the coding rate and whether the frame carries a header and a CRC. For a downlink the frame has an explicit header and no payload CRC, and the coding rate is 4/5.
At 125 kHz bandwidth the symbol time is 32.768 ms at SF12, 8.192 ms at SF10, 4.096 ms at SF9 and 1.024 ms at SF7. A frame at SF12 is therefore thirty-two times slower per symbol than the same frame at SF7, before the extra symbols that low data rates need are counted.
The India 865 MHz plan defines six 125 kHz data rates for the minimum set, DR0 to DR5, running from SF12 down to SF7. The maximum application payload is 51 bytes at DR0 to DR2, 115 bytes at DR3 and 242 bytes at DR4 and DR5, for devices that do not need to work behind a repeater. A repeater-compatible profile allows smaller payloads at the faster rates, so read the table for the profile you actually deploy.
A fragment is not the whole payload. The fragmentation transport adds a small header in front of the fragment bytes, and the LoRaWAN frame adds its own 13 bytes of header, address, counter, port and integrity check around the payload. A DataFragment message carries a command identifier, a two-byte word holding the session index and the fragment counter, and then the fragment itself, so plan on a three-byte header and confirm the layout against the version of TS004 you implement. Choosing fragment sizes in multiples of four bytes keeps memory writes tidy on most microcontrollers, and the script below does that.
DR | SF | Max payload | Fragment size | Time on air per fragment | Fragments for 128 kB | Airtime for 128 kB |
DR0 | 12 | 51 B | 48 B | 2,793 ms | 2,731 | 127.1 min |
DR1 | 11 | 51 B | 48 B | 1,479 ms | 2,731 | 67.3 min |
DR2 | 10 | 51 B | 48 B | 698 ms | 2,731 | 31.8 min |
DR3 | 9 | 115 B | 112 B | 677 ms | 1,171 | 13.2 min |
DR4 | 8 | 242 B | 236 B | 687 ms | 556 | 6.4 min |
DR5 | 7 | 242 B | 236 B | 389 ms | 556 | 3.6 min |
Two features of the table are worth fixing in memory. First, DR2 and DR3 take almost the same time per fragment, because the payload more than doubles at DR3 while the symbol rate halves. DR3 therefore moves the image in less than half the time. Second, DR4 has a longer fragment time than DR3 but carries twice the payload, which is why it halves the total again. In effect the usable throughput climbs from about 17 bytes a second at DR0 to about 606 bytes a second at DR5. Header overhead falls with it, from 33% of each frame at 48-byte fragments to 7% at 236 bytes.
The table matches an independent worked example in the research literature: a 10 kB image in 50-byte fragments at SF12 and 125 kHz comes to roughly 2.8 seconds per fragment, or 560 seconds in all. The script reproduces that 2.8-second figure for a 48-byte fragment at DR0.
Why the Duty Cycle Sets the Calendar, Not the Airtime
Airtime is the time the transmitter is on. Duty cycle is the fraction of each hour it may be on. A cap of 1% means a transmitter that has sent for 36 seconds in an hour must stay quiet for the rest of it. Airtime of 13 minutes at a 1% cap needs at least 22 hours of wall-clock time, and the same arithmetic at a 10% cap needs 2.2 hours.
The caps differ by region and by device type. In the European 868 MHz plan the default channels are limited to 1%. For India, the licence-exempt 865 to 868 MHz rules notified in December 2021 (G.S.R. 853(E)) allow 500 mW effective radiated power with adaptive power control, and as read from the gazette text and vendor guides the duty-cycle caps are 10% for gateways and 2.5% for other devices. Confirm the exact limits in the gazette itself before you rely on them, because the figures are easy to misquote and older LoRa Alliance regional-parameter editions still describe the earlier 865 to 867 MHz rules.
In a FUOTA session the gateways do the transmitting, so the gateway cap is the one that matters. The table below applies the three caps to a 128 kB image with no redundancy.
Data rate | Airtime | Minimum wall time at 10% | At 2.5% | At 1% |
DR3 (SF9, 112 B fragments) | 13.2 min | 2.20 h | 8.8 h | 22.0 h |
DR4 (SF8, 236 B fragments) | 6.4 min | 1.06 h | 4.3 h | 10.6 h |
DR5 (SF7, 236 B fragments) | 3.6 min | 0.60 h | 2.4 h | 6.0 h |
Three consequences follow. First, a session that looks like a quarter of an hour on the airtime sheet is a morning's work under a 10% cap and a full day under a 1% cap. Second, the cap applies per transmitter, so in a multicast session every gateway in range sends the same frames and each has its own budget; the cap does not multiply by gateway count, but it also does not pool. Third, the same gateway still has to carry the network's ordinary downlinks, such as acknowledgements and the occasional command, so a session that uses the whole budget starves everything else on that gateway. Plan the session to use half the budget at most, and the 128 kB example at DR3 stretches to nearly five hours.
Quote airtime to the product team and wall time to the operations team. A session that needs 13 minutes of air needs hours of calendar, and the caps decide how many.
Choosing the Delivery Path: Unicast, Class B or Class C
What it is. The first decision is whether to send the image to each node separately (unicast) or to a group at once (multicast), and if multicast, whether to use Class C or Class B for the session.
How to do it. Start from the device inventory. Which nodes can run Class C at all, which are mains-powered or on a large battery, and which are small cells that cannot afford a continuous receiver? A mains-powered gateway-adjacent node can be updated in Class C trivially. A battery node on a coin cell might be better served by Class B, or by a delta image small enough to unicast.
The table compares the three paths on the dimensions that matter.
Path | How the node listens | Speed | Energy cost to the node | Needs from the network |
Unicast, Class A | Two short windows after each uplink | Slowest: one fragment per uplink | Lowest per hour, but the update lasts days | Nothing special |
Multicast, Class B | Ping slots on a beacon schedule | Medium | Moderate, beacon tracking needed | Gateway beacons, Class B support |
Multicast, Class C | Receiver on for the whole session | Fastest | Highest per hour, short session | Class C downlink scheduling on every gateway |
How it fails. The commonest failure is assuming a capability the fleet does not have. A network server that supports multicast but not Class C downlinks on a given gateway model will accept the session and quietly send nothing. A device stack that supports Class C for ordinary operation may not implement the Remote Multicast Setup package at all.
Check before moving on. Run a session on three bench devices with the gateway model you deploy. If all three finish, the path exists. If one fails, find out why before the fleet teaches you.
Synchronising Clocks Before the Session
What it is. Class C and Class B multicast sessions start at a stated time. The device and the network must agree on what time it is. The clock synchronisation package (TS003) lets a device ask the server for network time, so a node that has been asleep for months and has drifted can correct itself.
How to do it. Run clock synchronisation shortly before the session, not once at commissioning. Crystal drift on a low-cost device is measured in tens of parts per million. At 20 ppm a node drifts about 1.7 seconds a day, so a node that last synchronised three months ago can be out by two or three minutes, which is more than enough to open the receiver after the first fragments have gone by. Send a clock-correction request to the whole group a day ahead, and again an hour ahead if the session is long.
Start the session window earlier than the scheduled first fragment, and stretch the end later. The window padding is the cheapest insurance in the whole procedure and it costs battery, so set it from the measured drift and not from habit.
How it fails. Two failure patterns recur. A node that never received the correction opens its window late and misses the opening fragments; the redundancy covers a few lost frames but not two hundred. And a node whose clock was corrected in the wrong direction because the server reply arrived after a delay can be off by the round-trip time, which is small, or by a whole second if the correction was applied twice.
Check before moving on. Log the clock offset each node reports after correction and read the distribution. If any node is off by more than the window padding, fix it before the session.
A multicast session starts at a clock time. A fleet whose clocks were last set at commissioning is a fleet that will miss the first fragments of its first update.
The Redundancy Question: Insurance Against Loss
Forward error correction changes the problem from "every fragment must arrive" to "enough fragments must arrive". The sender transmits the K original fragments and then R extra redundancy fragments, each a mix of the originals computed from a pseudo-random pattern. A device that has received at least K plus a few fragments in total, in any mix of original and redundancy, can reconstruct the image. Published descriptions of the transport mention a low-density parity code, and the exact overhead depends on the code and the number of fragments, so the script assumes the device needs four fragments beyond K. Treat four as a planning assumption and replace it with the figure your stack documents.
If each fragment is lost independently with probability p, the number a device receives from K plus R sent follows a binomial distribution, and the chance of success is the chance that at least K plus four arrive. The script computes that tail for a 128 kB image at DR3, where K is 1,171, and asks how much redundancy is needed for 99.9% success on a single device.
Per-node fragment loss | Redundancy fragments R | R as a share of K | Airtime including redundancy | Chance all 500 nodes finish |
2% | 45 | 4% | 13.7 min | 73% |
5% | 92 | 8% | 14.2 min | 63% |
10% | 173 | 15% | 15.2 min | 61% |
20% | 359 | 31% | 17.3 min | 63% |
30% | 593 | 51% | 19.9 min | 62% |
40% | 902 | 77% | 23.4 min | 61% |
Look at the right-hand column. A per-node success probability of 99.9% sounds like safety. Across a fleet of five hundred nodes it is a coin toss: at 99.9% each, the chance every node finishes is roughly 60%. The airtime hardly moves across the rows, from 13.7 to 23.4 minutes, because redundancy is a small addition to the base transfer until loss becomes extreme. Buying a higher per-node success target is cheap in airtime and expensive only in the memory a device needs to recover.
Raising the per-node target to 99.99% brings the fleet probability to about 95% for loss of 5%, 10% and 20%, with redundancy of 98, 182 and 372 fragments respectively. The lesson is the standard one from reliability engineering: fleet success is the per-node success multiplied across the fleet, so the target for each node must be far stricter than the target for the fleet.
Redundancy is cheap in airtime and expensive in device memory. Set the per-node success target from the fleet size, not from what sounds reliable for one node.
The Tail of the Fleet Sets the Cost
The previous table assumed every node sees the same loss. Real fleets do not. Most nodes sit in good coverage, a few in poor coverage, and one or two behind obstacles. Because multicast sends the same stream to everyone, the poorest nodes decide how much redundancy the whole stream carries.
Take an illustrative mixed fleet of 500 nodes: 80% at 5% loss, 15% at 20% and 5% at 40%. The script finds the smallest redundancy that gives a 95% chance every node completes.
Data rate | K | Redundancy R | R as a share of K | Airtime | Chance all finish |
DR3, mixed fleet | 1,171 | 895 | 76% | 23.3 min | 95.6% |
DR5, mixed fleet | 556 | 455 | 82% | 6.6 min | 96.8% |
DR3, worst 5% fixed first | 1,171 | 365 | 31% | 17.3 min | 97.3% |
DR5, worst 5% fixed first | 556 | 190 | 34% | 4.8 min | 96.6% |
The worst 5% of nodes, the ones at 40% loss, push the redundancy from about a third of the image to about three quarters of it. Improving their coverage first, or taking them out of the multicast group and updating them separately, cuts the session by roughly a quarter at DR3 and by more than a quarter at DR5, and it reduces the memory the whole fleet must provide for recovery.
This is the point where a field visit beats software. A node at 40% fragment loss is a node with an antenna problem, a cable problem or a placement problem. A new antenna costs less than the redundancy it saves, and it improves the node's ordinary uplink reliability as a bonus.
What Class C Costs the Battery
A node in a Class C session leaves its receiver on for the whole session. Take a receive current of 6 mA as an illustrative value for a low-power sub-gigahertz radio; the true figure depends on the part and the bandwidth, so use your own datasheet number. For the DR3 session with 5% loss, the airtime including redundancy is 14.3 minutes, and the receiver energy is about 1.4 mAh. For the 20% loss case, 17.4 minutes gives 1.7 mAh.
Those figures assume the receiver opens exactly when the first fragment starts and closes when the last ends. It never does. The window has to start before the first fragment to absorb clock error, and it runs after the last fragment while the node reports its status. Pad the window to two hours, as a cautious operations plan might, and the cost is 12 mAh. On a 2,400 mAh cell that is half a percent of capacity, which is acceptable once or twice a year and not acceptable monthly.
Session window | Receiver on-time | Energy at 6 mA | Share of a 2,400 mAh cell |
Exact airtime, 5% loss at DR3 | 14.3 min | 1.4 mAh | 0.06% |
Exact airtime, 20% loss at DR3 | 17.4 min | 1.7 mAh | 0.07% |
Padded to 1 hour | 60 min | 6 mAh | 0.25% |
Padded to 2 hours | 120 min | 12 mAh | 0.50% |
Padded to 4 hours | 240 min | 24 mAh | 1.00% |
The numbers say two things. A single session is a small charge on the battery whatever the padding, so energy alone does not forbid Class C for most nodes. And the padding is the real variable: a node that opens its receiver four hours before it is needed spends sixteen times the energy of one that opens it for a quarter of an hour. Tight clocks save more battery than clever scheduling.
One caution applies to the cap discussion earlier. A gateway at a 10% duty cycle spends nine tenths of the session silent, but every device in a Class C group is still listening through those silent periods. A session stretched over hours by the cap holds the receivers open for those hours too. The wall time from the duty-cycle table, not the airtime, is what the battery pays for. For the DR3 image at a 10% gateway cap, the receiver on-time is therefore closer to 2.4 hours than to 14 minutes, which is about 14 mAh at 6 mA. Class B ping slots, which wake the receiver only briefly at scheduled moments, trade a slower session for a far lower average receive current, and are the better fit when sessions are stretched by tight caps.
The Planner Script
The planning arithmetic fits in a short script. It uses the time-on-air formula from the transceiver datasheets, the India 865 MHz data-rate table, and a binomial tail for the redundancy. The excerpt below shows the three core functions. The full script also prints the tables in this guide.
import math
def toa(pl_bytes, sf, bw=125000.0, cr=1, crc=0, preamble=8, header=0):
tsym = (2 ** sf) / bw
de = 1 if (sf >= 11 and bw == 125000.0) else 0
num = 8 * pl_bytes - 4 * sf + 28 + 16 * crc - 20 * header
den = 4 * (sf - 2 * de)
n_payload = 8 + max(math.ceil(num / den) * (cr + 4), 0)
return (preamble + 4.25) * tsym + n_payload * tsym
MAC_OVERHEAD = 13 # MHDR, DevAddr, FCtrl, FCnt, FPort, MIC
FRAG_HEADER = 3 # command id + index/counter word
IN865_DR = {0:(12,51), 1:(11,51), 2:(10,51), 3:(9,115), 4:(8,242), 5:(7,242)}
def frag_size(dr):
return ((IN865_DR[dr][1] - FRAG_HEADER) // 4) * 4
def frag_toa(dr):
return toa(frag_size(dr) + FRAG_HEADER + MAC_OVERHEAD, IN865_DR[dr][0])
def p_device_ok(total_sent, need, p_loss):
q = 1 - p_loss
s = 0.0
for k in range(need, total_sent + 1):
lg = (math.lgamma(total_sent + 1) - math.lgamma(k + 1)
- math.lgamma(total_sent - k + 1)
+ k * math.log(q) + (total_sent - k) * math.log(p_loss))
s += math.exp(lg)
return min(s, 1.0)
Two details in the code are easy to get wrong. The binomial terms overflow floating point for a thousand fragments if computed directly, so the script works in logarithms; a first version that multiplied large combinations failed with an overflow error. And the low-data-rate optimisation flag, DE, must be on for SF11 and SF12 at 125 kHz, which changes the airtime of DR0 and DR1 noticeably. The sanity check in the script asserts that a 23-byte SF12 frame stays inside the expected range, and the output for DR0 reproduces the 2.8-second fragment time from the published worked example.
Verifying the Image Before It Boots
What it is. A device that has received all the fragments holds a candidate image. Before it runs that image the device must confirm it is the intended one and that it is intact.
How to do it. Check the whole image against a signature produced by a key the device trusts, and check an integrity value such as a CRC or a hash as a cheap first test. The transport's own error correction guards against loss on the radio, not against a tampered or truncated image, and a CRC protects against accident, not against an attacker. The signature is what tells the device that the image came from you.
Do the verification in the bootloader or in a trusted stage, against an image in a staging area, never against the image that is running. Keep the manifest small: version, size, hash, signature and the minimum version the device may upgrade from.
How it fails. A device that checks only the transport CRC will boot a corrupted image that happened to pass, and a device that checks the signature but accepts any older signed image can be pushed back to a vulnerable version by anyone who can replay old fragments. Add an anti-rollback counter, a version number that the device refuses to go below, and store it where a swap cannot erase it.
Check before moving on. Send a deliberately corrupted image and a validly signed older image to a bench device and watch it reject both.
Swapping, Confirming and Rolling Back
What it is. The device reboots into the new image. It has to prove the new image works, and if it does not, return to the old one without a human.
How to do it. Use a bootloader that supports a test swap: it boots the new image once, and unless the new image marks itself as confirmed, the next reset restores the old one. The new application should confirm only after it has done something that proves the radio, the sensors and the network join all work, not merely after it has started.
Keep the old image until the new one has run for a defined period. A rollback that exists only on paper, with the old image already overwritten, is not a rollback.
How it fails. The commonest failure is an image that boots, confirms itself early, and then fails to rejoin the network. The node is now unreachable with no old image to return to. The second is a power loss during the swap that leaves two half-written images. Both are bootloader problems and both are tested on the bench, with the power pulled at random moments, long before a fleet sees the code.
Check before moving on. Pull the power at one hundred random points during a swap on a bench unit. A bootloader that comes back every time is ready. One that bricks once in a hundred will brick dozens of nodes in a fleet of thousands.
The transport is the easy half of an update. A fleet is lost or saved in the verification and the rollback, and those are tested with the power cable.
When FUOTA Is the Wrong Tool
Some updates do not belong on a low-power wide-area link at all. If the image is 512 kB or larger, even the fast data rates need tens of minutes of airtime and hours of wall time, and the redundancy for a poor fleet grows with it. If the fleet sits in poor coverage, the redundancy needed swallows the saving. If the product is a mains-powered gateway-class device with a second path, such as Ethernet, cellular or Wi-Fi, use the better pipe and keep LoRaWAN for the commands.
A site visit is the right answer in some cases. A node that needs a hardware revision cannot be fixed with software, and a node at 40% fragment loss needs an antenna, not a better algorithm. The honest costing of an update programme includes a line for the nodes that need a person.
There is also the case where an update is a bad idea. A fleet that works, with a bug that is cosmetic, does not need a session that risks a node in every hundred. Every update is a small chance of losing a node, so the question for each release is whether the fix is worth that chance. The delta, the test swap and the canary group exist to shrink the chance, never to remove it.
A Rollout Plan for the First Hundred Nodes
A plan that moves from small to large in four stages keeps the first mistakes cheap.
Bench. Run the full path on three devices with the gateway model you deploy: clock correction, multicast group setup, the fragmentation session, a status request to see who is missing, verification, swap and rollback. Include a deliberately corrupted image and a pulled power cable. Do not leave the bench until every step is repeatable.
Canary. Update ten nodes chosen for variety: one near a gateway, one far, one in a metal enclosure, one on the lowest battery state you allow. Read the status reports and the per-gateway counters. Compare actual airtime and receiver on-time with the plan from this guide.
Tenth of the fleet. Update a tenth, drawn evenly from sites. Measure the failure rate and where the failures sit. If more than a few per cent fail, stop and read the signal margin, not the redundancy setting.
The rest. Schedule in groups sized to the gateway budget, with the follow-up session for failures planned in advance, and keep a rollback image on the server for the whole period.
At each stage compare three numbers with the plan: the airtime sent, the receiver on-time spent, and the fraction of nodes that completed. If the airtime is higher than planned the data rate or fragment size is wrong. If the on-time is higher the windows are padded too widely. If the completion fraction is lower the loss tail was underestimated.
Keep the planner script in the repository next to the firmware, and re-run it at each release with the real image size. The tables in this guide took seconds to produce and they replace a great deal of guessing in a planning meeting.
Back to the 128 Kilobytes
The image from the opening is 1,171 fragments, thirteen minutes of airtime, and from two to twenty-two hours of calendar depending on the duty-cycle cap. With a fleet of five hundred nodes the redundancy needed depends less on the average node than on the worst few, and the receiver cost per node is a small fraction of a battery when windows are tight and a noticeable one when they are not. The same image as a 24-kilobyte delta is 105 fragments and about a minute and a half of airtime.
None of that is hard once it is written down. The updates that fail in the field are rarely the ones that were planned on paper; they are the ones that were planned in a console. Work the arithmetic first, test the verification and rollback with the power cable, update the canary before the fleet, and the 128 kilobytes become routine.
Related service: LoRaWAN & IoT Connectivity
Related case study: LoRaWAN and ChirpStack Integration for Massive Scale
Related reading: OTA Firmware Updates in IoT: Architecture Patterns That Actually Scale, LoRaWAN Gateway Buyer's Guide for India: Channels, Certification and Capacity and Secure Boot and Firmware Signing for Embedded Products: From Key Generation to Field Revocation
EurthTech is an engineering-first product design and embedded systems company with a development center in Hyderabad. To discuss a project, write to connect@eurthtech.com or see https://www.eurthtech.com/case-studies.




Comments