From 1bcc66edead224b43499cdb9df00e62817636f9e Mon Sep 17 00:00:00 2001 From: xoviat Date: Fri, 21 Nov 2025 11:28:57 -0600 Subject: [PATCH] cycle usart on idle termination fixes #4689. fixes #3900. --- embassy-stm32/CHANGELOG.md | 1 + embassy-stm32/src/usart/mod.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/embassy-stm32/CHANGELOG.md b/embassy-stm32/CHANGELOG.md index 597cbb1921..f15a5ac433 100644 --- a/embassy-stm32/CHANGELOG.md +++ b/embassy-stm32/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased - ReleaseDate +- fix: cycle usart on idle termination - change: rework hsem and add HIL test for some chips. - change: stm32/eth: ethernet no longer has a hard dependency on station management, and station management can be used independently ([#4871](https://github.com/embassy-rs/embassy/pull/4871)) - feat: allow embassy_executor::main for low power diff --git a/embassy-stm32/src/usart/mod.rs b/embassy-stm32/src/usart/mod.rs index 0e7da634df..45b09ec00f 100644 --- a/embassy-stm32/src/usart/mod.rs +++ b/embassy-stm32/src/usart/mod.rs @@ -765,6 +765,8 @@ impl<'d> UartRx<'d, Async> { w.set_peie(false); // disable idle line interrupt w.set_idleie(false); + // disable uart to clear any data present + w.set_ue(!enable_idle_line_detection) }); r.cr3().modify(|w| { // disable Error Interrupt: (Frame error, Noise error, Overrun error) @@ -772,6 +774,8 @@ impl<'d> UartRx<'d, Async> { // disable DMA Rx Request w.set_dmar(false); }); + + r.cr1().modify(|w| w.set_ue(true)); }); let ch = self.rx_dma.as_mut().unwrap();