Commit a1a16ffd authored by Damien George's avatar Damien George

stm32/uart: Use timeout_char even with CTS enabled.

When timeout=0 (non-blocking mode) the UART should still wait for each
character to go out.  Otherwise non-blocking mode with CTS enabled is
useless because it can only write one character at a time.
Signed-off-by: default avatarDamien George <damien@micropython.org>
parent d8b03377
...@@ -1069,11 +1069,6 @@ size_t uart_tx_data(machine_uart_obj_t *self, const void *src_in, size_t num_cha ...@@ -1069,11 +1069,6 @@ size_t uart_tx_data(machine_uart_obj_t *self, const void *src_in, size_t num_cha
} }
uint32_t timeout; uint32_t timeout;
if (self->uartx->CR3 & USART_CR3_CTSE) {
// CTS can hold off transmission for an arbitrarily long time. Apply
// the overall timeout rather than the character timeout.
timeout = self->timeout;
} else {
#if defined(STM32G4) #if defined(STM32G4)
// With using UART FIFO, the timeout should be long enough that FIFO becomes empty. // With using UART FIFO, the timeout should be long enough that FIFO becomes empty.
// Since previous data transfer may be ongoing, the timeout must be multiplied // Since previous data transfer may be ongoing, the timeout must be multiplied
...@@ -1088,7 +1083,6 @@ size_t uart_tx_data(machine_uart_obj_t *self, const void *src_in, size_t num_cha ...@@ -1088,7 +1083,6 @@ size_t uart_tx_data(machine_uart_obj_t *self, const void *src_in, size_t num_cha
// to be transferred to the data register, and then to be transmitted. // to be transferred to the data register, and then to be transmitted.
timeout = 2 * self->timeout_char; timeout = 2 * self->timeout_char;
#endif #endif
}
const uint8_t *src = (const uint8_t *)src_in; const uint8_t *src = (const uint8_t *)src_in;
size_t num_tx = 0; size_t num_tx = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment