Author Topic: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs  (Read 1105 times)

0 Members and 1 Guest are viewing this topic.

Offline KrotowTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: lv
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 is

MAX3232 for RS-232. Or MAX3222 or something else?
THVD1406 for RS-485.
UART line commutation multiplexing. 74HC4052 or similar.

Did I missed something?
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 5454
  • Country: dk
Re: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs
« Reply #1 on: December 11, 2024, 11:46:20 am »
pull up and two diodes, or an AND gate for the rx's
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4464
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs
« Reply #2 on: December 11, 2024, 12:14:17 pm »
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.

Offline PGPG

  • Frequent Contributor
  • **
  • Posts: 968
  • Country: pl
Re: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs
« Reply #3 on: December 11, 2024, 12:42:55 pm »
with switching between interfaces by a DIP switches or jumpers.
...
The problem is RX line commutation because simply joining them together...

For 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.
 

Offline KrotowTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: lv
Re: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs
« Reply #4 on: December 11, 2024, 12:52:24 pm »
with switching between interfaces by a DIP switches or jumpers.
...
The problem is RX line commutation because simply joining them together...

For 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.

What I want is to have single MCU UART accessible over RS-485 or RS-232 or simply by the same TTL lines to 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.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2908
  • Country: au
Re: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs
« Reply #5 on: December 13, 2024, 06:44:41 am »

What I want is to have single MCU UART accessible over RS-485 or RS-232 or simply by the same TTL lines to 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).
You 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 ?


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.
There are RS485 parts that should tolerate that
« Last Edit: December 13, 2024, 06:22:09 pm by PCB.Wiz »
 

Offline selcuk

  • Frequent Contributor
  • **
  • Posts: 259
  • Country: tr
Re: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs
« Reply #6 on: December 13, 2024, 07:12:43 am »
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.
 

Offline KrotowTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: lv
Re: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs
« Reply #7 on: December 13, 2024, 10:59:39 am »
Thanks. Turned out that RS-232/485 transceivers capable to work from 3.3V exist for a while :palm:   Went 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 ;D
« Last Edit: December 13, 2024, 11:17:06 am by Krotow »
 

Offline PGPG

  • Frequent Contributor
  • **
  • Posts: 968
  • Country: pl
Re: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs
« Reply #8 on: December 13, 2024, 03:45:36 pm »
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.

I 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.
 

Offline KrotowTopic starter

  • Regular Contributor
  • *
  • Posts: 87
  • Country: lv
Re: Sharing UART TTL lines with RS-232 and RS-485 transceiver receiver outputs
« Reply #9 on: December 13, 2024, 08:13:41 pm »
I 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.

Seems 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf