Compliance & Verification

IEC 61508 SIL-3 diagnostic coverage fault testing

Verify your Flash CRC self-test, watchdog window and dual-channel sensor discrepancy checks fire every time a fault is injected.

Safety diagnostics often rot silently because normal benches never corrupt Flash bytes or freeze one of two redundant sensors. Months later, a linker edit shifts the CRC end symbol and breaks the self-test.

CircuitTwin runs diagnostic negative controls on every commit: flip a byte, stall a task or freeze channel B, and assert your safety firmware enters its safe state within the fault-tolerant time interval.

SIL-3 diagnostic tests in CI

Diagnostic mechanismNegative-control testExpected verdict
Flash CRC-32 self-testCorrupt 1 byte in test image copyPOST rejects image and halts safely
Window watchdog (WWDG)Trigger early refresh or starvationHardware watchdog resets MCU cleanly
Dual-sensor votingOverride register on channel B sensorDiscrepancy threshold trips safe output

Local CLI workflow

Shell - run diagnostic coverage matrix
ct test matrix run --json --junit results/sil3-diag.xml tests/sil3-diagnostics.yaml

Suite & fault configuration

tests/sil3-diagnostics.yaml
version: 1
board: nucleo-f446re
firmware: build/safety_plc.elf
matrix:
  - name: dual-sensor-discrepancy-trip
    faults:
      - at_ms: 200
        part: ads1115
        kind: frozen_reading
    expect:
      console_contains: "SAFE_OUTPUT_OFF"

CI pipeline integration

.gitlab-ci.yml - SIL diagnostic matrix
sil-diagnostics:
  script:
    - ct test matrix run --json --junit results/sil3-diag.xml tests/sil3-diagnostics.yaml
  artifacts:
    reports:
      junit: results/sil3-diag.xml

Troubleshooting checklist

SymptomFix
Hardware CRC-32 self-test mismatches linker checksumVerify STM32 hardware CRC-32 (no reflection, no final XOR) vs IEEE 802.3 in the Embedded CRC Calculator.
Watchdog does not fire during hang testConfirm DBGMCU freeze bits are not masking watchdog counters in release builds.

Frequently asked questions

QuestionAnswer
Why run negative-control tests on safety diagnostics?A diagnostic test that only checks the happy path cannot prove the alarm actually works. Injecting a real fault proves the safe state triggers.

Related boards & component twins

More in Compliance & Verification