Skip to content

Commit 38ae4f9

Browse files
authored
Merge pull request #2128 from LMESTM/fix_F4_serial_it_issue2119
[STM32] Serial interrupt TC vs. TXE
2 parents 1201f4a + 9c33f70 commit 38ae4f9

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
771771
NVIC_EnableIRQ(irq_n);
772772
#endif
773773
} else { // TxIrq
774-
__HAL_UART_ENABLE_IT(handle, UART_IT_TXE);
774+
__HAL_UART_ENABLE_IT(handle, UART_IT_TC);
775775
NVIC_SetVector(irq_n, vector);
776776
NVIC_EnableIRQ(irq_n);
777777
#if DEVICE_SERIAL_ASYNCH_DMA
@@ -788,7 +788,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
788788
// Check if TxIrq is disabled too
789789
if ((handle->Instance->CR1 & USART_CR1_TXEIE) == 0) all_disabled = 1;
790790
} else { // TxIrq
791-
__HAL_UART_DISABLE_IT(handle, UART_IT_TXE);
791+
__HAL_UART_DISABLE_IT(handle, UART_IT_TC);
792792
// Check if RxIrq is disabled too
793793
if ((handle->Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1;
794794
}

hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
422422
// Check if TxIrq is disabled too
423423
if ((UartHandle.Instance->CR1 & USART_CR1_TXEIE) == 0) all_disabled = 1;
424424
} else { // TxIrq
425-
__HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TXE);
425+
__HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TC);
426426
// Check if RxIrq is disabled too
427427
if ((UartHandle.Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1;
428428
}

hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
341341
// Check if TxIrq is disabled too
342342
if ((UartHandle.Instance->CR1 & USART_CR1_TXEIE) == 0) all_disabled = 1;
343343
} else { // TxIrq
344-
__HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TXE);
344+
__HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TC);
345345
// Check if RxIrq is disabled too
346346
if ((UartHandle.Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1;
347347
}

hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
456456
// Check if TxIrq is disabled too
457457
if ((UartHandle.Instance->CR1 & USART_CR1_TXEIE) == 0) all_disabled = 1;
458458
} else { // TxIrq
459-
__HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TXE);
459+
__HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TC);
460460
// Check if RxIrq is disabled too
461461
if ((UartHandle.Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1;
462462
}

0 commit comments

Comments
 (0)