Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs - Page 1
Forum section: electronics / projects

author: Krotow
author_rank: Regular Contributor
timestamp: December 11, 2024, 11:42:19 am
content: Which is the proper way how to share UART signal lines (3.3V or 5V) with RS-232 and RS-485 transceiver receiver outputs? The goal is to have universal serial port with RS-232 and RS-485 interfaces and TTL lines available for debugging. Each interface can use separate connector like DB-9 or whatever else with switching between interfaces by a DIP switches or jumpers. Speed is not relevant (expected below 100 Kbps). The problem is RX line commutation because simply joining them together ends with non-working UART.The proposed component set isMAX3232 for RS-232. Or MAX3222 or something else?THVD1406 for RS-485.UART line commutation multiplexing. 74HC4052 or similar.Did I missed something?

author: langwadt
author_rank: Super Contributor
timestamp: December 11, 2024, 11:46:20 am
content: pull up and two diodes, or an AND gate for the rx's

author: AndyC_772
author_rank: Super Contributor
timestamp: December 11, 2024, 12:14:17 pm
content: I'd use a single multi-protocol interface IC, which can switch between modes as needed but present just one logic level interface to the UART. Something like an SP336.Or just use two UARTs in your CPU. Going to a larger CPU package is probably still cheaper and smaller than adding external logic.Some CPUs have pin multiplexing capability, so join your two RXD pins to different physical pins on the CPU, then remap between them in software as needed.

author: PGPG
author_rank: Frequent Contributor
timestamp: December 11, 2024, 12:42:55 pm
content: Quote from: Krotow on December 11, 2024, 11:42:19 amFor me your problem explanation is not clear.In one sentence you assume using jumpers to switch between interfaces and in next looks like you assume you can't use jumpers.

author: Krotow
author_rank: Regular Contributor
timestamp: December 11, 2024, 12:52:24 pm
content: Quote from: PGPG on December 11, 2024, 12:42:55 pmWhat I want is to have single MCU UART accessible over RS-485 or RS-232or simply by the same TTL linesto be able to connect whatever UART to serial IO extension adapter to it. There is only one UART1 for that because UART0 is taken by USB and UART2 - by LoRA/LTE modem and that I can't change. Also I won't to sink in combined IO IC moat due to risk to lock myself into using only that IC (who remember COVID years now). Better is to have something interchangeable, at least RS-485 transceiver IC which customer technicians occasionally manage to fry by waving around live 24V power wire near circuit board.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: December 13, 2024, 06:44:41 am
content: Quote from: Krotow on December 11, 2024, 12:52:24 pmYou can get RS232 transceivers with TTL output enables, (3223 etc) but they have more pins and are less common than the generic parts. RS485 parts already have output enables.A smaller generic 16 pin part and a tiny logic MUX may be cheaper / smaller overall ?Quote from: Krotow on December 11, 2024, 12:52:24 pmThere are RS485 parts that should tolerate that

author: selcuk
author_rank: Frequent Contributor
timestamp: December 13, 2024, 07:12:43 am
content: I recommend using two transceivers, two connectors and separate TVS diodes since each standard requires different voltage, drive and protection levels. So you can use a MAX232 plus a MAX485 (or equivalents) and connect Rx lines on the logic side with an AND gate such as 74AHC1G08. MAX485 and MAX232's supply voltage can be 3.3V or 5V. 74AHC1G08 has 5V tolerant inputs at 3.3V VCC, so you can mix transceiver voltages and still use a 3.3V MCU. Tx lines will be connected together and don't need an IC.

author: Krotow
author_rank: Regular Contributor
timestamp: December 13, 2024, 10:59:39 am
content: Thanks. Turned out that RS-232/485 transceivers capable to work from 3.3V exist for a whileWent into rabbit hole and found SP3222EEY-L for RS-232 and THVD1406DR for RS-485. Both works from both 3.3V and 5V and has a capability to turn off the RX into Z-state. What is exactly what I wanted.The rest of work is to find how to get 3.3V from 5V without turning the PCB into oven. A part of circuit I can't change still require 5V power. The choice between another switching DC-DC converter or LDO for 1.2A at output annoys me

author: PGPG
author_rank: Frequent Contributor
timestamp: December 13, 2024, 03:45:36 pm
content: Quote from: Krotow on December 13, 2024, 10:59:39 amI must still not understand something. Now you write that Z-state is among things you wanted. But if you (as you have written in first post) can use jumpers to select between interfaces you need not to have Z-state at output as you can just connect your UART input to one or to the second receiver using 3-pin jumper.

author: Krotow
author_rank: Regular Contributor
timestamp: December 13, 2024, 08:13:41 pm
content: Quote from: PGPG on December 13, 2024, 03:45:36 pmSeems you did understood the switches/jumpers too broadly. Yes, I want switching between interfaces with a DIP switch or a jumper. But I didn't mentioned that the TX/RX lines will get commuted in this way. No, no, only toggling the transceiver ICs and their RX outputs on and off. Both ICs I mentioned above has appropriate pins to that. To deal with them, single jumper or DIP switch per each interface plus one hex inverter and some resistors for pullup/pulldown seems enough. Maybe even simpler, but I wanted to use the rest of inverters to drive indicator LEDs.