Skip to main content
Visitor II
June 4, 2012
Question

UART half duplex Tx enable switching problem

  • June 4, 2012
  • 3 replies
  • 779 views
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
    This topic has been closed for replies.

    3 replies

    Visitor II
    June 5, 2012
    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

    tklausenAuthor
    Visitor II
    June 5, 2012
    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

    Visitor II
    June 6, 2012
    Posted on June 06, 2012 at 10:01

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