cancel
Showing results for 
Search instead for 
Did you mean: 

In HAL_UART_Transmit_DMA UART transfer complete interrupt does not trigger.

SAkhi.951
Associate III

Hello,

After studying different issues on forum I still do not see anyone who solved this problem in a proper way.

When using UART DMA transfer it suppose to trigger TCIE interrupt,

    /* Disable the DMA transfer for transmit request by resetting the DMAT bit
       in the UART CR3 register */
    CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT);
 
    /* Enable the UART Transmit Complete Interrupt */
    SET_BIT(huart->Instance->CR1, USART_CR1_TCIE);

that switch peripheral to state READY. in HAL_UART_IRQHandler,

  /* UART in mode Transmitter (transmission end) -----------------------------*/
  if (((isrflags & USART_ISR_TC) != 0U) && ((cr1its & USART_CR1_TCIE) != 0U))
  {
    UART_EndTransmit_IT(huart);
    return;
  }

and

static void UART_EndTransmit_IT(UART_HandleTypeDef *huart)
{
  /* Disable the UART Transmit Complete Interrupt */
  CLEAR_BIT(huart->Instance->CR1, USART_CR1_TCIE);
 
  /* Tx process is ended, restore huart->gState to Ready */
  huart->gState = HAL_UART_STATE_READY;
 
  /* Cleat TxISR function pointer */
  huart->TxISR = NULL;

However, even though the flag is set and global interrupt is enabled, it does not trigger for me for some reason. Have anyone faced with similar problem ?

1 REPLY 1

So you've read out respective USARTx_SR in debugger and have seen TC being set? And TCIE being set in USARTx_CR1? And the proper interrupt routine address is inserted in the interrupt vector, as confirmed by observing the disasm? And the proper interrupt is enabled as checked in NVIC registers? And still no interrupt as checked by placing a breakpoint to the ISR's very first line, or toggling a pin and observing it on oscilloscope/LA? And isn't the mcu just stuck in some other higher-level interrupt or fault handler, or has inadvertently globally disabled interrupts?

Haven't you just omitted some of the above steps?

JW

PS. Change your username to a normal nick