Merged in spiriou/nuttx/stm32_lowputc (pull request #613)

arch/arm/src/stm32/lowputc: fix uart glitch when lowputc is enabled

Calling up_lowputc() when a character is in the shift register results
in corrupted character on stm32f1xx and stm32f205 cores.
TC status bit ensures that up_lowputc() waits for an on-going
transmission to complete before writing in TDR.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Simon Piriou 2018-03-12 22:01:00 +00:00 committed by Gregory Nutt
parent a5e1553022
commit f62bfca94e

View File

@ -413,7 +413,7 @@ void up_lowputc(char ch)
#ifdef HAVE_CONSOLE #ifdef HAVE_CONSOLE
/* Wait until the TX data register is empty */ /* Wait until the TX data register is empty */
while ((getreg32(STM32_CONSOLE_BASE + STM32_USART_SR_OFFSET) & USART_SR_TXE) == 0); while ((getreg32(STM32_CONSOLE_BASE + STM32_USART_SR_OFFSET) & USART_SR_TC) == 0);
#ifdef STM32_CONSOLE_RS485_DIR #ifdef STM32_CONSOLE_RS485_DIR
stm32_gpiowrite(STM32_CONSOLE_RS485_DIR, STM32_CONSOLE_RS485_DIR_POLARITY); stm32_gpiowrite(STM32_CONSOLE_RS485_DIR, STM32_CONSOLE_RS485_DIR_POLARITY);
#endif #endif