{"record":{"id":"ee3ed77535af75e9","repo":"embassy-rs/embassy","slug":"qspi-address-is-not-set-so-the-address-width-shou","errorCode":null,"errorMessage":"QSPI address is not set, so the address width should be NONE","messagePattern":"QSPI address is not set, so the address width should be NONE","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/qspi/mod.rs","lineNumber":379,"sourceCode":"        T::REGS.cr().modify(|v| v.set_dmaen(false));\n\n        self.setup_transaction(QspiMode::IndirectWrite, &transaction, None);\n    }\n\n    fn setup_transaction(&mut self, fmode: QspiMode, transaction: &TransferConfig, data_len: Option<usize>) {\n        self.assert_transfer_widths(transaction);\n\n        match (transaction.address, transaction.awidth) {\n            (Some(_), QspiWidth::NONE) => panic!(\"QSPI address can't be sent with an address width of NONE\"),\n            (Some(address), _) => {\n                // u32::bit_width was only stabilized in 1.97\n                let address_bit_width = u32::BITS - address.leading_zeros();\n                if address_bit_width > transaction.address_size.bit_width() as u32 {\n                    panic!(\"QSPI address too large to be represented with the given address size\");\n                }\n            }\n            (None, QspiWidth::NONE) => {}\n            (None, _) => panic!(\"QSPI address is not set, so the address width should be NONE\"),\n        }\n\n        match (data_len, transaction.dwidth) {\n            (Some(0), _) => panic!(\"QSPI data must be at least one byte\"),\n            (Some(_), QspiWidth::NONE) => panic!(\"QSPI data can't be sent with a data width of NONE\"),\n            (Some(_), _) => {}\n            (None, QspiWidth::NONE) => {}\n            (None, _) => panic!(\"QSPI data is empty, so the data width should be NONE\"),\n        }\n\n        T::REGS.fcr().modify(|v| {\n            v.set_csmf(true);\n            v.set_ctcf(true);\n            v.set_ctef(true);\n            v.set_ctof(true);\n        });\n\n        while T::REGS.sr().read().busy() {}","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/qspi/mod.rs#L361-L397","documentation":"The transaction carries no address (None) but its address width is not NONE, i.e. lanes are allocated to transmit an address that does not exist. The library enforces the pairing: no address implies QspiWidth::NONE.","triggerScenarios":"Passing a TransferConfig with address = None and awidth of SING/DUAL/FOUR into setup_transaction via blocking_read, blocking_write, setup_auto_poll, or setup_command.","commonSituations":"Command-only transactions (e.g. write-enable 0x06) copied from a template that still sets awidth; config structs with default width values that aren't reset when the address is dropped.","solutions":["Set awidth = QspiWidth::NONE when address is None.","Use a command-only constructor/template that leaves both address None and awidth NONE."],"exampleFix":"// before\nlet t = TransferConfig::new(0x06, QspiWidth::SING, None, QspiWidth::SING, QspiWidth::NONE);\n// after\nlet t = TransferConfig::new(0x06, QspiWidth::SING, None, QspiWidth::NONE, QspiWidth::NONE);","handlingStrategy":"validation","validationCode":"fn address_pairing_ok(t: &TransferConfig) -> bool {\n    t.address.is_some() || t.awidth == QspiWidth::NONE\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use command-only constructors for commands without addresses.","Reset width fields to NONE when clearing address fields in config structs."],"tags":["rust","embedded","stm32","qspi","validation"],"backgroundTag":"mutually-exclusive-options","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"}