MCF5223x UART TXEMPTY interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCF5223x UART TXEMPTY interrupt

2,165 Views
MichalKonieczny
Contributor I
UART USR status register has TEMP (TXEMPTY) flag and TXRDY flag for signalling transmitter state, pretty standard stuff. But UIMR/UISR interrupt register has the flag only for TXRDY, there's no TXEMPTY here.

I'm interfacing with RS-485 network and TXEMPTY interrupt was always an obvious way to turn off the transmitter AFTER the whole data block is shifted onto the wire.

Is there really no TXEMPTY interrupt, or am I missing something ?

Labels (1)
0 Kudos
3 Replies

468 Views
MichalKonieczny
Contributor I
Thanks for the tip about TXRTS bit giving this functionality. I must admit that I didn't read UART description line by line, expecting it to be somewhat similar to every other UART I've seen - HC11, HC12, etc.

I still miss TXEMPTY interrupt functionality, because it gives greater flexibility. Using RXRTS requires adequate hardware: active RTS is low, typical RS485 driver chip has active high TE (transmitter enable). So:
- driver TE must be connected to RTS line, no other I/O pin will do the job
- inverter is required to match logic levels.
0 Kudos

468 Views
bkatt
Contributor IV
I think they expect you to use the RTS control signal to enable/disable the RS-485 output. Here is the relevant paragraph from the 5282 manual, which works much like the 5223x:

"If the transmitter is programmed to automatically negate URTSn when a message transmission completes,
URTSn must be asserted manually before a message is sent. In applications in which the transmitter is
disabled after transmission is complete and URTSn is appropriately programmed, URTSn is negated one
bit time after the character in the shift register is completely transmitted. The transmitter must be manually
reenabled by reasserting URTSn before the next message is to be sent."

0 Kudos

468 Views
bkatt
Contributor IV


Michal Konieczny wrote:

Is there really no TXEMPTY interrupt, or am I missing something ?




I think you have to poll for the empty condition. And you must leave tx enabled for the empty flag to work. The program I started with had:

MCF_UART_UCR(dev) = MCF_UART_UCR_TX_DISABLED;

in the ISR when there is nothing left to send. I had to replace that with:

MCF_UART_UIMR(dev) = MCF_UART_UIMR_RXRDY_FU;

(which clears the TXRDY interrupt enable and leaves RXRDY_FU enabled).

Then the polling routine checks for empty:

if (MCF_UART_USR(dev) & MCF_UART_USR_TXEMP) ...

0 Kudos