I want to interface stm32f0 with rs422 (half duplex and full duplex). What I'm not getting how to connect RE and DE signals to rs 232. From UART I'll be having RX, TX, VCC and GND pins which i need to connect to TTL to RS232 converter ( http://www.emartee.com/Images/websites/emartee.com/T1d6JsXfBrXXXJ2U79_105143_jpg_310x310.jpg ) but where i should connect the RE and DE signals?

  • \$\begingroup\$ RS232 is fully duplex and you don't need Rx enables or TX enables (if that is what RE and DE are). I'm not sure this answers your question but it might get you to re-state what your question should be. \$\endgroup\$ – Andy aka Aug 13 '15 at 11:44
  • \$\begingroup\$ There also seems to be some confusion here between RS232 and RS422. Which is it that you are trying to achieve? \$\endgroup\$ – stefandz Aug 13 '15 at 11:44
  • \$\begingroup\$ I'm trying communicate with multiple slaves by using UART (RS232).. these are the devices I'm having TTL to RS232 converter and RS232 to RS422 converter \$\endgroup\$ – MustakMu Aug 13 '15 at 12:53
  • \$\begingroup\$ Where does RS-485 come into this?? \$\endgroup\$ – Daniel May 18 '16 at 4:54

The answer, as found in some random documentation checked into GitHub, is:

RS485 flow control (Driver enable feature) handling is possible through the following procedure:

# Program the Baud rate, Word length = 8 bits, Stop bits, Parity, Transmitter/Receiver modes and hardware flow control values using the USART_Init() function.

# Enable the Driver Enable using the USART_DECmd() function.

# Configures the Driver Enable polarity using the USART_DEPolarityConfig() function.

# Configures the Driver Enable assertion time using USART_SetDEAssertionTime() function and deassertion time using the USART_SetDEDeassertionTime() function.

# Enable the USART using the USART_Cmd() function.

The assertion and dessertion times are expressed in sample time units (1/8 or 1/16 bit time, depending on the oversampling rate).


This lets me Google search for the USART_DECmd command, which in turn leads me to the following application note:


This contains the final gold medal sentence:

The DE signal is mapped to the RTS pin of the USART, and in this application it is
connected with the pin 12 of port A (PA12).
(For STM32F05x)

Should it be this hard to find this out? No. But we live in an imperfect world.

The "receive enable" signal input on your transciever can either be wired to always-on (you will receive your own data,) or you can wire it to an inverse of the DE signal; typically using a pull-up and a N-channel MOSFET (like BS-138) with gate tied to the DE output signal. Or just use a transciever that switches both directions with a single pin :-)

  • \$\begingroup\$ Interesting. Of course on a chip that doesn't have that capability, or if the assigned pin is unavailable, the transmitter can be enabled by using any available output pin under software control, however it is necessary to wait to de-assert the signal until the UART status register indicates it has finished shifting out the last character, rather than just waiting until the transmit data register is empty (ie, the point when you could write another character). \$\endgroup\$ – Chris Stratton May 18 '16 at 5:17

You need to use an RS422 tranceiver, which would connect directly to your UART. The tranceiver will convert the UART to differential signals, and vice versa. There are both full duplex and half duplex tranceivers. Plenty of choices at a big supplier like Digikey -- http://www.digikey.com/catalog/en/partgroup/rs-422-rs-485-transceivers/9879?WT.srch=1

  • \$\begingroup\$ I want to know how should i connect RE and DE pins to max485 via GPIO pin and how RE and DE pins are mapped to DB9 pin \$\endgroup\$ – MustakMu Aug 14 '15 at 4:49
  • 1
    \$\begingroup\$ This answer doesn't actually answer the question, which is: Which pin/pins drive the "transmitter enable" input on a typical 485 buffer? FWIW: The publicly available STM32F0 data sheets mention that the chip has this capability (also known as "driver enable") but it doesn't list which pin it actually hooks up to. \$\endgroup\$ – Jon Watte May 18 '16 at 4:22
  • \$\begingroup\$ @JonWatte it was responsivery enough before the question was edited \$\endgroup\$ – Scott Seidman May 18 '16 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.