From bbc81146ecb3832e9ec1531ef6d48fec6c7c0d8c Mon Sep 17 00:00:00 2001 From: Catherine Date: Mon, 19 Jun 2023 09:06:41 +0000 Subject: [PATCH] BDMA: request stop after busy loop in blocking_wait(). Otherwise the channel cannot be used again, since CR.EN remains set and the DMA channel registers are read-only while it is set. --- embassy-stm32/src/dma/bdma.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs index c0a503e2..e9b75d86 100644 --- a/embassy-stm32/src/dma/bdma.rs +++ b/embassy-stm32/src/dma/bdma.rs @@ -327,6 +327,7 @@ impl<'a, C: Channel> Transfer<'a, C> { pub fn blocking_wait(mut self) { while self.is_running() {} + self.request_stop(); // "Subsequent reads and writes cannot be moved ahead of preceding reads." fence(Ordering::SeqCst);