Skip to content

Commit 5dd8b45

Browse files
committed
GPDMA suspend channel before reset if already enabled
1 parent 95fd1f4 commit 5dd8b45

File tree

1 file changed

+5
-0
lines changed
  • embassy-stm32/src/dma/gpdma

1 file changed

+5
-0
lines changed

embassy-stm32/src/dma/gpdma/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ impl AnyChannel {
238238
// "Preceding reads and writes cannot be moved past subsequent writes."
239239
fence(Ordering::SeqCst);
240240

241+
if ch.cr().read().en() {
242+
ch.cr().modify(|w| w.set_susp(true));
243+
while !ch.sr().read().suspf() {}
244+
}
245+
241246
ch.cr().write(|w| w.set_reset(true));
242247
ch.fcr().write(|w| {
243248
// Clear all irqs

0 commit comments

Comments
 (0)