This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GH6PM: UART hardware flow control pin as RS485 driver enable pin

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: NA555

Dear all,

I am trying to replace the existing UART connections in TM4C123GH6PM controller with RS485 using SP3485 IC (datasheet).

Is there any way to use hardware flow control to set the direction automatically while transmitting as shown below by connecting RE and DE pin together?

According to my understanding, the transmitting side checks the state of its CTS pin before transmitting, and  the receiving side uses RTS to say “go” or “stop.” Turning RTS from off to on indicates that the amount of data in the Rx buffer is lower than the RBL, and turning it from on to off means the length is higher than the RBH. With this there is no chance of using RTS or CTS for automatic direction selection.

Please correct me if I am wrong.

  • Certain MCUs here employ a (near) "Modem Capable" UART.    (encompasses several of the "past" modem flow control signals)
    Such added UART capability usually appears upon just one (maybe two) of the multiple UART instantiations - resident upon the MCU.

    Should your MCU not be so "blessed" - it is suspected that  "One or more of the UART's existing interrupts" - may be pressed into service - to achieve your objective.    I suspect a,  "Not quite exact match - yet a "serviceable match."

    Your vectoring to the Forum Search Box (atop this page) keyword "RS485" and/or "UART Flow Control" should provide listings of the results - and attempts of others - to achieve your objective...

    While your goal IS fair & efficient - (many) "operate under RS485 successfully" - by first "listening" - and only then driving "DE" (courtesy of a simple GPIO - as you "KNOW When" - you are going to transmit) - and then immediately returning to "Receive Mode."

  • You are correct, RTS and CTS are not meant to control a local transceiver, but are RS232 signals that control flow when properly buffered and sent to the other end of the communication link. You are better of just using an I/O pin under software control to change the flow direction.

    If you absolutely need automatic direction control, here is an application note doing that with a NA555.
    www.ti.com/.../tidubw6.pdf
  • Believe that it proves worthwhile to, "Add to vendor Bob's advice" ("just use an I/O pin") the (sure) requirement to, "FIRST LISTEN - to insure the RS485 Bus is QUIET" - and only then (if quiet), "Launch your transmission!"  

    Bus contention among RS485 line drivers "Is to be Avoided" - and that  "Listen prior to Transmit" - provides an  important "safety factor."

  • Hi
    When you suggested "Listen prior to Transmit" - Is it a firmware specific solution or is there any method to detect the traffic by electrical means?
    In other words how will I ensure that the RS485 is quiet?
  • supreeth anil said:
    Is it a firmware specific solution or is there any method to detect the traffic by electrical means?

    That's a fair & thoughtful question.     (Yet equally fair would be your "Green Stamp of Approval.")

    Traffic may be "more quickly detected" by routing the output of the RS485 driver to (another) GPIO  (i.e. in "parallel" w/UART_RX) - which could generate an interrupt - thus requiring NO USER Intervention.     (the presence of that  "interrupt" signals the RS485 Bus as "Busy!"   And this (may) be "automated.")

    The GPIO may be "saved" if Bus Usage is minimal - then "Listening Alone" may suffice.

    It proves EVEN POSSIBLE - albeit at the cost of an additional GPIO - to employ that  "Bus BUSY Interrupt" to  "Automatically Switch" your RS485 driver!     (two Green Stamps requested for that!)