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 controlFault injectedVerification assertion
Stuck pressure/flow readingfrozen_reading on I2C pressure sensorFirmware detects stale sample and raises alarm
Bus lockupSustained I2C NACK burst9-clock bus recovery executes within deadline
Memory corruptionMPU stack guard / MemManage testSafe-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.yaml

Suite & 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: 0

CI 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.xml

Troubleshooting checklist

SymptomFix
Stale sensor reading goes undetectedCompare consecutive raw ADC samples or check sensor status/counter bits before trusting readings.
Alarm latency exceeds specInspect exact virtual-time delta between fault timestamp and console alarm in the JSON output.

Frequently asked questions

QuestionAnswer
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.

Related boards & component twins

More in Compliance & Verification