# RS232 and RS485 over same pins

I have 2 pins and primary function should be A/B RS485, but is possible that I also put RS232 (Rx/Tx) chip on same bus and then control which one I want to use from microcontroller.

I was thinking about MAX232 and MAX481 and enabling and disabling them trough power on/off controlled by microcontroller driving transistor.

Is there any single device that does this?

• There is Maxim part that is a dual mode transceiver, using a logic input to choose whether it is RS-232 or RS-485. I've used it in several designs, but I can't recall the part number off the cuff. It is possible that merely knowing that such a thing exists will help you find it, but I'll try to remember to dig up the number when I'm back in my office later. Nov 2 '11 at 8:32

Exar has the SP331 programmable RS-232/RS-485 transceiver which may suit your needs.

• I added the manufacturer name and part number so that if the URL ever gets moved, there is at least some contextual information to go by in this post. Please consider this approach when posting links to datasheets. Jul 20 '11 at 16:31

Since you like parts from Maxim now, take a look at the Maxim MAX3160 and friends. They provide transceivers for both RS-232 and RS-485 protocols, allowing the protocol to be chosen at run time by driving a logic level input.

We are using the MAX3161 in a couple of projects which provide only a three contact terminal strip for field wiring the serial cable (Rx/A+, Tx/B-, Gnd). If the port is incorrectly configured the device is still safe because, unlike most RS-422 receivers, it tolerates the full range of RS-232 voltages on the pins regardless of which protocol is currently selected.

This part is a little more expensive than a pair of individual protocol drivers, but makes up for that in saved board area and saved complexity.

• and dear Rberteig, Can we do the same thing with a Max3160 ? I would like to have a teminal chip with 3 contacts : RX,TX and GND for RS232, and A,B, GND for RS485 ( half duplex mode ). But it seems that we can't do it with a MAX3160 because pin 13 and pin 14 are disconnected if HALF DUPLEX is ENABLE. Can you provide a schematic ? Best Regards,
– user19209
Feb 20 '13 at 8:05
• @user19209, As I recall, we started the first design with the MAX3160 in mind, then discovered effectively the same issue which is why we moved to the MAX3161. Feb 21 '13 at 21:49

You should not connect ordinary RS485 drivers (e.g MAX481) onto the same wires as RS232, because the negative RS232 voltages can easily exceed the -8V abs-max for the MAX481.

If you can't use the suggested combined part, you'll need to check the specs of the RS485 part you do use very carefully for compatibility with RS232. Or use some kind of switching, of course.

• An even more important caveat than the one posed by jpc! Jul 22 '11 at 0:04

Powering a device down may cause its ESD diodes to start conducting current from the data lines, allowing some power to pass through into Vcc. You should use an RS232 transceiver with an ENABLE line.

With RS485 it is simpler, any chip with separate DE and RE (driver and receiver enable) will do.