{"record":{"id":"b59f54fb8661c9a6","repo":"embassy-rs/embassy","slug":"embassy-is-configured-as-dual-bank-but-the-hardwa","errorCode":null,"errorMessage":"Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use single-bank config","messagePattern":"Embassy is configured as dual-bank, but the hardware is running in single-bank mode\\. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use single-bank config","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/flash/f4.rs","lineNumber":382,"sourceCode":"            assert_sector(0x14, FlashBank::Bank2, 4, 0x0809_0000, MEDIUM_SECTOR_SIZE, 0x0809_FFFF);\n\n            assert_sector(0x15, FlashBank::Bank2, 5, 0x080A_0000, LARGE_SECTOR_SIZE, 0x080A_0000);\n            assert_sector(0x15, FlashBank::Bank2, 5, 0x080A_0000, LARGE_SECTOR_SIZE, 0x080B_FFFF);\n            assert_sector(0x17, FlashBank::Bank2, 7, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080E_0000);\n            assert_sector(0x17, FlashBank::Bank2, 7, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080F_FFFF);\n        }\n    }\n}\n\n#[cfg(all(bank_setup_configurable))]\npub(crate) fn check_bank_setup() {\n    if cfg!(feature = \"single-bank\") && pac::FLASH.optcr().read().db1m() {\n        panic!(\n            \"Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use dual-bank config\"\n        );\n    }\n    if cfg!(feature = \"dual-bank\") && !pac::FLASH.optcr().read().db1m() {\n        panic!(\n            \"Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use single-bank config\"\n        );\n    }\n}\n","sourceCodeStart":364,"sourceCodeEnd":387,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/flash/f4.rs#L364-L387","documentation":"The mirror image of error 204: Embassy was compiled with the 'dual-bank' feature, but the hardware's DB1M option bit says single-bank. The bank/sector layout assumptions of the dual-bank build would not match the physical flash layout, so check_bank_setup() panics before any flash operation can misaddress memory.","triggerScenarios":"Building with the 'dual-bank' feature for an F4 part whose option bytes have DB1M=0 (single-bank), then initializing flash.","commonSituations":"Copy-pasted Cargo.toml enabling dual-bank on a board that ships single-bank; someone cleared DB1M in CubeProgrammer while firmware still expects dual-bank; switching chip variants without updating features.","solutions":["Either enable the 'single-bank' feature in embassy-stm32 or set the DB1M option bit to 1 (dual-bank) via STM32CubeProgrammer and power-cycle.","Verify the intended flash layout (needed bank count/sector sizes) and pick the feature that matches both hardware and application requirements.","Re-check option bytes after bootloader/firmware updates that may reset them."],"exampleFix":"// before (Cargo.toml, hardware is single-bank)\nembassy-stm32 = { version = \"...\", features = [\"stm32f429zi\", \"dual-bank\"] }\n// after\nembassy-stm32 = { version = \"...\", features = [\"stm32f429zi\", \"single-bank\"] }","handlingStrategy":"validation","validationCode":"fn bank_config_matches(dual_bank_feature: bool, db1m: bool) -> bool {\n    dual_bank_feature == db1m\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Align cargo feature with DB1M option bit before first flash init","Re-check option bytes after bootloader or CubeProgrammer operations","Document the board's flash bank configuration in the repo"],"tags":["rust","embassy","embedded","stm32","flash","build-configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}