embassy-rs/embassy · error
Embassy is configured as dual-bank, but the hardware is…
Error message
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
What it means
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.
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.
Example fix
// before (Cargo.toml, hardware is single-bank)
embassy-stm32 = { version = "...", features = ["stm32f429zi", "dual-bank"] }
// after
embassy-stm32 = { version = "...", features = ["stm32f429zi", "single-bank"] } Defensive patterns
Strategy: validation
Validate before calling
fn bank_config_matches(dual_bank_feature: bool, db1m: bool) -> bool {
dual_bank_feature == db1m
} Prevention
- 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
When it happens
Trigger: Building with the 'dual-bank' feature for an F4 part whose option bytes have DB1M=0 (single-bank), then initializing flash.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Embassy is configured as single-bank, but the hardware is…
- Embassy is configured as single-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…
- Embassy is configured as dual-bank, but the hardware is…
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/b59f54fb8661c9a6.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-stm32/src/flash/f4.rs:382
assert_sector(0x14, FlashBank::Bank2, 4, 0x0809_0000, MEDIUM_SECTOR_SIZE, 0x0809_FFFF);
assert_sector(0x15, FlashBank::Bank2, 5, 0x080A_0000, LARGE_SECTOR_SIZE, 0x080A_0000);
assert_sector(0x15, FlashBank::Bank2, 5, 0x080A_0000, LARGE_SECTOR_SIZE, 0x080B_FFFF);
assert_sector(0x17, FlashBank::Bank2, 7, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080E_0000);
assert_sector(0x17, FlashBank::Bank2, 7, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080F_FFFF);
}
}
}
#[cfg(all(bank_setup_configurable))]
pub(crate) fn check_bank_setup() {
if cfg!(feature = "single-bank") && pac::FLASH.optcr().read().db1m() {
panic!(
"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"
);
}
if cfg!(feature = "dual-bank") && !pac::FLASH.optcr().read().db1m() {
panic!(
"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"
);
}
}
View on GitHub (pinned to 463a07b963)