F0083 pwr-1¶
Rule: A brown-out reset level or voltage detector fits the board's supply.
| Code | F0083 (stable, never reused) |
| Id | pwr-1 |
| Category | pwr |
| Source | spirit_level |
| Fix | by hand |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | off | |
| big | off | |
| ai | off | |
| embedded | warn |
bedrock warning: No brown-out reset level or programmable voltage detector (PVD) for the supply the board really has |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Why¶
No brown-out reset threshold configured (or no programmable voltage detector set up on parts that need one explicitly) matching the supply the board actually has.
Without a brown-out level matched to the real supply, a sagging rail runs the MCU below the voltage its flash and peripherals are specified for instead of resetting it; the failure that follows (a flash write that doesn't take, a peripheral that misbehaves) looks unrelated to power at all, because nothing flagged the sag as the cause.
Example¶
A firmware counts brown-out resets but never sets a brown-out reset level or the voltage detector, so it runs on through a sagging supply until it corrupts flash:
let p = embassy_stm32::init(Default::default());
if last_reset() == ResetCause::Brownout {
cnt!(brownouts: u32);
}
How to fix¶
Set the brown-out threshold (option bytes, or PVD) to a level safely above the board's minimum operating voltage, not left at the chip's factory default if that doesn't match the board.
How it is checked¶
src easy: the brown-out/PVD configuration call must be present in init() and its threshold compared against the board's nominal supply voltage from the board record.
Source¶
Ported from embedded_bedrock's firmware check catalogue, PWR-1 (book/checks.md, detail in book/checks/pwr.md). Found on: notion.
Configure¶
Allow one finding in the code with // spirit-level: allow(pwr-1) <reason> (waivers); the code works there too, as in [lints.F0083].