In mid-July, our field operations lead walked into my office holding his phone: "Three devices at the pump station in Manisa have been silent since midnight. The technician went out; the power LED is on, but the device won't boot." The night before, we had pushed firmware 3.4.0 to 2,100 devices. Three in Manisa and seventeen in other cities, a total of 20 devices had failed to come out of the update. A 99 percent success rate looks great in presentations; in the field, 20 devices means 20 trips, 20 technician visits, an average of 1,400 TL per device in travel and labor costs, plus a phone call to the customer saying "you're missing three days of data." That morning I was reminded once again that OTA isn't a statistics job; it's nightmare management.
Anatomy of a Brick
When we had the dead devices brought to the warehouse and opened them up over JTAG, the picture became clear: on every one of them, the new image had been written to flash incompletely. Not during the download — the download was verified with SHA-256 — but during the write. What these 20 devices had in common was that they were the oldest hardware revision in the field, and on that revision the power regulator's margin was narrow. If the GSM modem was also sending data at the moment the flash write current peaked, a 150-millivolt dip formed in the supply voltage and the microcontroller went into a brown-out reset. The write was left half-finished, and at boot the device found an invalid image and stopped.
Naturally, this wasn't our first hypothesis. For two days we chased the possibility that "a corrupt image was distributed"; we compared the file on the CDN byte by byte, and it was identical. Then we said "the flash has worn out"; we looked at the wear levels, and they were normal. What led us to the real cause was that on every dead device, the last log line coincided with a modem TX event. We kept sending telemetry while the firmware was being updated — because nobody had thought to say "stay quiet during the update." One line of the fix was exactly that: put the modem to sleep during the write phase.

The A/B Scheme Existed on Paper, Not in Our Mindset
Here's the truly embarrassing part: our devices already had an A/B partition scheme. Two image slots, slot selection logic in the bootloader — it was all in place. So how did 20 devices brick? Because we had implemented A/B "partially," on the grounds that disk space was expensive: the application image had two copies, but the boot flags region the bootloader reads was single, and it was updated before the new image was verified. When the brown-out hit exactly in that window, the bootloader took the half-written B slot to be "valid" and jumped to it, and when it couldn't boot, it didn't know how to go back to A. The entire value of an A/B scheme lies in the atomicity of the switchover moment; we had punched a hole in that atomicity, and only the field could tell us so.
In the redesign we set three rules. One: the boot flag write is single-sector, checksummed, double-copied, and the very last operation performed. Two: a device that switches to a new image marks itself as being in "trial mode"; if it can't connect to the cloud and report its health within 10 minutes after boot, the hardware watchdog resets the device and the bootloader automatically falls back to the old slot. Three: under no circumstances is the bootloader itself updated over OTA; there's a separate, signed procedure for that, tested at the factory. Within the team we call this trio the "no-regrets protocol."

Catching the 1 Percent in the Rollout Plan, Not in the Field
The technical rollback mechanism is half the job. The other half is preventing a faulty image from reaching 2,000 devices at once in the first place. Before the 3.4.0 incident, our rollouts had two stages: a 50-device pilot, then everyone. The pilot didn't include a single device from that old hardware revision — we had picked the pilot group from "easy to reach" devices, new-revision units in central İzmir with strong network coverage. In other words, our pilot didn't represent the fleet; it only tested the best-case scenario.
Now the rollout rings are required to cover breakdowns by hardware revision, network operator and signal quality. The first ring is 25 devices, and it includes at least two devices from every revision, every operator and the regions tagged "bad network." The second ring is 5 percent, the third is 25 percent, and then everyone else. Progression between rings is automatic but conditional: if boot success in the updated group drops below 99.5 percent, or if the share of devices with telemetry silence longer than 30 minutes exceeds 5 per thousand, the rollout halts itself and an alert lands in Slack. The panel in Grafana that tracks these thresholds is known within the team as the "heart monitor"; on rollout days, it's open on everyone's second screen.

Then there's the topic nobody likes to talk about: delta updates. Our full image is 1.9 MB; a device on 2G downloaded it in 11 minutes on average, sometimes 40 minutes on flaky connections, and every interruption meant starting over. We were already resuming from where the download left off using HTTP range requests, but the real gain came from switching to binary diffs: the typical delta between versions dropped to 140-300 KB, the download time fell to 90 seconds on average, and a sizable line item disappeared from our monthly data costs. The price is that the delta generation chain is itself software that needs testing — a delta applied to the wrong base version is the sneakiest source of a corrupt image. That's why the delta package header carries the hashes of both the base and the target image, and the device doesn't write a single byte until it has verified both.
I shouldn't skip signing either, because it's as critical as the rollback mechanism: devices accept only images signed with our private key, and verification is done twice — not when the download finishes, but before writing and during boot. The signing key lives in an HSM, and signing happens in the last step of the CI pipeline, which requires human approval. Once, an intern accidentally uploaded a test image to the production rollout channel; because the image was signed with the test key, not a single device in the field accepted it, and the incident turned into an onboarding story instead of a disaster. The security chain exists to protect you from your own hands on the day you're most tired.
The Right Dose of Fear
In the 18 months since 3.4.0, we've done 31 OTA rollouts; more than 60,000 update operations in total, zero bricks. But the number that really changed is this: the tension in the team before a rollout. It used to be that nobody took a day off on OTA day, and people slept with their phones on. On the day we rolled out 3.7.2, I was in a meeting and only found out from the summary email that evening. The fear hasn't gone away — and it shouldn't. It has just moved: it now lives in the design meeting, not on rollout night. "What does this change do at the moment of a brown-out?" is a written item in every firmware PR template.
The most lasting lesson I've learned about OTA is this: an update system is designed not for the happy-path scenario but for the power going out at the worst possible moment. Devices in the field will lose power, the network will drop, a user will pull the plug right in the middle of a write — these aren't exceptions, they're statistical certainties. A one-in-a-thousand chance across 10,000 devices means 10 site visits per rollout. If you're building an OTA process for your own fleet, or you're at the point of "we had one bad experience and now we're afraid to update," get in touch with me; I can tell you firsthand what it's like both to live with that fear and to turn it into a protocol.
I still keep those three devices from Manisa in the warehouse, on the shelf across from my desk. I show them to every new embedded software engineer who joins and say the same sentence: "These aren't bugs, they're a lesson. And the field cost of that lesson was 28,000 TL."