0

i use stm32f407 HAL to use USART TX/RX DMA, Circle DMA For RX, Normal For Tx. The RX work pretty well, But the Tx work with some abnormal after runing some times, tx dma do`t enter Transfer Complete Interrupt, I have no idea with this, Why this happened?

I have clear the flag in TC Callback after next callHAL_UART_Transmit_DMA(&huart1,pdata,len); But the tx dma do`t enter Transfer Complete Interrupt

I have clear the usart and tx dma flag. But i have no effacts

**
  * @brief  USART User TC Callback (Interrupt)
    * @param  huart: 串口句柄
  * @retval None
  */
void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{
    __HAL_UART_CLEAR_FLAG(huart, UART_FLAG_TC);
    
    //huart->gState = HAL_UART_STATE_READY;
    
    if( huart->Instance == USART1 )
    {
        RS485_DIR_RX(1);                            
        usart_tx_dma_status[USART1_INDEX] = 0;
//      hdma_usart1_tx.State = HAL_DMA_STATE_READY;
//      __HAL_UNLOCK(&hdma_usart1_tx);
    }
}
mandi
  • 11
  • 1
  • Does UART have any flags set when it happens? For example, if you don't clear overrun flag, it may act abnormally. Maybe some other flag is set, or some config is not set. It could be on DMA side or UART side. Investigate a little more. – Ilya Jul 25 '23 at 12:28

0 Answers0