{"record":{"id":"b8d643b56721f01d","repo":"embassy-rs/embassy","slug":"embassy-is-configured-as-dual-bank-but-the-hardwa-b8d643","errorCode":null,"errorMessage":"Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the ndbank 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 ndbank 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/f7.rs","lineNumber":179,"sourceCode":"        assert_sector(4, 0x0802_0000, MEDIUM_SECTOR_SIZE, 0x0802_0000);\n        assert_sector(4, 0x0802_0000, MEDIUM_SECTOR_SIZE, 0x0803_FFFF);\n\n        assert_sector(5, 0x0804_0000, LARGE_SECTOR_SIZE, 0x0804_0000);\n        assert_sector(5, 0x0804_0000, LARGE_SECTOR_SIZE, 0x0807_FFFF);\n        assert_sector(7, 0x080C_0000, LARGE_SECTOR_SIZE, 0x080C_0000);\n        assert_sector(7, 0x080C_0000, LARGE_SECTOR_SIZE, 0x080F_FFFF);\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().n_dbank() {\n        panic!(\n            \"Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the ndbank 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().n_dbank() {\n        panic!(\n            \"Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the ndbank value in the user option bytes or configure embassy to use single-bank config\"\n        );\n    }\n}\n","sourceCodeStart":161,"sourceCodeEnd":184,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/flash/f7.rs#L161-L184","documentation":"Inverse of 206 for F7: Embassy compiled with the 'dual-bank' feature while the N_DBANK option bit shows single-bank hardware. The dual-bank sector map in the build would disagree with the chip, so check_bank_setup() panics before any flash erase/write can target wrong addresses.","triggerScenarios":"Flash init on a configurable F7 part built with feature = \"dual-bank\" while FLASH.optcr.N_DBANK == 1 (single bank).","commonSituations":"Option bytes set to single-bank to maximize contiguous flash, but firmware still built with dual-bank features; template Cargo.toml not adjusted for the board.","solutions":["Rebuild with the 'single-bank' feature, or change N_DBANK to 0 (dual-bank) in the option bytes and power cycle.","Verify the flash layout requirements (partition table, bootloader placement) before switching either side.","Keep one source of truth (e.g. a board config doc) mapping option bytes to required embassy features."],"exampleFix":"// before (Cargo.toml, hardware single-bank F7)\nfeatures = [\"stm32f767zi\", \"dual-bank\"]\n// after\nfeatures = [\"stm32f767zi\", \"single-bank\"]","handlingStrategy":"validation","validationCode":"fn f7_bank_ok(dual_bank_feature: bool, n_dbank: bool) -> bool {\n    dual_bank_feature == !n_dbank\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify N_DBANK before enabling the dual-bank feature","Single-source the bank configuration in CI/board config","Power cycle after changing N_DBANK option bytes"],"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"}