From bfabd1d961566afd49d3af5d1b0e6ee4e53cb46a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 5 Nov 2017 11:10:11 +0000 Subject: Fixed bug #901. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10956 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c | 7 ++++--- os/hal/ports/STM32/LLD/USARTv2/hal_uart_lld.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'os/hal/ports/STM32') diff --git a/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c b/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c index 6b36178ae..8cb5c1a8f 100644 --- a/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c +++ b/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c @@ -730,9 +730,10 @@ void uart_lld_start_send(UARTDriver *uartp, size_t n, const void *txbuf) { dmaStreamSetMode(uartp->dmatx, uartp->dmamode | STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE); - /* Only enable TC interrupt if there's a callback attached to it. - Also we need to clear TC flag which could be set before. */ - if (uartp->config->txend2_cb != NULL) { + /* Only enable TC interrupt if there's a callback attached to it or + if called from uartSendFullTimeout(). Also we need to clear TC flag + which could be set before.*/ + if ((uartp->config->txend2_cb != NULL) || (uartp->early == false)) { uartp->usart->SR = ~USART_SR_TC; uartp->usart->CR1 |= USART_CR1_TCIE; } diff --git a/os/hal/ports/STM32/LLD/USARTv2/hal_uart_lld.c b/os/hal/ports/STM32/LLD/USARTv2/hal_uart_lld.c index f00fa28ef..505cd537a 100644 --- a/os/hal/ports/STM32/LLD/USARTv2/hal_uart_lld.c +++ b/os/hal/ports/STM32/LLD/USARTv2/hal_uart_lld.c @@ -953,9 +953,10 @@ void uart_lld_start_send(UARTDriver *uartp, size_t n, const void *txbuf) { dmaStreamSetMode(uartp->dmatx, uartp->dmamode | STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE); - /* Only enable TC interrupt if there's a callback attached to it. - Also we need to clear TC flag which could be set before. */ - if (uartp->config->txend2_cb != NULL) { + /* Only enable TC interrupt if there's a callback attached to it or + if called from uartSendFullTimeout(). Also we need to clear TC flag + which could be set before.*/ + if ((uartp->config->txend2_cb != NULL) || (uartp->early == false)) { uartp->usart->ICR = USART_ICR_TCCF; uartp->usart->CR1 |= USART_CR1_TCIE; } -- cgit v1.2.3