MCF5223x UART TXEMPTY interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MCF5223x UART TXEMPTY interrupt

2,397件の閲覧回数
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 ?

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

700件の閲覧回数
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 件の賞賛
返信

700件の閲覧回数
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 件の賞賛
返信

700件の閲覧回数
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 件の賞賛
返信