You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/10/06 12:49:34 UTC
[nuttx] branch master updated: UART needs to be disabled before changing setup
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 7248b728bf UART needs to be disabled before changing setup
7248b728bf is described below
commit 7248b728bfa7b1899f2ad3dcead299a39e19c9cf
Author: fengsi <fe...@qq.com>
AuthorDate: Fri Oct 6 15:20:34 2023 +0800
UART needs to be disabled before changing setup
---
arch/arm/src/stm32/stm32_serial.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c
index ccc53df7b8..d58944fb2e 100644
--- a/arch/arm/src/stm32/stm32_serial.c
+++ b/arch/arm/src/stm32/stm32_serial.c
@@ -1445,6 +1445,10 @@ static void up_set_format(struct uart_dev_s *dev)
regval = up_serialin(priv, STM32_USART_CR1_OFFSET);
+#if defined(CONFIG_STM32_STM32G4XXX)
+ regval &= ~(USART_CR1_UE | USART_CR1_TE | USART_CR1_RE);
+ up_serialout(priv, STM32_USART_CR1_OFFSET, regval);
+#endif
#if defined(CONFIG_STM32_STM32F30XX) || defined(CONFIG_STM32_STM32F33XX)|| \
defined(CONFIG_STM32_STM32F37XX) || defined(CONFIG_STM32_STM32G4XXX)
/* This first implementation is for U[S]ARTs that support oversampling
@@ -1623,6 +1627,11 @@ static void up_set_format(struct uart_dev_s *dev)
#endif
up_serialout(priv, STM32_USART_CR3_OFFSET, regval);
+#if defined(CONFIG_STM32_STM32G4XXX)
+ regval = up_serialin(priv, STM32_USART_CR1_OFFSET);
+ regval |= (USART_CR1_UE | USART_CR1_TE | USART_CR1_RE);
+ up_serialout(priv, STM32_USART_CR1_OFFSET, regval);
+#endif
}
#endif /* CONFIG_SUPPRESS_UART_CONFIG */