{"record":{"id":"baa2f903d19a77bd","repo":"embassy-rs/embassy","slug":"unsupported-configuration","errorCode":null,"errorMessage":"unsupported configuration","messagePattern":"unsupported configuration","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/spi/mod.rs","lineNumber":1324,"sourceCode":"        self.set_word_size(W::CONFIG);\n\n        let comm = {\n            let mut w = regs.cfg2().read();\n            let prev = w.comm();\n            w.set_comm(vals::Comm::Receiver);\n            regs.cfg2().write_value(w);\n            prev\n        };\n\n        #[cfg(spi_v4)]\n        let i2scfg = {\n            let mut w = regs.i2scfgr().read();\n            let r = w.i2smod().then(|| {\n                let prev = w.i2scfg();\n                w.set_i2scfg(match prev {\n                    vals::I2scfg::SlaveRx | vals::I2scfg::SlaveFullDuplex => vals::I2scfg::SlaveRx,\n                    vals::I2scfg::MasterRx | vals::I2scfg::MasterFullDuplex => vals::I2scfg::MasterRx,\n                    _ => panic!(\"unsupported configuration\"),\n                });\n                prev\n            });\n            regs.i2scfgr().write_value(w);\n            r\n        };\n\n        let rx_src = regs.rx_ptr();\n\n        for chunk in data.chunks_mut(u16::MAX.into()) {\n            set_rxdmaen(regs, true);\n\n            let tsize = chunk.len();\n\n            let transfer = unsafe { self.rx_dma.as_mut().unwrap().read(rx_src, chunk, Default::default()) };\n\n            regs.cr2().modify(|w| {\n                w.set_tsize(tsize as u16);","sourceCodeStart":1306,"sourceCodeEnd":1342,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/spi/mod.rs#L1306-L1342","documentation":"When reading SPI's I2SCFGR register, the driver maps the previous I2S configuration (i2scfg) to an RX-capable mode. Only SlaveRx/SlaveFullDuplex and MasterRx/MasterFullDuplex have defined mappings; any other encoded value hits the catch-all panic. The type is exposed as PioSpi's return surface (declared as _), so users typically see it as an unexpected panic rather than a typed error.","triggerScenarios":"Calling the SPI/I2S register-mapping path when i2scfgr.i2scfg contains an unexpected value — e.g. the register is in a mode not covered by the match (transmit-only or corrupted encoding) while i2smod is set.","commonSituations":"Using the peripheral in an I2S configuration not supported by this driver path; reading state from a peripheral configured by other code/firmware to transmit-only mode; misuse of PioSpi wrappers.","solutions":["Configure the I2S peripheral into one of the four supported modes (SlaveRx, SlaveFullDuplex, MasterRx, MasterFullDuplex) before this call.","Avoid reusing a peripheral previously configured by bootloader/other firmware with unsupported I2S mode bits; reset the peripheral first.","Update the embassy-stm32 version if your chip variant encodes additional I2S modes not handled by this match."],"exampleFix":"// before (register left in unsupported i2scfg, e.g. transmit-only)\n// panic in mapping code\n// after\nw.set_i2scfg(vals::I2scfg::MasterRx); // or SlaveRx/MasterFullDuplex/SlaveFullDuplex","handlingStrategy":"validation","validationCode":"// Reset/check the SPI peripheral's I2SCFGR before use:\n// let i2scfg = spi.regs.i2scfgr().read().i2scfg();\n// assert!(matches!(i2scfg, vals::I2scfg::SlaveRx | vals::I2scfg::SlaveFullDuplex | vals::I2scfg::MasterRx | vals::I2scfg::MasterFullDuplex));\n","typeGuard":"fn i2s_mode_supported(m: vals::I2scfg) -> bool {\n    matches!(m, vals::I2scfg::SlaveRx | vals::I2scfg::SlaveFullDuplex | vals::I2scfg::MasterRx | vals::I2scfg::MasterFullDuplex)\n}","tryCatchPattern":null,"preventionTips":["Configure the I2S peripheral only into Rx or FullDuplex modes when using this driver path.","Reset the peripheral before use if prior firmware may have set unsupported mode bits.","Keep embassy-stm32 updated for your chip variant's I2S mode encodings."],"tags":["spi","i2s","embedded","panic"],"backgroundTag":"unsupported-enum-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"}