Question
Bug with STM32F7 HAL UART Tx DMA
Posted on March 21, 2016 at 20:10
Hello,
I'm currently running on the STM32F746VG, and used CubeMX to generate the configuration code for a simple USART Tx Output using the DMA. When callingHAL_UART_Transmit_DMA(..) it would transmit the data correctly for the first time (was confirmed with an oscilloscope) and then stop working. In order to make it work i had to add a line to stm32f7xx_hal_uart.c line 1272:static void UART_DMATransmitCplt(DMA_HandleTypeDef *hdma)
{
UART_HandleTypeDef* huart = ( UART_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
/* DMA Normal mode*/
if((hdma->Instance->CR & DMA_SxCR_CIRC) == 0)
{
huart->TxXferCount = 0;
/* Disable the DMA transfer for transmit request by setting the DMAT bit
in the UART CR3 register */
huart->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_DMAT);
/* Enable the UART Transmit Complete Interrupt */
__HAL_UART_ENABLE_IT(huart, UART_IT_TC);
huart->State= HAL_UART_STATE_READY;
// BUG CORRECTION
}
/* DMA Circular mode */
else
{
HAL_UART_TxCpltCallback(huart);
}
}
The callback was not resting the State flag toHAL_UART_STATE_READY.
Can you please confirm if this is indeed a bug?
Thanks,
Alex
#bug #stm32f7-hal-uart