HAL_UART_Transmit_DMA issues | STM32F3
Currently I am working on UART DMA and I encountered problems after transmitting data via DMA UART. After 1 successful data transmission, the state flag remains on BUSY. After a search, I ended up on this thread and this fixed the problem.
static
void
UART_DMATransmitCplt(DMA_HandleTypeDef *hdma)
{
UART_HandleTypeDef* huart = ( UART_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
/* DMA Normal mode*/
if
( HAL_IS_BIT_CLR(hdma->Instance->CCR, DMA_CCR_CIRC) )
{
huart->TxXferCount = 0;
/* Disable the DMA transfer for transmit request by setting the DMAT bit
in the UART CR3 register */
CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT);
/* Enable the UART Transmit Complete Interrupt */
__HAL_UART_ENABLE_IT(huart, UART_IT_TC);
huart->State=HAL_UART_STATE_READY;
//<--- i add this line to solve the //problem
}
/* DMA Circular mode */
else
{
HAL_UART_TxCpltCallback(huart);
}
}Line 31 in code snippet
However, is this a good solution (and should this be implemented in the stm32f3 library) or am I missing something that causes this problem of only 1 successful transmission?
