{"record":{"id":"3c1f210a5c31da9e","repo":"embassy-rs/embassy","slug":"dma-data-transfer-error-on-dma-08x-channel","errorCode":null,"errorMessage":"DMA: data transfer error on DMA@{:08x} channel {}","messagePattern":"DMA: data transfer error on DMA@(.+?) channel (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"embassy-stm32/src/dma/gpdma/mod.rs","lineNumber":562,"sourceCode":"    crate::_generated::init_gpdma();\n    crate::_generated::init_lpdma();\n}\n\npub(crate) unsafe fn on_irq(channel: DmaChannel) {\n    let info = super::info(channel);\n    #[cfg(feature = \"_dual-core\")]\n    {\n        use embassy_hal_internal::interrupt::InterruptExt as _;\n        info.irq.enable();\n    }\n\n    let state = &STATE[channel as usize];\n\n    let ch = info.dma.ch(info.num);\n    let sr = ch.sr().read();\n\n    if sr.dtef() {\n        panic!(\n            \"DMA: data transfer error on DMA@{:08x} channel {}\",\n            info.dma.cast().as_ptr() as u32,\n            info.num\n        );\n    }\n    if sr.usef() {\n        panic!(\n            \"DMA: user settings error on DMA@{:08x} channel {}\",\n            info.dma.cast().as_ptr() as u32,\n            info.num\n        );\n    }\n    if sr.ulef() {\n        panic!(\n            \"DMA: link transfer error on DMA@{:08x} channel {}\",\n            info.dma.cast().as_ptr() as u32,\n            info.num\n        );","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/src/dma/gpdma/mod.rs#L544-L580","documentation":"The GPDMA channel interrupt handler read the data transfer error flag (DTEF) in the channel status register, meaning a bus error occurred during the transfer: bad address, illegal access, or aborted transaction. The driver panics because a data transfer error leaves the DMA state undefined and the peripheral access was invalid.","triggerScenarios":"DMA programmed with an invalid source/destination address (e.g. unmapped memory, unaligned address for the required width); peripheral FIFO underrun/overrun on the AHB/AXI bus; buffer invalidated or stack memory moved after configuration.","commonSituations":"Passing a buffer in flash or core-coupled memory (DTCM) that the GPDMA bus master cannot reach; buffer freed/stack-unwound while DMA still running; wrong word size making the end address unaligned.","solutions":["Ensure the buffer is in RAM accessible by the DMA (use DMA-capable memory, avoid DTCM/ITCM on parts where GPDMA can't reach it)","Check that buffer addresses are properly aligned for the transfer word size","Verify the buffer outlives the transfer (no scope exit or move while DMA is active)","Re-check the peripheral request line / address configuration (e.g. correct data register address)"],"exampleFix":"// before\n#[link_section = \".dtcm\"]\nstatic mut BUF: [u8; 64] = [0; 64]; // unreachable by GPDMA\n// after\nstatic mut BUF: [u8; 64] = [0; 64]; // in normal SRAM reachable by DMA","handlingStrategy":"validation","validationCode":"fn dma_accessible(buf_addr: u32, len: u32) -> bool {\n    // GPDMA typically reaches SRAM1-4/AHB SRAM, not DTCM/ITCM on many parts\n    (0x2000_0000..0x2004_0000).contains(&buf_addr)\n        && buf_addr % 4 == 0 // alignment for max word size used\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Place DMA buffers in SRAM the DMA bus master can address","Never let a buffer passed to a DMA transfer go out of scope or move before completion","Keep buffers aligned for the transfer word size","Verify the peripheral data-register address used by the driver matches your chip"],"tags":["dma","embedded","stm32","bus-error","panic"],"backgroundTag":"dma-bus-error","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"}