{"record":{"id":"ee4b94daa62da23c","repo":"embassy-rs/embassy","slug":"qspi-address-can-t-be-sent-with-an-address-width-o","errorCode":null,"errorMessage":"QSPI address can't be sent with an address width of NONE","messagePattern":"QSPI address can't be sent with an address width of NONE","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/qspi/mod.rs","lineNumber":370,"sourceCode":"        T::REGS.psmkr().write(|w| w.set_mask(mask));\n        T::REGS.psmar().write(|w| w.set_match_(match_value));\n        T::REGS.pir().write(|w| w.set_interval(interval));\n\n        self.setup_transaction(QspiMode::AutoPolling, &transaction, Some(data_len));\n    }\n\n    fn setup_command(&mut self, transaction: TransferConfig) {\n        #[cfg(not(stm32h7))]\n        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        }","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/qspi/mod.rs#L352-L388","documentation":"An address was supplied in the transaction while its address width was QspiWidth::NONE, meaning no lanes are allocated to transmit it. The controller cannot send the address, so the library panics rather than silently dropping it.","triggerScenarios":"Passing a TransferConfig with address = Some(addr) and awidth = QspiWidth::NONE into setup_transaction (via blocking_read, blocking_write, setup_auto_poll, or setup_command).","commonSituations":"Building the config conditionally and defaulting awidth to NONE while still filling in the address; copying a config template that uses NONE widths and only updating the address field.","solutions":["Set awidth to a real width (SING, DUAL, or FOUR) whenever an address is provided.","If no address is needed, set transaction.address to None together with awidth = QspiWidth::NONE."],"exampleFix":"// before\nlet t = TransferConfig::new(cmd, QspiWidth::SING, Some(0x1000), QspiWidth::NONE, QspiWidth::SING);\n// after\nlet t = TransferConfig::new(cmd, QspiWidth::SING, Some(0x1000), QspiWidth::SING, QspiWidth::SING);","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":["Treat address and awidth as one unit; set both in a single helper.","Default awidth to SING when an address is present."],"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"}