Compliance & Verification
IEC 62304 Class C medical firmware anomaly testing
Exercise every alarm state and sensor-fault mitigation on your real compiled MCU binary on every pull request.
IEC 62304 Class C software demands thorough anomaly and boundary verification of segregated safety items. Manual bench tests cannot cover every combination of stuck sensors, NACK bursts and watchdog trips after every hotfix.
CircuitTwin turns medical firmware anomaly tests into version-controlled YAML suites that execute identically on developer laptops and locked CI runners.
Class C anomaly checks
| Hazard control | Fault injected | Verification assertion |
|---|---|---|
Stuck pressure/flow reading | frozen_reading on I2C pressure sensor | Firmware detects stale sample and raises alarm |
Bus lockup | Sustained I2C NACK burst | 9-clock bus recovery executes within deadline |
Memory corruption | MPU stack guard / MemManage test | Safe-state actuator cutoff engages immediately |
Local CLI workflow
Shell - run IEC 62304 anomaly suite
ct test run --json --recheck --junit results/iec62304.xml tests/class-c-anomalies.suite.yamlSuite & fault configuration
tests/class-c-anomalies.suite.yaml
version: 1
board: nucleo-l476rg
firmware: build/infusion_ctrl.elf
tests:
- name: pressure-sensor-frozen-alarm
timeout_ms: 3000
faults:
- at_ms: 400
part: bmp390
kind: frozen_reading
expect:
console_contains: "ALARM_STALE_PRESSURE"
exit_code: 0CI pipeline integration
.github/workflows/iec62304-ci.yml
name: IEC 62304 Verification CI
on: [push, pull_request]
jobs:
class-c:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: circuittwin/action@v1
with:
suite: tests/class-c-anomalies.suite.yaml
junit-out: results/iec62304.xmlTroubleshooting checklist
| Symptom | Fix |
|---|---|
| Stale sensor reading goes undetected | Compare consecutive raw ADC samples or check sensor status/counter bits before trusting readings. |
| Alarm latency exceeds spec | Inspect exact virtual-time delta between fault timestamp and console alarm in the JSON output. |
Frequently asked questions
| Question | Answer |
|---|---|
| Can virtual-time timestamps measure alarm response latency? | Yes. Every fault injection and console line carries a deterministic virtual-time timestamp in the JSON run log. |