Author Topic: 3.3V Serial with 2 TX and 1 RX Line  (Read 3842 times)

0 Members and 1 Guest are viewing this topic.

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
3.3V Serial with 2 TX and 1 RX Line
« on: March 15, 2017, 05:33:13 pm »
I have a system where micro0 has a TX line, micro1 has a TX line, and mirco2 has RX line.  These 3 lines are connected.  I know that micro0 and micro1 won't be transmitting at the same time, but just hooking all these lines together won't work because when they aren't communicating they pull the line to 0V.  So you would end up with a single between 0 and 3.3V when one wasn't transmitting and the other was.  Basically I want a way to change that 0V to high impedance.  Which you could obviously do with the micro, but I don't have control over the code for one of the micros.  So I though I could put a schottky diode on each tx pin so that they couldn't pull the line low if the other micro was pulling pushing the line high.  I thought that would work as long as the forward voltage drop in the diode was within limits for the bus (which it is).  However, it's not working reliably.

How do you experts suggest I solve this?

Thanks in advance!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12860
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #1 on: March 15, 2017, 05:45:30 pm »
Are you sure you are describing it correctly?
*most* logic level serial signals using RS232 framing idle high.
You can combine two such non-overlapping signals with an AND gate.
If it actually idles low, use an OR gate.
 

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #2 on: March 15, 2017, 06:11:12 pm »
I'll need to double check my low and high signals, but your solution is good.  That makes perfect sense.  I must have been trying to over think things.
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #3 on: March 15, 2017, 06:11:46 pm »
If you use 2 diodes, the signal can only be pulled down (or pushed up, if both diodes are the other direction). You need a pullup resistor at the RX pin (or pulldown resistor). I wonder why it works at all. But even with a pullup resistor, it would be not a nice sharp edge, and if the resistor is too low, it would be a problem for the TX pin drivers. So better use an AND gate. Doesn't need to be a big 7408 quad AND, but you can use a modern small 5 pin SOT-353 chip like the NC7SZ08P5X (same chips are available for OR gates).
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Online macboy

  • Super Contributor
  • ***
  • Posts: 2254
  • Country: ca
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #4 on: March 15, 2017, 06:12:53 pm »
In addition to the diodes, put a resistor from the Rx pin to ground. As it is, due to the diodes, there is no conduction path to pull the pin low. Its capacitance will keep it high for a short period of time until enough charge leaks out (through the leaky Schottky diodes) to register as low. The resistor solves this. I'd start with a few kohm, like 3.3k and go from there. Viewing the Tx pin and Rx pin waveforms on a scope would be highly beneficial.

Edit: FrankBuss beat me to it, and I forgot that TTL level UART idles high, so you want a pull-up resistor (as Frank said) not pull-down,
 

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #5 on: March 15, 2017, 09:03:00 pm »
I didn't mention it but we do have a 10K pullup resistor.

I do think the and gate is a better idea so I think that's the way I'll go.  Thanks for the pointer to the NC7SZ08P5X.

 

Offline dml1333

  • Newbie
  • Posts: 2
  • Country: us
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #6 on: March 15, 2017, 09:16:09 pm »
(working with mribble on this) Thanks for the quick replies and the proposal to use an AND gate does seem like a much better solution.  I do however have a couple of followup questions.  The full circuit that mribble was originally describing is in the schematic below.  We did have a 10K pull-up on the RX line.  Along the way, we added 1K resistors on each RX line based on recommendations in some Arduino forums, presumably for current limit protection.

1)do these 1K resistors make sense on the RX lines, or are they likely a contributor to the unreliability?  Are they advised or better without?
2)If we go with the recommended AND gate, then would the output be directly connected to RX (no pullup and no load resistor needed)?
3) Is anything needed or recommended for the 2-RX -> 1 TX (other direction)?  do the 1K current limit resistors make any sense here?
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4425
  • Country: dk
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #7 on: March 15, 2017, 09:42:16 pm »
(working with mribble on this) Thanks for the quick replies and the proposal to use an AND gate does seem like a much better solution.  I do however have a couple of followup questions.  The full circuit that mribble was originally describing is in the schematic below.  We did have a 10K pull-up on the RX line.  Along the way, we added 1K resistors on each RX line based on recommendations in some Arduino forums, presumably for current limit protection.

1)do these 1K resistors make sense on the RX lines, or are they likely a contributor to the unreliability?  Are they advised or better without?
2)If we go with the recommended AND gate, then would the output be directly connected to RX (no pullup and no load resistor needed)?
3) Is anything needed or recommended for the 2-RX -> 1 TX (other direction)?  do the 1K current limit resistors make any sense here?

The 1k resistors doesn't make much sense, and the 10k should probably be smaller to make it reliable at high speed



 

Offline pigrew

  • Frequent Contributor
  • **
  • Posts: 680
  • Country: us
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #8 on: March 15, 2017, 10:03:09 pm »
I sometimes put series resistors in order to damp high-speed signals, but in those cases, I'd use 22 or 33 ohm, and the resistors should be located close to the transmitting side of the line.

1 kOhm is likely way too high for this use.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5871
  • Country: de
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #9 on: March 15, 2017, 10:05:05 pm »
(working with mribble on this) Thanks for the quick replies and the proposal to use an AND gate does seem like a much better solution.  I do however have a couple of followup questions.  The full circuit that mribble was originally describing is in the schematic below.  We did have a 10K pull-up on the RX line.  Along the way, we added 1K resistors on each RX line based on recommendations in some Arduino forums, presumably for current limit protection.

1)do these 1K resistors make sense on the RX lines, or are they likely a contributor to the unreliability?  Are they advised or better without?
2)If we go with the recommended AND gate, then would the output be directly connected to RX (no pullup and no load resistor needed)?
3) Is anything needed or recommended for the 2-RX -> 1 TX (other direction)?  do the 1K current limit resistors make any sense here?

The 1k resistors doesn't make much sense, and the 10k should probably be smaller to make it reliable at high speed

Well, the 1k resistors make sense if the MCUs are not powered up at the same time. But I agree, 10 kohm pullup is a bit high, but making it much smaller with the 1k resistor there also won't wash. Perhaps 4.7k.
Regarding damping: hey, we're talking UARTs, not GB-Ethernet here.
« Last Edit: March 15, 2017, 10:11:05 pm by Benta »
 

Offline dml1333

  • Newbie
  • Posts: 2
  • Country: us
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #10 on: March 15, 2017, 10:05:27 pm »
I should have mentioned that the speeds are typically 74,880 or 115,200 baud, such as for programming the ESP8266.
 

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
Re: 3.3V Serial with 2 TX and 1 RX Line
« Reply #11 on: March 16, 2017, 09:16:26 pm »
When we switch to an and gate that will clean up that line's resistors.

I know the sam3x GPIO pins are protected against over current so if the esp8266 is then we can remove the 1K resistors.  If we want to keep them we could at least reduce them to something like 100 ohms which would be 33 ma.  They are just there for protection and I'm not sure if they are even needed for that.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf