Author Topic: Two TX to one RX  (Read 8901 times)

0 Members and 1 Guest are viewing this topic.

Offline Rick LawTopic starter

  • Super Contributor
  • ***
  • Posts: 3442
  • Country: us
Two TX to one RX
« on: February 09, 2015, 07:16:16 am »
Two TX to one RX - connected full time but only one TX in use at a time

My goal is to connect another RS232-TTL device (such as a Bluetooth or say CH340) to an Arduino UNO (16U2) or NANO (FT232RL) without having to rewrite the program.  They won’t be both transmitting at the same time, but they are wired-in full time.

One TX to two RX is no problem, having two TTL-RXD inputs listening to a single TTL-TXD output works in theory and in practice.  So both the second RS232 device (CH340 or Bluetooth or FT232RL) AND the build-in (16U2 or FT232RL) should be able to listen.

What I am not sure is the RXD.  In this case, I have two TTL-TXD outputs into one RXD input to the ATMEGA328.

I know that if the TXD output goes hi-impedance when not transmitting, the other device's TXD can transmit and it should works in theory as well as in practice.  But I can't find any info on either FT232RL's datasheet or 16U2's datasheet on if TXD are tri-state or not.
 
Since this info is not in either datasheet, I am thinking it may be part of a common practice or perhaps a standard that TXD be tri-state (or not).  But I don’t know what it is…

Anyone has info on that?

By the way, I know I can wire up my FT232RL-TTL as the foreign RS232 and try.  But, I want to make sure it is suppose work in theory - instead of just luck and happen to work in this particular combination of fiddling.

Thanks for your input
Rick

« Last Edit: February 09, 2015, 07:41:51 am by Rick Law »
 

Offline Paul Moir

  • Frequent Contributor
  • **
  • Posts: 926
  • Country: ca
Re: Two TX to one RX
« Reply #1 on: February 09, 2015, 07:43:22 am »
Normally they  stay on line.  There are a few drivers that can shut down, which will tristate their outputs but they're rare.

Some discussion here:
https://www.eevblog.com/forum/beginners/rs232-switch-looking-for-the-right-search-term/

(Note that's in the beginner's forum.  There's a lot of unworkable stuff by the OP.  Just skim over that.)
 

Offline jmsc_02

  • Regular Contributor
  • *
  • Posts: 63
  • Country: es
Re: Two TX to one RX
« Reply #2 on: February 09, 2015, 07:51:48 am »
the datasheetvof tye ft232r comments that txd are tri-stated when the chip is in reset status.
i am doing a great effort to get my english plugin up and running, but it has its bugs and "zero days" fails so please, help me to improve it!
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4427
  • Country: dk
Re: Two TX to one RX
« Reply #3 on: February 09, 2015, 09:03:21 am »
looks like there a 1K resistors on the arduiono so just add a diode to the extra Tx so it can only pull down




 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: Two TX to one RX
« Reply #4 on: February 09, 2015, 09:52:55 am »
I've done this in the past for infrastructure grade projects - using multiple modems in a polled arrangement - so only one 'replying' at any given time.  Tx outbound was 'paralleled' to all destinations, but only the correctly addressed remote site would talk back...

Solution was passive, simple and extremely reliable.
Schottky diodes (low LossVF) used as steering/isolation on the RX lines.  multiple 'in', single 'out'.
Don't ask a question if you aren't willing to listen to the answer.
 

Offline suicidaleggroll

  • Super Contributor
  • ***
  • Posts: 1453
  • Country: us
Re: Two TX to one RX
« Reply #5 on: February 09, 2015, 06:23:15 pm »
You could also stick a couple of tri-state buffers on the lines.  That way both devices can talk at the same time without interference/corruption, and you just choose which one you want to listen to.
 

Offline Rick LawTopic starter

  • Super Contributor
  • ***
  • Posts: 3442
  • Country: us
Re: Two TX to one RX
« Reply #6 on: February 10, 2015, 12:21:17 am »
I've done this in the past for infrastructure grade projects - using multiple modems in a polled arrangement - so only one 'replying' at any given time.  Tx outbound was 'paralleled' to all destinations, but only the correctly addressed remote site would talk back...

Solution was passive, simple and extremely reliable.
Schottky diodes (low LossVF) used as steering/isolation on the RX lines.  multiple 'in', single 'out'.

You could also stick a couple of tri-state buffers on the lines.  That way both devices can talk at the same time without interference/corruption, and you just choose which one you want to listen to.

My original thought was to implement this project using a pre-made Arduino UNO or Nano.  Taking that approach, I would not be able insert anything between the 16U2 (or the FT232RL) to the ATMEGA.

I will fiddle a little to see if I can get that to work with diode.

Thanks for all the advice and suggestions!

Rick
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Two TX to one RX
« Reply #7 on: February 10, 2015, 01:23:12 am »
I would implement some kind of usage signaling so a pending transmitter knows if the bus is being utilized by someone else.

One way to do it is to use a pull-up resistor. Any transmitter would test if that node is low (=being used). If it is not low, it would pull it down and then start transmission; Upon the end of the transmission, that node is released.

That's not exactly 100% collision free but will cut it down significantly.

To further cut it down, you can listen to the bus for a period of time before transmission; if the bus was indeed being used, you wait a random period of time before re-testing it.
================================
https://dannyelectronics.wordpress.com/
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 19511
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Two TX to one RX
« Reply #8 on: February 10, 2015, 10:28:08 am »
If we assume that you can physically connect two tx outputs without destroying them, you still have at least two other issues that will need to be solved at a higher level. And that may conflict with "...without having to rewrite the program".

The first is how does the rx know which tx has sent a message. There are many pre-existing solutions ranging from different forms of polling/handshaking to encoding the source within the message.

The second is how to ensure the two tx don't try to transmit simultaneously. There are many pre-existing solutions ranging from ensuring the two tx have a common time to some form of collision detection (think ethernet).
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Rick LawTopic starter

  • Super Contributor
  • ***
  • Posts: 3442
  • Country: us
Re: Two TX to one RX
« Reply #9 on: February 12, 2015, 06:17:52 am »
Ensuring just one TX transmit is not a problem the way I had envisioned this design to operate.  But I think I was just goofy in thinking to hook up two TX to one RX...

I finally freed up my FT232RL and do a check and experiment.  The TX do stay HIGH even while not transmitting.  If I am to use stock Arduino UNO or NANO, unless I cut a trace or something, hooking two TTL out to a single TTL in doesn't look workable.

I will have to rethink this...

Thanks for the input!
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: Two TX to one RX
« Reply #10 on: February 12, 2015, 06:51:38 am »
Ensuring just one TX transmit is not a problem the way I had envisioned this design to operate.  But I think I was just goofy in thinking to hook up two TX to one RX...
You don't like the diode steering proposal...?  It worked for Telstra.
Don't ask a question if you aren't willing to listen to the answer.
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Two TX to one RX
« Reply #11 on: February 12, 2015, 08:07:46 am »
I've used the diode (one for each slave transmitter) & resistor (as a pullup on the master receive) trick on a product that had lots of slave micros that needed to reply back to the master micro.  Worked well and super simple to implement.   :-+
 

Offline Rick LawTopic starter

  • Super Contributor
  • ***
  • Posts: 3442
  • Country: us
Re: Two TX to one RX
« Reply #12 on: February 12, 2015, 09:13:23 am »
Ensuring just one TX transmit is not a problem the way I had envisioned this design to operate.  But I think I was just goofy in thinking to hook up two TX to one RX...
You don't like the diode steering proposal...?  It worked for Telstra.

I've used the diode (one for each slave transmitter) & resistor (as a pullup on the master receive) trick on a product that had lots of slave micros that needed to reply back to the master micro.  Worked well and super simple to implement.   :-+


May be I misunderstood.

The diode would be required by both Tx senders, right?  That would require cutting a trace on a stock Arduino Uno's 16U2 or the Nano's FT232RL/CH340G, so that the on-board Tx and my add-on Tx can both have a diode.  Otherwise, the add-on Tx would be trying to pull the Rx low while the on-board Tx stays high and try to pull the same Rx high.  I don't think that would work if my add-on Tx alone has the diode.

I see that for both Nano and Uno schematic that there is a 1K resistor for the Tx from USB.  I am thinking I may just try to overwhelm it by connecting the add-on Tx with a lower resistor or no resistor at all.  Here the diode may make the difference.  But I am not sure if that is a reliable way of doing it.

I know this would be easily accomplished if I don't use a stock Uno or Nano.  It would be rather easy to put an ATMEGA328p and have it act like an UNO.  I have two like that.  But that would not accomplish my goal.

I have a reason for basing it on a stock Uno/Nano - it is intended to be a gift to someone drive his/her interest; but I expect (hope) that it would be taken apart and converted to something else.  That parts used for this would really be - shall we say "seeding the initial part-stock".  I want to use minimal part to show how easy it is.  A home-grown "Uno" would not accomplish the same thing.  It would be far less likely to be disassembled and modified.

(I don't want to disclose whom (or relationship) or even he or she in case he/she stumbles into this via Google search or something.  This whole idea that may not fly.)
« Last Edit: February 12, 2015, 09:29:40 am by Rick Law »
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Two TX to one RX
« Reply #13 on: February 12, 2015, 11:06:42 am »
Yes, you need to add the diode in series with each transmit line.  Whether that involves cutting tracks I've leave up to you.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Two TX to one RX
« Reply #14 on: February 12, 2015, 11:59:36 am »
Quote
The diode would be required by both Tx senders, right?

Those diodes form a crude OR gate.

Most (all?) decent usart modules have the pins in open drain, so they are naturally "ORed" when you connect them directly.
================================
https://dannyelectronics.wordpress.com/
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4427
  • Country: dk
Re: Two TX to one RX
« Reply #15 on: February 12, 2015, 03:30:30 pm »
Quote
The diode would be required by both Tx senders, right?

Those diodes form a crude OR gate.

Most (all?) decent usart modules have the pins in open drain, so they are naturally "ORed" when you connect them directly.

can you name a few modules that have open drain Tx? I've never seen any
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4427
  • Country: dk
Re: Two TX to one RX
« Reply #16 on: February 12, 2015, 03:39:16 pm »
Ensuring just one TX transmit is not a problem the way I had envisioned this design to operate.  But I think I was just goofy in thinking to hook up two TX to one RX...
You don't like the diode steering proposal...?  It worked for Telstra.

I've used the diode (one for each slave transmitter) & resistor (as a pullup on the master receive) trick on a product that had lots of slave micros that needed to reply back to the master micro.  Worked well and super simple to implement.   :-+


May be I misunderstood.

The diode would be required by both Tx senders, right?  That would require cutting a trace on a stock Arduino Uno's 16U2 or the Nano's FT232RL/CH340G, so that the on-board Tx and my add-on Tx can both have a diode.  Otherwise, the add-on Tx would be trying to pull the Rx low while the on-board Tx stays high and try to pull the same Rx high.  I don't think that would work if my add-on Tx alone has the diode.

I see that for both Nano and Uno schematic that there is a 1K resistor for the Tx from USB.  I am thinking I may just try to overwhelm it by connecting the add-on Tx with a lower resistor or no resistor at all.  Here the diode may make the difference.  But I am not sure if that is a reliable way of doing it.

I know this would be easily accomplished if I don't use a stock Uno or Nano.  It would be rather easy to put an ATMEGA328p and have it act like an UNO.  I have two like that.  But that would not accomplish my goal.

I have a reason for basing it on a stock Uno/Nano - it is intended to be a gift to someone drive his/her interest; but I expect (hope) that it would be taken apart and converted to something else.  That parts used for this would really be - shall we say "seeding the initial part-stock".  I want to use minimal part to show how easy it is.  A home-grown "Uno" would not accomplish the same thing.  It would be far less likely to be disassembled and modified.

(I don't want to disclose whom (or relationship) or even he or she in case he/she stumbles into this via Google search or something.  This whole idea that may not fly.)

the 1k resistor means you can do it with one diode and no cutting

when the add-on is idle(tx = high) the diode is reverse biased so everything works like normal
when the on-board is idle (tx = high) the 1K resistor works as a pull up and the add-on can pull low via the diode

 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Two TX to one RX
« Reply #17 on: February 12, 2015, 08:40:19 pm »
Quote
The diode would be required by both Tx senders, right?

Those diodes form a crude OR gate.

Most (all?) decent usart modules have the pins in open drain, so they are naturally "ORed" when you connect them directly.

Some micros may have the capability of running the TX pin as open drain, but as far as I know none of them do that by default.  If they did most regular applications wouldn't work correctly.

You'd have to check the datasheet for the micro you're using to see if it really can do open drain on the TX pin when assigned to the USART.
 

Offline Rick LawTopic starter

  • Super Contributor
  • ***
  • Posts: 3442
  • Country: us
Re: Two TX to one RX
« Reply #18 on: February 13, 2015, 02:40:08 am »
Quote
The diode would be required by both Tx senders, right?

Those diodes form a crude OR gate.

Most (all?) decent usart modules have the pins in open drain, so they are naturally "ORed" when you connect them directly.

Some micros may have the capability of running the TX pin as open drain, but as far as I know none of them do that by default.  If they did most regular applications wouldn't work correctly.

You'd have to check the datasheet for the micro you're using to see if it really can do open drain on the TX pin when assigned to the USART.

the 1k resistor means you can do it with one diode and no cutting

when the add-on is idle(tx = high) the diode is reverse biased so everything works like normal
when the on-board is idle (tx = high) the 1K resistor works as a pull up and the add-on can pull low via the diode

Great to hear an "acceptable" approach.  As something to drive interest for a kid, I hate to do something way to "patch-together-ish".  And as a gift, I sure hate to cut the board trace making the recipient less likely to treat is as a board ready for experimenting.

Also, I want to do it more by-the-book with this one.  Normally, I would just tinker and tinker to make it work; this one, I want the techniques/solutions to be more conventional.

Thanks guys - I have many great advice/idea to follow up on to solve this.

Rick
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf