cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F207 : Data Transmission at TXE Interrupt

Karan Tak
Associate
Posted on October 27, 2017 at 20:06

Hello ! I am working on STM32F207 controller , where  I am trying to transmit my data over UART2 at TXE Interrupt . i have used ISR mention in attached file but its not working , problem is it stuck in Interrupt loop after transmission starts .

4 REPLIES 4
Posted on October 28, 2017 at 16:18

Code is incomplete and doesn't compile.

Routines in the interrupt handler should not block. If no data is available to send, the TXE interrupt must be turned off. The Cortex-M3 will stay in the interrupt state if you fail to clear the sources of those interrupts. Use a debugger and simplify the code until you understand what is happening.

You only need to check the TXE flag in the USARTx->SR, you don't need to test multiple bits and use &&

Review avaliable HAL example code for the USART under the Cube directories.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
S.Ma
Principal
Posted on October 28, 2017 at 16:56

I usually avoid using TX under interrupt. Only RX would require interrupt as the data flow is not under control of the STM32.

Use polling byte or block transfer by DMA for example.

Posted on October 28, 2017 at 17:08

Polling for each tx character doesn't seem to be an efficient strategy, DMA works well for large blocks.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on November 08, 2017 at 16:59

Thank you Clive , 

Disable of Interrupt at no data available : worked .