Merge pull request #300 from thalesfragoso/clear-dma

stm32: Clear possible set flags after disabling DMA
This commit is contained in:
Thales
2021-07-17 17:28:02 -03:00
committed by GitHub
3 changed files with 13 additions and 1 deletions

View File

@ -66,6 +66,11 @@ pub(crate) async unsafe fn do_transfer(
w.set_en(false);
});
while ch.cr().read().en() {}
// Disabling the DMA mid transfer might cause some flags to be set, clear them all for the
// next transfer
dma.ifcr()
.write(|w| w.set_gif(channel_number as usize, true));
});
#[cfg(dmamux)]

View File

@ -67,6 +67,13 @@ pub(crate) async unsafe fn do_transfer(
w.set_en(false);
});
while ch.cr().read().en() {}
// Disabling the DMA mid transfer might cause some flags to be set, clear them all for the
// next transfer
dma.ifcr(channel_number as usize / 4).write(|w| {
w.set_tcif(channel_number as usize % 4, true);
w.set_teif(channel_number as usize % 4, true);
});
});
#[cfg(dmamux)]