cancel
Showing results for 
Search instead for 
Did you mean: 

UART half duplex Tx enable switching problem

tklausen
Associate
Posted on June 04, 2012 at 16:19

I'm implementing a half duplex communication on a STR912 mcu.

My problem is the usual, to know when the last bit is transmitted in the last byte. This to know when to turn off the transmit enable to the RS485 driver. The enable signal is controlled with a separate IO-pin.

I'm primarily trying to find an application note describing this. I've not even managed to find a reasonable complete description of the uart's functionality, just bits and pieces here and there.

Anyone with info out there?

Thanks in advance.

TOK
3 REPLIES 3
Pantuca.Erwin
Associate II
Posted on June 05, 2012 at 08:25

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/CD00166390.pdf

we use the ''UART Busy'' bit (page 307).

our sequence goes like:

-uart interrupt, check if send interrupt

-if our send buffer empty (it means its the last byte) disable send int

-wait until UART Busy is cleared

-receive int enable

-receive enable

-reset 485 driver

tklausen
Associate
Posted on June 05, 2012 at 09:14

Thanks, that confirmed my suspicion of the need to poll the status bits. Why can't they make an interupt based on this? It would be so much simpler if the 'busy off' transition was made an interupt, not only for a half duplex, but anywhere there is a need to reduce driver power for instance.

Very good help, thanks a lot.

BTW You use a single byte buffer for this, no fifo?

TOK

Pantuca.Erwin
Associate II
Posted on June 06, 2012 at 10:01

we use send buffer up to 256bytes long.  we also have fifo enabled.