{"record":{"id":"d363a4c219448394","repo":"embassy-rs/embassy","slug":"read-corruption-for-stm32f42xxi-and-stm32f43xxi-wh","errorCode":null,"errorMessage":"Read corruption for stm32f42xxI and stm32f43xxI when PA12 is in use for chips below revision 3, see errata 2.2.11","messagePattern":"Read corruption for stm32f42xxI and stm32f43xxI when PA12 is in use for chips below revision 3, see errata 2\\.2\\.11","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"embassy-stm32/src/flash/f4.rs","lineNumber":249,"sourceCode":"        feature = \"stm32f429ai\",\n        feature = \"stm32f429bi\",\n        feature = \"stm32f429ii\",\n        feature = \"stm32f429ni\",\n        feature = \"stm32f429vi\",\n        feature = \"stm32f429zi\",\n        feature = \"stm32f437ai\",\n        feature = \"stm32f437ii\",\n        feature = \"stm32f437vi\",\n        feature = \"stm32f437zi\",\n        feature = \"stm32f439ai\",\n        feature = \"stm32f439bi\",\n        feature = \"stm32f439ii\",\n        feature = \"stm32f439ni\",\n        feature = \"stm32f439vi\",\n        feature = \"stm32f439zi\",\n    ))]\n    if second_bank_read && pac::DBGMCU.idcode().read().rev_id() < REVISION_3 && !pa12_is_output_pull_low() {\n        panic!(\n            \"Read corruption for stm32f42xxI and stm32f43xxI when PA12 is in use for chips below revision 3, see errata 2.2.11\"\n        );\n    }\n\n    #[cfg(any(\n        feature = \"stm32f427ag\",\n        feature = \"stm32f427ig\",\n        feature = \"stm32f427vg\",\n        feature = \"stm32f427zg\",\n        feature = \"stm32f429ag\",\n        feature = \"stm32f429bg\",\n        feature = \"stm32f429ig\",\n        feature = \"stm32f429ng\",\n        feature = \"stm32f429vg\",\n        feature = \"stm32f429zg\",\n        feature = \"stm32f437ig\",\n        feature = \"stm32f437vg\",\n        feature = \"stm32f437zg\",","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/flash/f4.rs#L231-L267","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Free PA12 and configure it as an output pin pulled low before performing flash operations on affected revisions.","Upgrade to silicon revision 3 or later of the affected STM32 part (check rev_id via DBGMCU).","Switch to a non-affected part variant/size that is not covered by errata 2.2.11.","Avoid second-bank flash reads on affected hardware, or gate firmware features requiring flash access on chips with PA12 in use."],"exampleFix":"// before\nlet mut dp = embassy_stm32::init(config); // PA12 used as USB D+\nlet mut flash = Flash::new(p.FLASH); // panics on rev<3\n// after\nlet mut pa12 = Output::new(p.PA12, Level::Low, Speed::Low); // errata workaround\nlet mut flash = Flash::new(p.FLASH);","handlingStrategy":"validation","validationCode":"// at boot, before flash ops\nlet rev = stm32_dbgmcu_rev_id();\nlet affected = rev < 3 && matches!(part, Part::F42xI | Part::F43xI);\nif affected { configure PA12 as Output::<PushPull> driven Low before any flash use; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the STM32F4 errata sheet for your silicon revision (DBGMCU rev_id)","Keep PA12 as output-low whenever flash operations occur on affected parts","Prefer revision-3+ silicon for production builds using flash"],"tags":["rust","embassy","embedded","stm32","flash","hardware-errata"],"backgroundTag":"unsupported-platform","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}