Sending UART to multiple devices - opamp buffer needed? - Page 1
Forum section: electronics / general

author: paulca
author_rank: Super Contributor
timestamp: December 03, 2022, 02:34:54 pm
content: Simple question. If you want to share a UART Tx line between multiple Rx pins... does it's impedance allow for that or does it need buffering with an opamp?It's not a critical line, just a debug line. I'd like the main MCU to be able to pass through the debug channel of the Wifi module. At the same time though that Tx line is required to reflash the Wifi module also. So the Tx will connect to the MCU Rx AND a header pin.Googling gives me a mixed bag of results. At the extreme end is using actual line buffers to protect the MCU pins from "Users". In the middle was teh suggestion to use line drivers/transducers even for a PCB to PCB link!Surely I don't need to go that far for a debug line? Do I even need an op amp to drive 2 Rx transceivers from a single Tx pin?

author: Kleinstein
author_rank: Super Contributor
timestamp: December 03, 2022, 02:47:05 pm
content: It depends on the µC and Wifi module. The UART signals are normally just logic signals with normal drivers at the µC. In most cases they are OK to drive multiple targets and the UART protocoll is even a bit tollerant with ringing and similar due to the normally somewhat reduced speed (e.g. 115 kBaud).Extra buffers would protect the µC / module from ESD and similar events a little. A normal PCB to PCB link is normally OK without extra drivers. Extra drivers and maybe termnation resistors may help when the trace is long, like more than 1 m.

author: Mahagam
author_rank: Regular Contributor
timestamp: December 03, 2022, 02:48:52 pm
content: Any I/O ports between the user and the MCU must be buffered. Otherwise you don`t need any buffer for the uart.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 03, 2022, 02:56:41 pm
content: "Fan-out" and "fan-in" mostly remain the terms of 1980's and TTL.MCU IO is CMOS: in output mode, it is a fairly low-resistance switch to GND or VCC. In input mode, it's almost ideal "voltage meter" rounding the input value to GND or VCC; almost no leakage resistance; a tiny tiny bit of capacitance, like a scope probe.Thus, the output can drive hundreds of inputs quite easily. If interested about doing it more properly, sum up the IO pin capacitances as given in the datasheet (or approximate as 10pF per pin). Assuming 50 ohms of source impedance (basically the Rds_on of the MOSFETs in the output port, varies with part and temperature around 10 - 50 ohms), you can then calculate the RC time constant, which will limit your UART baudrate.If good signal integrity is important and lines are long, then you would buffer them separately and add a source termination (series) resistor right after each buffer, before the line.Within a PCB and traces of few inches, this does not matter, just route the UART to the (few) devices.Going into a connector, especially user-accessible, might prompt for some extra consideration for EMC, ESD and source termination to prevent overshoot and ringing. Even then you may not need a buffer, I just passed all EMC qualifications on first go with a simple design using RC filtering plus TVS diodes on microcontroller IO directly. Zapping the inputs with 8kV of ESD was no problem and passed immunity tests by A criteria (valid inputs) even though self-recovering failures were allowed.If you decide to use a buffer, don't use an opamp, use a digital logic buffer like something from 74HC series (or 74HCT if you want to convert levels from 3.3V to 5V). But I don't recommend the weird practice of adding random buffers and transistors "just because". Whenever the IO of the MCU is fine as is, then just enjoy the simplicity of design.

author: paulca
author_rank: Super Contributor
timestamp: December 03, 2022, 03:18:11 pm
content: I suppose as a minimum I should put 100Ohm resistors on the UART Rx/Tx header pins. At least this seems to be more the "minimum" from further googling. These are debug lines, so no users.The device will not need any EMC qualifications.If it works, it works, if it doesn't I'll explore using a 74HC bus transceiver, I think I have a few of those as through hole already.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 03, 2022, 07:24:46 pm
content: 100ohm series resistor is excellent advice: it's most bang for the buck. It will be slightly more than what is needed to terminate a typical trace or wire pair, but not excessively so to significantly slow down the edges. Just good amount to take some emissions away. 100 ohms is also just enough to limit current in case of short circuit, preventing damage to the MCU, even if the short persists. 100 ohms also limits the current going into the internal ESD protection diodes. Without current limiting, they blow easily, but with the resistor, you have some actual overvoltage protection, e.g. applying 5V to a pin of a 3.3V device, only approx. 1.4V/100ohms = 14mA flows. This is marginal and probably exceeds the capability of ESD diodes, but not by much - chances are high they survive, especially if the condition is not indefinitely long hard 5V, but some 5V level signal with <100% duty cycle and some current limiting of its own.100 ohms is also low-impedance enough for noise not to become an issue. Also 100R is acceptable as input impedance to basically all MCU SAR ADCs.If you use much larger resistor values, you are going to need to add some C, to filter noise or provide low impedance to ADC input. Then this filter greatly limits the available bandwidth. Much smaller values, and the protective features diminish. With 33R-47R, you are just terminating the line.Quote from: paulca on December 03, 2022, 03:18:11 pmIt will work, don't worry about it. If it doesn't, then it's some misunderstanding not fixable by the buffer (for example, peripheral swapping functions and actually driving the RX pin or something).

author: PCB.Wiz
author_rank: Super Contributor
timestamp: December 05, 2022, 01:21:48 am
content: Quote from: paulca on December 03, 2022, 02:34:54 pmThat's not enough info...What cable length is involved here ?If they are on the same board, or in the same box, a direct TTL pin connection will work fine, especially if they all power up/down at the same time.It's common practice to include anti-contention and ESD series resistors, there 1K is large, ~220R is more usual as that has less speed limiting effect.Most MCUs power up with floating or light pullups, so pin contention needs an unexpected situation.If the units power on/off at different times, or during power save modes, then you need to worry about parasitic power effects.In that case a CMOS buffer that is power-off specified could be useful.If there are high currents involved, you could look at isolated buffers.

author: David Hess
author_rank: Super Contributor
timestamp: December 05, 2022, 04:04:51 pm
content: The UART output is just like any other logic level output so the usual rules for fan-in and fan-out and transmission line length apply. CMOS outputs do not really have fan-in and fan-out in the same sense as TTL, but they still have capacitive load limits and transmission line issues if wire lengths are long enough.On a single board you can likely just tied everything together, and maybe use a series termination, or more than one, at the UART output. Keep in mind that it is not the UART output data rate which matters for transmission line effects, but the edge rate, although UART inputs should be very tolerant of edge problems.

author: paulca
author_rank: Super Contributor
timestamp: December 12, 2022, 07:41:51 pm
content: Well the PCB was printed, arrived today and both UARTs work fine with their 100R resistors in place.Someone asked about distances etc. They are 1.5 inch PCB traces in the "local" use case, but whatever a user wishes to connect the headers as the "remote" use case. The 100Rs and this thread was more to do with how they would react to having two attached devices on the Rx lines. I suppose they also provide (as mentioned) bare minimum some protection from fumbling fingers.