{"record":{"id":"42bf02885a0738be","repo":"embassy-rs/embassy","slug":"dma-data-error","errorCode":null,"errorMessage":"DMA data error","messagePattern":"DMA data error","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"embassy-mspm0/src/dma.rs","lineNumber":645,"sourceCode":"// C1104 has no full DMA channels.\n#[allow(unused_macros)]\nmacro_rules! impl_full_dma_channel {\n    ($instance: ident, $num: expr) => {\n        impl_dma_channel!($instance, $num);\n\n        impl crate::dma::FullChannelInstance for crate::peripherals::$instance {}\n    };\n}\n\nfn on_irq(dma: pac::dma::Dma) {\n    use crate::BitIter;\n\n    let events = dma.int_event(0);\n    let mis = events.mis().read();\n\n    // TODO: Handle DATAERR and ADDRERR? However we do not know which channel causes an error.\n    if mis.dataerr() {\n        panic!(\"DMA data error\");\n    } else if mis.addrerr() {\n        panic!(\"DMA address error\")\n    }\n\n    // Ignore preirq interrupts (values greater than 16).\n    for i in BitIter(mis.0 & 0x0000_FFFF) {\n        if let Some(state) = STATE.get(i as usize) {\n            state.waker.wake();\n\n            // Notify the future that the counter size hit zero\n            events.imask().modify(|w| {\n                w.set_ch(i as usize, false);\n            });\n        }\n    }\n}\n","sourceCodeStart":627,"sourceCodeEnd":662,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-mspm0/src/dma.rs#L627-L662","documentation":"The DMA interrupt handler reads the masked interrupt status of control event 0 and panics if the DATAERR bit is set, indicating the DMA controller reported a data error (e.g. invalid burst/increment configuration or bus data issue). Since the driver cannot determine which channel caused it, it panics instead of silently continuing, per the TODO in the source.","triggerScenarios":"A DMA transfer completes/aborts with the controller raising a data error interrupt: typically a misconfigured channel (bad transfer width/burst vs peripheral requirements) or FIFO overrun/underrun feeding the DMA, triggering `mis.dataerr()` in `on_irq`.","commonSituations":"Configuring a DMA channel for a peripheral with an incompatible data width or address increment; running transfers against a peripheral that signals errors (SPI/UART FIFO issues); firmware bugs corrupting the channel descriptor mid-transfer.","solutions":["Review the DMA channel configuration (data width, burst size, address increment) against the peripheral's DMA requirements in the device datasheet.","Reduce transfer complexity (single transfers instead of bursts) to isolate which peripheral/channel raises DATAERR.","Check for FIFO overrun/underrun on the servicing peripheral and fix the peripheral-side error handling.","Update embassy-mspm0 — the TODO notes DATAERR handling is incomplete, so newer versions may report the channel instead of panicking."],"exampleFix":"// before: width/burst mismatch with peripheral FIFO\nlet cfg = ChannelConfig::default().burst(BurstSize::X4).width(Width::WORD);\n// after: match peripheral FIFO width (e.g. UART is byte-wide, no burst)\nlet cfg = ChannelConfig::default().width(Width::BYTE);","handlingStrategy":"validation","validationCode":"// Sanity-check channel config before starting a transfer:\nassert!(width_matches_peripheral_fifo(peripheral, cfg.width));\nassert!(cfg.burst.is_supported_by(peripheral));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match DMA width/burst to the peripheral's FIFO width exactly (UART=byte, etc.).","Bring up DMA transfers with small test buffers first.","Keep embassy-mspm0 updated; DATAERR/ADDRERR handling is marked TODO and may improve.","Monitor peripheral error flags when debugging DMA panics."],"tags":["embedded","rust","dma","interrupt","panic"],"backgroundTag":"invalid-config-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"}