platforms/stm32f7: keep USART2 DMA requests enabled

This commit is contained in:
Onur Özkan committed 2026-08-01 22:28:06 +03:00
1 parent 8be8723ead
commit 59b604fdba
1 file changed
+1 -12
@@ -27,6 +27,7 @@ impl Usart2TxDma {
/// Enables DMA1 and connects USART2 TX to its fixed request route.
pub fn new(rcc: &stm32f722::RCC, usart: Usart2Tx) -> Self {
rcc.ahb1enr().modify(|_, write| write.dma1en().set_bit());
usart.enable_dma_transmit();
Self { usart }
}
@@ -44,12 +45,8 @@ impl Usart2TxDma {
}
self.clear_interrupt_flags();
// Idle USART2 has TXE set. Enabling DMAT *after* the stream is armed
// creates the initial request for byte zero without manually writing
// TDR, so the whole frame is owned by DMA.
self.configure_stream(bytes);
self.stream().cr().modify(|_, write| write.en().enabled());
self.usart.enable_dma_transmit();
Ok(())
}
@@ -73,14 +70,6 @@ impl Usart2TxDma {
.st(6)
.cr()
.modify(|_, write| write.en().disabled());
// SAFETY: USART2 is initialized once by `Usart2Tx::new`; this ISR
// clears only its DMA transmit-request enable after the stream's
// terminal status has been observed.
unsafe {
(&*stm32f722::USART2::ptr())
.cr3()
.modify(|_, write| write.dmat().clear_bit())
};
controller.hifcr().write(|write| {
write
.ctcif6()