{"record":{"id":"a496e9fa47b9b1b2","repo":"embassy-rs/embassy","slug":"invalid-burst-size","errorCode":null,"errorMessage":"invalid burst size","messagePattern":"invalid burst size","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/src/dma/dma_bdma.rs","lineNumber":317,"sourceCode":"        Incr16,\n        /// Incremental burst of 32 beats\n        Incr32,\n        /// Incremental burst of 64 beats\n        Incr64,\n        /// Incremental burst of 128 beats\n        Incr128,\n        /// Incremental burst of 256 beats\n        Incr256,\n    }\n\n    impl From<Burst> for vals::Burst {\n        fn from(burst: Burst) -> Self {\n            match burst {\n                Burst::Single => vals::Burst::Single,\n                Burst::Incr4 => vals::Burst::Incr4,\n                Burst::Incr8 => vals::Burst::Incr8,\n                Burst::Incr16 => vals::Burst::Incr16,\n                _ => unimplemented!(\"invalid burst size\"),\n            }\n        }\n    }\n\n    /// DMA flow control setting.\n    #[derive(Debug, Copy, Clone, PartialEq, Eq)]\n    #[cfg_attr(feature = \"defmt\", derive(defmt::Format))]\n    pub enum FlowControl {\n        /// Flow control by DMA\n        Dma,\n        /// Flow control by peripheral\n        Peripheral,\n    }\n\n    impl From<FlowControl> for vals::Pfctrl {\n        fn from(flow: FlowControl) -> Self {\n            match flow {\n                FlowControl::Dma => vals::Pfctrl::Dma,","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/dma/dma_bdma.rs#L299-L335","documentation":"This panic is raised by the From<Burst> for vals::Burst conversion in the STM32 DMA (bDMA) driver when a Burst value outside the supported Single/Incr4/Incr8/Incr16 set is converted for writing into the DMA channel's CR register. It is a compile-time-enumerated enum so in practice this arm is unreachable with the current public enum; the library throws it defensively because the hardware field only supports those four burst configurations. Any Burst variant added later or constructed via transmute from an invalid discriminant lands here.","triggerScenarios":"Calling any DMA configure/start API (e.g. dma_bdma channel start) while the channel's configured Burst enum value is a non-exhaustive/unfitted variant other than Single, Incr4, Incr8, or Incr16 — typically only reachable via trait-object/non_exhaustive future variants or transmuted discriminants.","commonSituations":"Patching the Burst enum to add a new burst size (e.g. Incr32) on newer chip families without updating this conversion; compiling for an MCU where the driver is partially supported; cargo feature or embassy-stm32 version changes that expose more variants.","solutions":["Use only Burst::Single, Burst::Incr4, Burst::Incr8 or Burst::Incr16 when configuring the DMA channel","Check the embassy-stm32 version/chip support matrix; burst INCR16 etc. may not be supported for your DMA instance","If you patched the enum, extend this match to map the new variant to vals::Burst","File/update an embassy issue for the chip if the hardware supports the variant but the driver does not"],"exampleFix":"// before\nlet burst = Burst::Incr16; // custom-added variant\n// after\nlet burst = Burst::Incr8; // supported: Single | Incr4 | Incr8 | Incr16","handlingStrategy":"validation","validationCode":"fn burst_supported(b: Burst) -> bool {\n    matches!(b, Burst::Single | Burst::Incr4 | Burst::Incr8 | Burst::Incr16)\n}\nassert!(burst_supported(cfg.burst), \"burst size not supported by bDMA\");","typeGuard":"fn is_supported_burst(b: Burst) -> Option<vals::Burst> {\n    match b {\n        Burst::Single | Burst::Incr4 | Burst::Incr8 | Burst::Incr16 => Some(b.into()),\n        _ => None,\n    }\n}","tryCatchPattern":"// unimplemented!() panics; catch via panic hook only in tests\nstd::panic::catch_unwind(|| dma.configure(...))","preventionTips":["Only use enum variants documented for your DMA instance","Pin embassy-stm32 versions and read chip support notes before upgrading","Add a unit test exercising the exact burst config per channel","Avoid transmuting enum discriminants from raw register values"],"tags":["embedded","dma","stm32","unimplemented"],"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"}