casaroli commented on code in PR #20993:
URL: https://github.com/apache/nuttx/pull/20993#discussion_r4392217286
##########
arch/arm/src/common/stm32/stm32_serial_m33_v3.c:
##########
@@ -1576,6 +1576,33 @@ static void stm32serial_setformat(struct uart_dev_s *dev)
uint32_t regval;
uint32_t brr;
uint32_t cr1;
+ uint32_t cr1_ue;
+ irqstate_t flags;
+ int timeout;
+
+ /* Wait for any ongoing transmission to complete before disabling UE */
+
+ regval = stm32serial_getreg(priv, STM32_USART_CR1_OFFSET);
+ if ((regval & (USART_CR1_UE | USART_CR1_TE)) ==
+ (USART_CR1_UE | USART_CR1_TE))
+ {
+ timeout = 50000;
Review Comment:
The TC wait ends after 50000 loop passes, a few milliseconds at 160 MHz and
shorter than one character at 1200 baud (8.3 ms), so UE is still cleared in the
middle of a frame; the same loop is in the other five files.
Fix: bound the wait by `priv->baud` (with `up_udelay()`), or remove it as
#20914 did for L4.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]