From 17f0f4baa489d87d9862f9ab91dc73530daf5b3e Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Thu, 11 Dec 2025 15:42:46 -0800 Subject: [iMXRT] add a minimal DMA copy example While at that, also update the PACs to their latest versions. --- embassy-imxrt/Cargo.toml | 4 ++-- examples/mimxrt6/src/bin/dma.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 examples/mimxrt6/src/bin/dma.rs diff --git a/embassy-imxrt/Cargo.toml b/embassy-imxrt/Cargo.toml index c47756f10..81377579b 100644 --- a/embassy-imxrt/Cargo.toml +++ b/embassy-imxrt/Cargo.toml @@ -103,5 +103,5 @@ document-features = "0.2.7" paste = "1.0" # PACs -mimxrt685s-pac = { version = "0.4.0", optional = true, features = ["rt", "critical-section"] } -mimxrt633s-pac = { version = "0.4.0", optional = true, features = ["rt", "critical-section"] } +mimxrt685s-pac = { version = "0.5.0", optional = true, features = ["rt", "critical-section"] } +mimxrt633s-pac = { version = "0.5.0", optional = true, features = ["rt", "critical-section"] } diff --git a/examples/mimxrt6/src/bin/dma.rs b/examples/mimxrt6/src/bin/dma.rs new file mode 100644 index 000000000..b490efc6b --- /dev/null +++ b/examples/mimxrt6/src/bin/dma.rs @@ -0,0 +1,26 @@ +#![no_std] +#![no_main] + +extern crate embassy_imxrt_examples; + +use defmt::info; +use embassy_executor::Spawner; +use embassy_imxrt::dma::copy; +use {defmt_rtt as _, panic_probe as _}; + +const BUFLEN: usize = 1024; + +#[embassy_executor::main] +async fn main(_spawner: Spawner) { + let p = embassy_imxrt::init(Default::default()); + + info!("Test memory-to-memory DMA transfers"); + + let src = [0x55u8; BUFLEN]; + let mut dst = [0u8; BUFLEN]; + + unsafe { copy(p.DMA0_CH0, &src, &mut dst) }.await; + assert!(dst == src); + + info!("DMA copy succeeded"); +} -- cgit