Skip to content

Commit 79c37cb

Browse files
committed
[BSP]changed stm32f10x uart driver. make sure the serial transmit
complete in putc().
1 parent 131c41d commit 79c37cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bsp/stm32f10x/drivers/usart.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* 2009-01-05 Bernard the first version
1313
* 2010-03-29 Bernard remove interrupt Tx and DMA Rx mode
1414
* 2013-05-13 aozima update for kehong-lingtai.
15+
* 2015-01-31 armink make sure the serial transmit complete in putc()
1516
*/
1617

1718
#include "stm32f10x.h"
@@ -118,8 +119,8 @@ static int stm32_putc(struct rt_serial_device *serial, char c)
118119
RT_ASSERT(serial != RT_NULL);
119120
uart = (struct stm32_uart *)serial->parent.user_data;
120121

121-
while (!(uart->uart_device->SR & USART_FLAG_TXE));
122122
uart->uart_device->DR = c;
123+
while (!(uart->uart_device->SR & USART_FLAG_TC));
123124

124125
return 1;
125126
}

0 commit comments

Comments
 (0)