2016-03-21 12:10 PM
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
2016-03-22 04:15 AM
Hi pabouctsidis.alex,
Thanks for the feedback. I will check it internally and come back to you. -Hannibal-2016-03-23 03:14 AM
Hi pabouctsidis.alex,
It is not a bug. You should ensure that you have puted the USARTx_ IRQHandler inside ''stm32f7xx_it.c'', in addition to USARTx-DMA_TX and USARTx-DMA_RX IRQHandlers . The set of the ready flag is managed inside HAL_UART_IRQHandler() by the UART_EndTransmit_IT(). -Hannibal-2016-03-24 02:00 AM
Thanks for checking.
In that case, the stm32cube did not generate the proper code. the USART init doesnt configure the nvic for usart interrupts, and there is no USART interrupt handler in stm32fxx_it.cFurthermore, calling the usart interrupt after the transmission complete dma interrupt makes very little sense, and seems like needless overhead.2016-03-24 07:20 AM
Hi bouctsidis.alex,
I Think you mean STM32CubeMX that you have used to generate. Please tru to share your .ioc file and mention which version you have used . -Hannibal-2016-08-05 08:24 AM
Hello,
I have the same problem.It seems to me, that USARTx_ IRQHandler will called for every byte. I'm right?