I’m designing an interface board that needs to communicate with one of two different plug-in boards using RS232 or RS485. The board needs to use the same connector for both protocols and has only one spare pin. The RS485 board is already in use and can’t be changed, but the RS232 board is in design so I have some freedom there.
The two boards are physically very close with short cables and connected grounds, so I’m not worried about ground loops.
The obvious issue here is that RS232 and RS485 have different voltage ranges, with RS232 presenting voltages that are out of spec for the RS485 transceiver.
My first and simplest thought is to simply to wire the two transceivers in parallel (using the enable pins to turn off the unneeded one) and either select an RS485 device like the SN65HVD21 which has a higher voltage range or an RS232 device with a lower drive voltage. Does this seem like a reasonable approach, or have I overlooked something?
My next thought was to use some form of switching to selectively route the signals to the correct receiver, but I’m not really sure how to switch positive and negative going signals.
Yes, one or the other but not both at the same time. Both variants (RS232 and RS485) will use the same 6-pin connector, of which five pins are already in use (12V, 5V, 0V, A, B, ). The interface board needs to detect which variant is connected and decode the correct signal type.
It’s not cheap but the MAX3160 is a multiprotocol transceiver that uses an IO to switch between RS232 and RS485. The RS232 is only +/-5V but might be good enough.
Both transmitting and receiving. I’ve considered a multi-protocol transceiver like the above mentioned MAX3160, but good grief, the cost of them is eye-watering.
You would need a power supply (possibly vampire power feeding off the remote end) to drive an analog switch (integrated or discrete FETs) so that the positive and negative rails for the switch span the operating voltage range for both protocols. You would need to level shift your enable signal so that the gates that make up the switch would be driven to the respective rails.