serial: stm32: Give H/W a chance to set the TXE bit on transfer
It is possible to evaluate the TXE bit *before* H/W has had the opportunity to detect that data is being processed. Therefore we should hold off on any evaluation until TXE has initially been set. Change-Id: Iff26bfbe3ab419734003bf81a4cb357de83908e7 Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
a20b249549
commit
49c2858d94
1 changed files with 7 additions and 0 deletions
|
@ -101,6 +101,13 @@ static int uart_stm32_fifo_fill(struct device *dev, const uint8_t *tx_data,
|
|||
#else
|
||||
LL_USART_TransmitData8(UartHandle->Instance, tx_data[num_tx++]);
|
||||
#endif
|
||||
/*
|
||||
* Wait for H/W to set TXE flag, or else it will be evaluated
|
||||
* again at the top of this loop *before* H/W has chance to
|
||||
* initially detect that data is being processed.
|
||||
*/
|
||||
while (!__HAL_UART_GET_FLAG(UartHandle, UART_FLAG_TXE))
|
||||
;
|
||||
}
|
||||
|
||||
return num_tx;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue