3.3V Serial with 2 TX and 1 RX Line - Page 1
Forum section: electronics / beginners

author: mribble
author_rank: Regular Contributor
timestamp: March 15, 2017, 05:33:13 pm
content: 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!

author: Ian.M
author_rank: Super Contributor
timestamp: March 15, 2017, 05:45:30 pm
content: 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.

author: mribble
author_rank: Regular Contributor
timestamp: March 15, 2017, 06:11:12 pm
content: 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.

author: FrankBuss
author_rank: Unknown
timestamp: March 15, 2017, 06:11:46 pm
content: 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).

author: macboy
author_rank: Super Contributor
timestamp: March 15, 2017, 06:12:53 pm
content: 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,

author: mribble
author_rank: Regular Contributor
timestamp: March 15, 2017, 09:03:00 pm
content: 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.

author: dml1333
author_rank: Newbie
timestamp: March 15, 2017, 09:16:09 pm
content: (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?

author: langwadt
author_rank: Super Contributor
timestamp: March 15, 2017, 09:42:16 pm
content: Quote from: dml1333 on March 15, 2017, 09:16:09 pmThe 1k resistors doesn't make much sense, and the 10k should probably be smaller to make it reliable at high speed

author: pigrew
author_rank: Frequent Contributor
timestamp: March 15, 2017, 10:03:09 pm
content: 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.

author: Benta
author_rank: Super Contributor
timestamp: March 15, 2017, 10:05:05 pm
content: Quote from: langwadt on March 15, 2017, 09:42:16 pmWell, 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.

author: dml1333
author_rank: Newbie
timestamp: March 15, 2017, 10:05:27 pm
content: I should have mentioned that the speeds are typically 74,880 or 115,200 baud, such as for programming the ESP8266.

author: mribble
author_rank: Regular Contributor
timestamp: March 16, 2017, 09:16:26 pm
content: 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.