fix: add C_LATCH_G1 to stop a ~2ms PWR_EN blip on battery insertion - #60
Merged
Merged
Conversation
There's no physical board yet, so this was found by simulating the button/inverter/latch circuit in ngspice (KiCad's bundled libngspice) after a validator run claimed the board would power itself on. That claim doesn't hold (off-state base sits ~0.6-0.7V because the button node is only grounded through R_BTN_PU1, and a fast 3V3 collapse at shutdown never lifts the latch gate), but the simulation did show a real, minor transient: on battery insertion Q_INV1 isn't conducting until C_DBNC1 charges through D_INV_ISO1, so PWR_LATCH_G briefly rises to ~VSYS-0.6V and PWR_EN pulses ~1.9ms. This existed before the 3V3 pull-up change too (~1.4ms). C_LATCH_G1 (100nF 0402, same part as C_DBNC1) from PWR_LATCH_G to GND slows the gate rise so the transient peaks at ~0.3V, under the AO3400A's minimum threshold, at a cost of 4-8ms of press latency. 100nF chosen over 47nF, which peaked at ~0.65V, right at a minimum-threshold part. Layout diagrams/docs updated (callout I, routing step 8); production files regenerated. ERC/DRC clean, all parts have MF/MPN. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- scripts/spice/latch_sim.py: ngspice (KiCad's bundled libngspice) check of the soft-latch with pass/fail assertions for battery insertion, a press across supply/FET-threshold corners, and shutdown. Reproduces the insertion blip fixed by C_LATCH_G1 (fails with --cap 0) and the gate-margin reason for choosing 100nF over 47nF. README documents what is and isn't modeled. - PCB/snips_controller.kicad_pro: KiCad's reordered used-designators list. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #59. A validator run claimed the board would power itself on whenever a battery is connected and could not stay off. With no physical board yet to bench-test, I simulated the button/inverter/latch circuit in ngspice (KiCad's bundled
libngspice, driven from Python) instead.The validator's claim doesn't hold:
Q_INV1base sits at ~0.6–0.72V, so the inverter stays on. The button node is only grounded throughR_BTN_PU1(100kΩ), soD_INV_ISO1can't clamp the base down to 0.3V.PWR_LATCH_G(stays at 0V) — no re-trigger.But it did surface a real, minor transient (pre-existing: ~1.4ms with the old VSYS pull-up, ~1.9ms now): on battery insertion
Q_INV1isn't conducting untilC_DBNC1charges throughD_INV_ISO1, soPWR_LATCH_Gbriefly rises to ~VSYS−0.6V andPWR_ENpulses high ~1.9ms. It does not latch on; whether a 2ms buck-enable pulse is harmless depends on ESP32 boot timing, which I did not simulate.Fix:
C_LATCH_G1— 100nF 0402 (same Samsung part asC_DBNC1, so no new BOM line) fromPWR_LATCH_Gto GND. Simulated peak gate voltage drops to ~0.33V, under the AO3400A's minimum threshold. 100nF chosen over 47nF, which peaked at ~0.65V, right at a minimum-threshold part. Cost: 4–8ms of added press latency; release also holds slightly longer.scripts/spice/latch_sim.py(+ README): the simulation used here, as a rerunnable check with pass/fail assertions (--cap 0reproduces the insertion blip; exit code 1 on failure). Plus KiCad's reordered used-designators insnips_controller.kicad_pro.Caveats
Test plan
kicad-cli sch erc— 0 errors, 1 pre-existing benign warning (D_RGB1lib_symbol_mismatch)kicad-cli sch export netlist—C_LATCH_G1pin 2 onPWR_LATCH_G, pin 1 onGNDkicad-cli pcb drc— 0 violations, 0 unconnected pads; cap placed ~2.5–3mm fromD_OR2/R_LATCH_G1/Q_LATCH1PWR_ENon battery insertion and confirm a held press latches at low battery🤖 Generated with Claude Code