Firmware is the part of a medical device nobody sees and everybody depends on. It reads the sensor, drives the pump or the display, decides when to alarm, talks to the phone or gateway, and must keep doing all of that safely for years on a small processor and a battery.
This post covers how to design embedded firmware for medical devices: the layered architecture, how safety is built into the design rather than tested in at the end, how updates are delivered and verified, how connectivity is handled, and how firmware is tested on real hardware. It is written for device teams and the software partners who work with them.
What is embedded system design in healthcare?
Building firmware for a medical device?
Our system integration page covers the firmware, gateway and cloud connections we build for device makers.
Embedded system design in healthcare is the architecture and engineering of the firmware that runs inside medical devices, covering clinical logic, safety monitoring, device services, hardware drivers and timing, so the device behaves predictably on constrained hardware. Agnotic Technologies designs firmware in layers that can be tested, updated and reviewed separately.
Good firmware design is mostly about saying what each part is not allowed to do.
How should medical device firmware be layered?
Medical device firmware should be layered so that clinical logic never touches hardware directly, an independent safety monitor can act on any fault, and drivers sit behind interfaces that tests can replace. Each layer calls only the layer below it.
Layering pays off in three places: unit tests run on a desktop without hardware, a hardware change touches only drivers, and reviewers can see where safety decisions are made.
Bare metal, scheduler or RTOS?
Choose bare metal for very simple devices with one main loop, a cooperative scheduler for a few predictable tasks, and a real-time operating system when tasks have different priorities and hard timing needs. The choice should follow the timing analysis, not team habit.
- Bare metal: smallest footprint and easiest to reason about, but hard to extend.
- Cooperative scheduler: simple and predictable if every task yields quickly.
- RTOS: priorities and timing guarantees, at the cost of more configuration and review.
- Third-party code: an RTOS or stack you did not write still needs a version record and risk assessment.
How is safety designed into firmware?
Safety is designed into firmware by defining safe states, checking inputs and outputs independently, and making sure a fault leads to a known, safe behavior. The risk analysis decides which faults need which controls.
- Safe state: what the device does on any unhandled fault, such as stopping delivery and alarming.
- Range checks: sensor values outside physical limits treated as faults, not data.
- Watchdog: a hardware timer that resets a stalled system, with the reset reason logged.
- Redundant checks: critical outputs verified by a second path, such as reading back a motor position.
- Memory protection: separating safety code from the rest where the processor supports it.
Which quality system expectations shape the firmware process?
Device firmware is built under the manufacturer's quality system, so requirements, design reviews, verification and changes all leave records. The firmware team works inside that process rather than alongside it.
FDA's Quality Management System Regulation in 21 CFR Part 820 incorporates ISO 13485:2016 by reference for medical device manufacturers.
In practice, that means firmware requirements traced to tests, code reviews recorded, builds reproducible from tagged sources, and every release linked to its verification results.
How should firmware updates be delivered?
Firmware updates should be signed by the manufacturer, verified by the device before installation, installed into a second image slot and switched only after a successful boot check. A failed update must never leave a device unusable.
- Secure boot: the boot ROM checks the signature of each image before running it.
- A and B slots: the new image is written beside the old one, so the device can fall back.
- Rollback protection: older, vulnerable images cannot be reinstalled.
- Timing: updates applied only when the device is not in clinical use, with the user's knowledge.
Section 524B of the FD&C Act sets cybersecurity requirements for cyber devices, and FDA guidance describes the cybersecurity documentation it recommends in premarket submissions for devices with cybersecurity risk.
How should connectivity be handled?
Connectivity should be treated as unreliable and untrusted. The device must keep working safely when the link drops, and must not accept commands it cannot authenticate.
The Bluetooth SIG publishes adopted GATT service specifications for health devices, including the Blood Pressure, Glucose, Health Thermometer, Pulse Oximeter and Weight Scale services.
Use standard profiles where they fit, so phones and gateways can read data without custom code. Buffer readings with timestamps while disconnected, send them in order on reconnection, and keep pairing and bonding under the user's control.
Power, memory and timing budgets
Embedded devices run within fixed budgets for battery, memory and processor time. Write the budgets down early and measure them on every build, because small additions add up.
Track battery drain per feature in realistic use, peak memory per task with margins, and worst-case timing for safety tasks. A new logging feature that delays an alarm task is a safety problem, not a performance one.
How should device data and logs be stored?
Store clinical readings, device events and service logs in separate areas of memory, each with its own retention rule and level of protection. A full log partition must never stop the device from saving a reading or raising an alarm.
- Readings: written atomically with a timestamp and sequence number, so power loss cannot corrupt them.
- Event log: resets, faults, alarms and updates, kept in a ring buffer the service team can read.
- Secrets: keys and pairing data in protected storage, never in the general file system.
- Personal data: only what the device needs, and cleared when the device is reset for a new patient.
Plan how field logs reach the manufacturer. Watchdog resets and fault events from devices in use are the earliest warning of a design problem.
How should firmware be tested?
Firmware should be tested at three levels: unit tests on a desktop against the hardware abstraction, integration tests on target hardware, and hardware-in-the-loop tests where simulated sensors and actuators drive fault conditions.
Hardware-in-the-loop rigs are where safety behavior gets proven: inject a sensor fault, cut power mid-write, drop the radio during an update, and confirm the device reaches its safe state every time.
What goes wrong in medical device firmware?
Firmware problems tend to come from shortcuts taken to meet a demo or a hardware deadline. These patterns cause most of the rework.
- Logic tied to hardware: clinical code reading registers directly, so tests need the device.
- Unsigned updates: field updates possible without verifying their origin.
- Silent resets: watchdog resets that are never logged or investigated.
- Clock drift: readings stamped with a clock that was never synced, so data arrives out of order.
- Unbudgeted features: additions that push timing or battery past their limits.
A worked example: a connected blood pressure monitor
A team designs firmware for a cuff that measures blood pressure and sends readings to a phone app. The clinical layer controls inflation and runs the measurement algorithm; the safety monitor caps cuff pressure and inflation time independently.
Readings are stored with timestamps and sent over a standard Bluetooth profile when the phone is in range. Updates arrive through the app, are verified against the manufacturer's key, and install into a second slot only when the cuff is idle.
A hardware-in-the-loop rig simulates a stuck pressure sensor and a power cut mid-update, and the release record links each result to its requirement.
Who owns what in firmware development?
Firmware crosses electrical, software, quality and regulatory work, so ownership must be explicit.
- Firmware lead: architecture, layering rules and budgets.
- Hardware lead: drivers, board revisions and test rigs.
- Safety and risk lead: hazards, safe states and verification of controls.
- Security lead: keys, signing, secure boot and vulnerability handling.
- Quality lead: traceability, reviews and release records.
What are embedded system design best practices in healthcare?
Layer the firmware, keep an independent safety monitor, define safe states, sign and verify every update with a fallback image, treat connectivity as unreliable, budget power, memory and timing, and prove fault handling on hardware-in-the-loop rigs.
Write the architecture rules on one page and check them in code review, because layering erodes one shortcut at a time.
How Agnotic can help
Agnotic designs and builds medical device firmware and its connections: layered architectures, safety monitors, secure boot and signed updates, Bluetooth links to apps and gateways, and test rigs that produce verification evidence.
Plan secure device firmware with Agnotic
We design update signing, secure boot and vulnerability handling for connected devices.
Related reading on Agnotic
Device testing, standards and IoT.


