embassy-rs/embassy · error

not implemented

Error message

not implemented

What it means

From<WordSize> for vals::Size maps byte widths to DMA transfer sizes, supporting 1, 2, and 4 bytes; EightBytes falls through to unimplemented! because DMA1/DMA2 (dma_bdma) hardware only supports 8/16/32-bit transfers. Passing WordSize::EightBytes to a DMA transfer on these controllers panics.

Solutions

  1. Use buffers of u8/u16/u32 instead of u64 for DMA transfers on dma_bdma channels
  2. Switch to a DMA peripheral that supports 64-bit transfers if 8-byte words are required (e.g. MDMA on H7)
  3. Change WordSize::EightBytes handling to return a Result/panic with a clear message
  4. Split 64-bit data into two 32-bit transfers

Example fix

// before
let transfer = Transfer::new(dma.ch1, request, buf_u64, p.clock); // WordSize::EightBytes
// after
let buf: &mut [u32] = /* retype buffer */;
let transfer = Transfer::new(dma.ch1, request, buf, p.clock); // 32-bit words
Defensive patterns

Strategy: validation

Validate before calling

fn dma_word_ok<T>() -> bool { matches!(core::mem::size_of::<T>(), 1 | 2 | 4) }

Type guard

const fn supports_word_size(bytes: usize) -> bool { matches!(bytes, 1 | 2 | 4) }

Prevention

When it happens

Trigger: Constructing a DMA transfer (e.g. Transfer::new with a Word-size generic or buffer of u64) whose WordSize is EightBytes on a DMA/BDMA channel.

Common situations: Using u64-typed buffers with DMA on STM32 DMA1/DMA2 or B DMA channels, where the hardware simply lacks a 64-bit transfer size option.

Related errors


AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10). Data as JSON: /api/errors/72943d4da859a6af. Report an issue: GitHub.

Appendix: source

Thrown at embassy-stm32/src/dma/dma_bdma.rs:273

        }
    }
}

#[cfg(dma)]
pub use dma_only::*;
#[cfg(dma)]
mod dma_only {
    use pac::dma::vals;

    use super::*;

    impl From<WordSize> for vals::Size {
        fn from(raw: WordSize) -> Self {
            match raw {
                WordSize::OneByte => Self::Bits8,
                WordSize::TwoBytes => Self::Bits16,
                WordSize::FourBytes => Self::Bits32,
                WordSize::EightBytes => unimplemented!(),
            }
        }
    }

    impl From<Dir> for vals::Dir {
        fn from(raw: Dir) -> Self {
            match raw {
                Dir::MemoryToPeripheral => Self::MemoryToPeripheral,
                Dir::PeripheralToMemory => Self::PeripheralToMemory,
                Dir::MemoryToMemory => Self::MemoryToMemory,
            }
        }
    }

    /// DMA transfer burst setting.
    #[derive(Debug, Copy, Clone, PartialEq, Eq)]
    #[cfg_attr(feature = "defmt", derive(defmt::Format))]
    pub enum Burst {

View on GitHub (pinned to 463a07b963)