AnsweredAssumed Answered

Disable RX TX Callbacks - Uart DMA stop

Question asked by Lukasz Przenioslo on Dec 17, 2015
Latest reply on Nov 19, 2016 by markt
Hello there,
I am using uart tx and rx with dma. It works, but each time I stop the DMA using:

/**
  * @brief Stops the DMA Transfer.
  * @param  huart: pointer to a UART_HandleTypeDef structure that contains
  *                the configuration information for the specified UART module.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_UART_DMAStop(UART_HandleTypeDef *huart)
{
  /* The Lock is not implemented on this API to allow the user application
     to call the HAL UART API under callbacks HAL_UART_TxCpltCallback() / HAL_UART_RxCpltCallback():
     when calling HAL_DMA_Abort() API the DMA TX/RX Transfer complete interrupt is generated
     and the correspond call back is executed HAL_UART_TxCpltCallback() / HAL_UART_RxCpltCallback()
     */
   
  /* Disable the UART Tx/Rx DMA requests */
  huart->Instance->CR3 &= ~USART_CR3_DMAT;
  huart->Instance->CR3 &= ~USART_CR3_DMAR;
   
  /* Abort the UART DMA tx Stream */
  if(huart->hdmatx != NULL)
  {
    HAL_DMA_Abort(huart->hdmatx);
  }
  /* Abort the UART DMA rx Stream */
  if(huart->hdmarx != NULL)
  {
    HAL_DMA_Abort(huart->hdmarx);
  }
   
  huart->State = HAL_UART_STATE_READY;
   
  return HAL_OK;
}

The TxCpltCallback and RxCpltCallback interrupts are generated. What would I have to do to disable them, so they wont be generated when I stop DMA? I tried HAL_UART_DMAPause before or HAL_NVIC_DisableIRQ but that did not help.

I would really apreciate help.

Outcomes