Skip to main content
Associate III
September 2, 2026
Question

Can I use a single pin for USART TX/RX (RS485 Slave) on STM32H533?

  • September 2, 2026
  • 4 replies
  • 55 views

Hi everyone,

I am currently working on a project using an STM32H533RET6 and I need to implement an RS485 Slave interface. To save as many GPIOs as possible, I was wondering if it is possible to use just one single CPU pin for both USART TX and RX (and one additional pin for both RE and DE)?

I know that the STM32 supports a Single-wire Half-duplex mode (setting HDSEL in the USART_CR3 register). From my understanding, this makes the TX pin bidirectional and completely frees up the RX pin to be used as a standard GPIO.

However, my main concern is how to connect this to the external RS485 transceiver. A standard transceiver (like the MAX485) requires at least three pins: DI, RO, and the DE/RE control pin.

My thoughts so far: If I tie DI and RO together and connect them to the STM32's TX pin, I would still need a second GPIO to toggle the DE/RE pin. That would be a 2-pin solution.

Has anyone successfully implemented this approach in a real project? Are there any hidden pitfalls regarding the configuration?

Any advice or experiences would be highly appreciated!

Thanks in advance

4 replies

jiangfan
ST Employee
September 7, 2026

 

Hidden pitfalls

A few things to watch for:

  1. Bus contention

    • You must disable transmit driver before listening.
    • Otherwise you may block reception or drive the bus at the wrong time.
  2. Turnaround timing

    • RS485 needs careful timing between TX completion and enabling receive.
  3. Transceiver behavior

    • Some transceivers support automatic direction control or fail-safe behavior; others do not.
  4. STM32 configuration

    • Half-duplex mode changes how the USART pin behaves.
    • Make sure the GPIO alternate-function and USART settings match the intended topology.
  5. RO not tied to DI

    • Do not short them together unless the external transceiver/application explicitly supports that topology.

NOTE: reviewed answer mostly from AI

 

Pavel A.
September 7, 2026

When you configure an U(S)ART in half duplex RS-585 mode, the Cube lets you to select the “RTS” pin to use as the DE pin. So yes, two pins.  The point is that the STM32 will automatically drive the RTS (DE) pin as you transmit.  The Cube library will set up this pin (polarity, timing)  and the half-duplex functionality of  the U(S)ART. Please see the examples, and ask the Sidekick to explain the registers and bits.

 

David Littell
Senior II
September 7, 2026

TI offers some nice auto-DE devices that you might consider.

Explorer
September 7, 2026

I think the two-pin approach makes sense. The main thing I’d watch is the timing when switching from transmit to receive, especially making sure the last byte has fully shifted out before DE is released. Automatic DE through the USART RTS pin sounds like the cleaner option if you have the pin available.