embassy-rs/embassy · critical
Read corruption for stm32f42xxG and stm32f43xxG in dual…
Error message
Read corruption for stm32f42xxG and stm32f43xxG in dual bank mode when PA12 is in use for chips below revision 3, see errata 2.2.11
What it means
Same errata 2.2.11 as the I-variant case, but for STM32F42x/43xG 1MB parts when the flash is in dual-bank mode: reading the second bank with rev_id below revision 3 while PA12 is not an output driven low corrupts reads. Embassy panics to avoid returning silently corrupted data.
Solutions
- Drive PA12 as a low output before any flash access on affected revisions.
- Use silicon revision 3+ parts where errata 2.2.11 is fixed.
- Reconfigure the option bytes to single-bank mode (db1m) so second-bank reads never occur, if 1MB single-bank fits your needs.
- Pick a different pin for USB/GPIO functions so PA12 stays tied low during flash operations.
Example fix
// before let mut flash = Flash::new(p.FLASH); // dual-bank G variant, PA12 in use, rev<3: panics // after let mut pa12 = Output::new(p.PA12, Level::Low, Speed::Low); drop(pa12); // ensure PA12 is output-low before flash use let mut flash = Flash::new(p.FLASH);
Defensive patterns
Strategy: validation
Validate before calling
// guard: only perform second-bank reads when safe
fn second_bank_read_safe(rev_id: u16, pa12_low: bool, dual_bank: bool) -> bool {
!(dual_bank && rev_id < 3 && !pa12_low)
} Prevention
- Avoid PA12 (USB D+) duty on 1MB dual-bank F42x/43xG parts below rev 3
- Use single-bank option-byte config when dual-bank is not required
- Verify chip revision early in bring-up
When it happens
Trigger: Second-bank flash read on stm32f42xxG/stm32f43xxG with rev_id < REVISION_3, dual-bank mode active, and PA12 not configured as output-pull-low.
Common situations: 1MB F4 chips configured dual-bank via the db1m option byte, PA12 used for USB or GPIO, flash operations on early silicon revisions.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- Read corruption for stm32f42xxI and stm32f43xxI when PA12…
- Embassy is configured as dual-bank, but the hardware is…
- Embassy is configured as dual-bank, but the hardware is…
- Embassy is configured as dual-bank, but the hardware is…
- Embassy is configured as single-bank, but the hardware is…
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/2ba11410e253b70a.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-stm32/src/flash/f4.rs:275
feature = "stm32f427vg",
feature = "stm32f427zg",
feature = "stm32f429ag",
feature = "stm32f429bg",
feature = "stm32f429ig",
feature = "stm32f429ng",
feature = "stm32f429vg",
feature = "stm32f429zg",
feature = "stm32f437ig",
feature = "stm32f437vg",
feature = "stm32f437zg",
feature = "stm32f439bg",
feature = "stm32f439ig",
feature = "stm32f439ng",
feature = "stm32f439vg",
feature = "stm32f439zg",
))]
if second_bank_read && pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() {
panic!(
"Read corruption for stm32f42xxG and stm32f43xxG in dual bank mode when PA12 is in use for chips below revision 3, see errata 2.2.11"
);
}
}
#[allow(unused)]
fn pa12_is_output_pull_low() -> bool {
use pac::GPIOA;
use pac::gpio::vals;
const PIN: usize = 12;
GPIOA.moder().read().moder(PIN) == vals::Moder::Output
&& GPIOA.pupdr().read().pupdr(PIN) == vals::Pupdr::PullDown
&& GPIOA.odr().read().odr(PIN) == vals::Odr::Low
}
#[cfg(test)]
mod tests {
use super::*;View on GitHub (pinned to 463a07b963)