Skip to main content
Karan Tak
Associate
October 27, 2017
Question

STM32F207 : Data Transmission at TXE Interrupt

  • October 27, 2017
  • 4 replies
  • 1030 views
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 .

    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    October 28, 2017
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Karan Tak
    Karan TakAuthor
    Associate
    November 8, 2017
    Posted on November 08, 2017 at 16:59

    Thank you Clive , 

    Disable of Interrupt at no data available : worked .

    S.Ma
    Principal
    October 28, 2017
    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.

    Tesla DeLorean
    Guru
    October 28, 2017
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..