cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX bug in uart dma

pthomas8589
Associate
Posted on September 13, 2016 at 03:24

Hello,

I think there might be a bug in the STM32CubeMX generated code. I'm using the NUCLEO-F302R8 USART2 (PA2, PA3) with DMA for the tx. The first HAL_UART_Transmit_DMA() is always OK, but subsequent calls were failing because of the check on huart->gState at the start of HAL_UART_Transmit_DMA(), so I added a

 huart->gState = HAL_UART_STATE_READY;

Line just after __HAL_UART_ENABLE_IT() in UART_DMATransmitCplt() and this seemed to do the trick. I've attached the STM32CubeMX file (Version 4.16.1 and STM32F3 firmware package 1.6.1.

thanks,

Paul

1 REPLY 1
carmine
Associate II
Posted on September 13, 2016 at 17:08

That is not a bug. The state of the UART handle is correctly managed inside the HAL_UART_IRQHandler(), which must be called from the USARTx_IRQHandler() (clearly, you have to enable the IRQ at NVIC level).