From 5220a76e5f71c4e44c1e2f023df5ea7feb4d4370 Mon Sep 17 00:00:00 2001 From: Brian Schwind Date: Sat, 4 Oct 2025 13:13:16 +0900 Subject: ospi: properly respect the max DMA transfer size when writing --- embassy-stm32/src/ospi/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs index a1f3c8b03..2e4943a1b 100644 --- a/embassy-stm32/src/ospi/mod.rs +++ b/embassy-stm32/src/ospi/mod.rs @@ -1203,7 +1203,7 @@ impl<'d, T: Instance> Ospi<'d, T, Async> { .modify(|v| v.set_fmode(vals::FunctionalMode::INDIRECT_WRITE)); // TODO: implement this using a LinkedList DMA to offload the whole transfer off the CPU. - for chunk in buf.chunks(0xFFFF) { + for chunk in buf.chunks(0xFFFF / W::size().bytes()) { let transfer = unsafe { self.dma .as_mut() @@ -1278,7 +1278,7 @@ impl<'d, T: Instance> Ospi<'d, T, Async> { .modify(|v| v.set_fmode(vals::FunctionalMode::INDIRECT_WRITE)); // TODO: implement this using a LinkedList DMA to offload the whole transfer off the CPU. - for chunk in buf.chunks(0xFFFF) { + for chunk in buf.chunks(0xFFFF / W::size().bytes()) { let transfer = unsafe { self.dma .as_mut() -- cgit