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?
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 :-)
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