AnsweredAssumed Answered

UART - Proper way to clear TDRE and TC flags

Question asked by Paulo Louro on Sep 3, 2013
Latest reply on Sep 4, 2013 by Paulo Louro



I'm wondering what is the proper way to clear TDRE and TC flags.


According to the reference manual, in the ISR we shall read the UARTx_S1 and then write to UARTx_D to clear the flags.

But if there isn't more data to be sent, then writing to D register will cause NULL or what ever values to be shifted out.


To correct that I'm doing, disable transmission [TE], write to D and then perform a TXFLUSH.


Is this the correct way or there is a better one?