Question
UART DMA TX occasional errors
Once a while my Error_Callback() of the UART DMA RX/TX is triggered and I can't make sense out of it.
In the HAL_UART_ErrorCallback the values are
HAL_UART_GetState(huart) == 32 // HAL_UART_STATE_BUSY_RX
HAL_UART_GetError(huart) == 16 // HAL_UART_ERROR_DMA
huart->hdmarx->ErrorCode == 0 // NONE
huart->hdmatx->ErrorCode == 2 // HAL_DMA_ERROR_FE means fifo errorOkay, so it is a FIFO error. I am not using FIFO. Any ideas?
hdma_usart2_tx.Instance = DMA1_Stream6;
hdma_usart2_tx.Init.Channel = DMA_CHANNEL_4;
hdma_usart2_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_usart2_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_usart2_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_usart2_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_usart2_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_usart2_tx.Init.Mode = DMA_NORMAL;
hdma_usart2_tx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
hdma_usart2_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
hdma_usart2_tx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
hdma_usart2_tx.Init.MemBurst = DMA_MBURST_INC4;
hdma_usart2_tx.Init.PeriphBurst = DMA_PBURST_INC4;
if (HAL_DMA_Init(&hdma_usart2_tx) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
__HAL_LINKDMA(huart, hdmatx, hdma_usart2_tx);Also I make sure that I do not call a transmit as long as the HAL_UART_TxCpltCallback() was not called and all transmits are in the main loop, not within an interrupt or callback.