Fault Injection & Debugging

Brownout reset and power-rail cycling tests in CI

Verify firmware waits for regulator power-good pins and re-initializes peripherals cleanly after a power-rail drop.

Battery-powered PCBs switch peripheral 3.3 V rails off via load switches or PMIC enable pins to save microamps. If firmware talks to an I2C sensor before its rail ramps up, the bus latches or returns garbage.

CircuitTwin models regulator ramp delays, power-good outputs and MCU-switched device supplies (crates/ct-behavior/src/kinds/parts.rs), letting CI inject rail drops and assert clean recovery.

Power-rail behaviors tested

BehaviorModel elementBug caught
Rail ramp delaystart_delay_ns + ramp_ns + power_good_pinFirmware accesses sensor before rail stabilizes
Switched sensor railSupply attachment on MCU GPIOForgetting to re-init sensor registers after power cycle
Supervisor reset holdUndervoltage delay + reset timeoutBoot race against external flash wake time

Local CLI workflow

Shell - run power-cycle fault suite
ct test run --json --junit results/power-rail.xml tests/power-cycle.suite.yaml

Suite & fault configuration

tests/power-cycle.suite.yaml
version: 1
board: nucleo-l476rg
firmware: build/lowpower_app.elf
tests:
  - name: sensor-rail-power-cycle-reinit
    timeout_ms: 3000
    expect:
      console_contains: "SENSOR_REINIT_AFTER_PWR_OK"
      exit_code: 0

CI pipeline integration

.github/workflows/power-rail-ci.yml
name: Power-Rail Sequencing CI
on: [push, pull_request]
jobs:
  power:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: circuittwin/action@v1
        with:
          suite: tests/power-cycle.suite.yaml

Troubleshooting checklist

SymptomFix
Sensor returns reset defaults after sleep wakeRe-run full sensor configuration registers after re-enabling the switched supply pin.
I2C pins back-power unpowered sensorSet SDA/SCL to analog or low-output before cutting the sensor supply rail.

Frequently asked questions

QuestionAnswer
Does CircuitTwin model regulator startup sequencing and power-good pins?Yes. The pin-logic engine models multi-rail regulators with enable pins, ramp delays, chained after_rail dependencies and open-drain power-good outputs.

Related boards & component twins

More in Fault Injection & Debugging