embassy-rs/embassy · critical

Read corruption for stm32f42xxI and stm32f43xxI when PA12…

Error message

Read corruption for stm32f42xxI and stm32f43xxI when PA12 is in use for chips below revision 3, see errata 2.2.11

What it means

On STM32F42x/43xI (2MB, single-bank-as-I variant) parts below silicon revision 3, hardware errata 2.2.11 causes flash reads of the second bank to be corrupted when PA12 is used as a non-output-pull-low pin. Embassy deliberately panics at flash-read setup to prevent silent data corruption rather than returning wrong bytes.

Solutions

  1. Free PA12 and configure it as an output pin pulled low before performing flash operations on affected revisions.
  2. Upgrade to silicon revision 3 or later of the affected STM32 part (check rev_id via DBGMCU).
  3. Switch to a non-affected part variant/size that is not covered by errata 2.2.11.
  4. Avoid second-bank flash reads on affected hardware, or gate firmware features requiring flash access on chips with PA12 in use.

Example fix

// before
let mut dp = embassy_stm32::init(config); // PA12 used as USB D+
let mut flash = Flash::new(p.FLASH); // panics on rev<3
// after
let mut pa12 = Output::new(p.PA12, Level::Low, Speed::Low); // errata workaround
let mut flash = Flash::new(p.FLASH);
Defensive patterns

Strategy: validation

Validate before calling

// at boot, before flash ops
let rev = stm32_dbgmcu_rev_id();
let affected = rev < 3 && matches!(part, Part::F42xI | Part::F43xI);
if affected { configure PA12 as Output::<PushPull> driven Low before any flash use; }

Prevention

When it happens

Trigger: Reading flash (e.g. via Flash::new or any read/erase/write operation touching the second bank) on a stm32f42xxI/stm32f43xxI chip with rev_id < REVISION_3 while PA12 is configured as anything other than an output driven low.

Common situations: Using PA12 (often USB D+) on affected 2MB F4 parts; operating on early silicon revisions of STM32F427/F429/F437/F439 'I' variants while simultaneously doing flash operations.

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


AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10). Data as JSON: /api/errors/d363a4c219448394. Report an issue: GitHub.

Appendix: source

Thrown at embassy-stm32/src/flash/f4.rs:249

        feature = "stm32f429ai",
        feature = "stm32f429bi",
        feature = "stm32f429ii",
        feature = "stm32f429ni",
        feature = "stm32f429vi",
        feature = "stm32f429zi",
        feature = "stm32f437ai",
        feature = "stm32f437ii",
        feature = "stm32f437vi",
        feature = "stm32f437zi",
        feature = "stm32f439ai",
        feature = "stm32f439bi",
        feature = "stm32f439ii",
        feature = "stm32f439ni",
        feature = "stm32f439vi",
        feature = "stm32f439zi",
    ))]
    if second_bank_read && pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() {
        panic!(
            "Read corruption for stm32f42xxI and stm32f43xxI when PA12 is in use for chips below revision 3, see errata 2.2.11"
        );
    }

    #[cfg(any(
        feature = "stm32f427ag",
        feature = "stm32f427ig",
        feature = "stm32f427vg",
        feature = "stm32f427zg",
        feature = "stm32f429ag",
        feature = "stm32f429bg",
        feature = "stm32f429ig",
        feature = "stm32f429ng",
        feature = "stm32f429vg",
        feature = "stm32f429zg",
        feature = "stm32f437ig",
        feature = "stm32f437vg",
        feature = "stm32f437zg",

View on GitHub (pinned to 463a07b963)