Skip to content

F0077 pin-16

Rule: Pins held by a dead-battery pull-down are read only after it is released.

Code F0077 (stable, never reused)
Id pin-16
Category pin
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: Pin read that a dead-battery pull-down still holds (G0 UCPD DBCC pins until the SYSCFG strobe; never clear the strobe again)
ui off
egui off
units-strict off
units-paranoid off

Why

STM32G0's UCPD block drives a dead-battery pull-down on its CC/USB pins that's active by default from reset (so a Type-C dead-battery device still looks like a cable-powered sink before any firmware runs). The pull-down is released by a specific SYSCFG strobe bit, and once that strobe has been set it must stay set โ€” clearing it again re-arms the dead-battery pull-down, so a pin that's being read for something unrelated to UCPD can still be held low (or see a glitch on each configure) by a pull-down the firmware thought it had already turned off for good.

Example

Typec_dongle's board-variant detection (FW-22) reads PA10 against the MCU's own ~40k pull-up to tell Main from Plus hub variants โ€” but PA10 is also a UCPD1 dead-battery pin, so the read only works after releasing UCPD1's dead-battery pull-down via SYSCFG.cfgr1().ucpd1_strobe(), and the firmware never clears that strobe again afterwards (clearing it would silently re-enable the pull-down and break the read, and every other use of the pin, until the next reset).

How to fix

Release the dead-battery pull-down on every UCPD-capable pin the firmware repurposes, once, early, and never write the strobe back to its "re-arm" state afterwards; treat the strobe as a one-way boot-time latch, not a toggle.

How it is checked

Check: src mid ยท chip: G0 โ€” recognizing "this pin is also a UCPD dead-battery pin" needs the chip's pin table; recognizing a strobe write that clears what an earlier one set needs the firmware model, not just a single-line pattern.

Source

Ported from embedded_bedrock's firmware check catalogue, PIN-16 (book/checks.md, detail in book/checks/pin.md). Found on: typec_dongle FW-22.

Configure

[lints.pin-16]
level = "deny"
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(pin-16) <reason> (waivers); the code works there too, as in [lints.F0077].