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 mechanism | Negative-control test | Expected verdict |
|---|---|---|
Flash CRC-32 self-test | Corrupt 1 byte in test image copy | POST rejects image and halts safely |
Window watchdog (WWDG) | Trigger early refresh or starvation | Hardware watchdog resets MCU cleanly |
Dual-sensor voting | Override register on channel B sensor | Discrepancy 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.yamlSuite & 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.xmlTroubleshooting checklist
| Symptom | Fix |
|---|---|
| Hardware CRC-32 self-test mismatches linker checksum | Verify STM32 hardware CRC-32 (no reflection, no final XOR) vs IEEE 802.3 in the Embedded CRC Calculator. |
| Watchdog does not fire during hang test | Confirm DBGMCU freeze bits are not masking watchdog counters in release builds. |
Frequently asked questions
| Question | Answer |
|---|---|
| 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. |