I have 9 microcontrollers ATMEGA3208 and I have connected the RX and TX lines of 8 of them in parallel. My configuration is in master-slave. The master microcontroller send data to one of the 8 RX lines but only one of them can respond at a time. The cable length is about 3 to 5 metres between each node.
I have two questions. My test was done with 2 slaves instead of 8. UART at 9600bps.
If I setup the TX lines of the slaves as Open Drain it works fine, but the signal doesn't have steep ramps. I thought this happens due to Pull-up resistors. And I also think that is going to be better with 8 slaves on the bus, right?
Why doesn't that topology work if the TX lines of the slaves are not Open Drain?
I managed to make it work by disabling the transmit of the UART in all of them except one, and it worked fine. I had two slaves, so I disabled the one and left the other. Also I noticed that the edges of the signal was sharper. Why are they sharper in that case?
Regarding resistors: The value of the resistors for both RX and TX lines are 2.7KΩ.
However the Open Drain topology would parallel the internal pull-up resistors. According to the datasheet that resistor is about 20KΩ at minimum. So, using a 2.7KΩ in the output would give us a total resistance of 2.52KΩ (20+2.7)/9
. And the Open Drain would make a voltage divider 2.52KΩ + 2.7KΩ (Schematic 2). Which means with 8 slaves and Open Drain topology the signal will not go lower than 1V which is the threshold of the low level. Is that correct?
Wouldn't it be better to disable all the internal pull up resistors and place two (let's say: 4.7KΩ) only at the master side?
Distance: What is the maximum baud rate for such distance? I'm a little worried about the signal integrity. The test was done with 9600bps but I didn't notice any significant difference in 4800bps. The distortion of the signal didn't have a difference.
Voltage values are 3.3V for the UART bus.
Schematic 1. (all resistors are 2.7KΩ)
simulate this circuit – Schematic created using CircuitLab
Schematic 2. (U4, U5, U6, U7, and U8 are omitted for simplicity).
EDIT: Thank you all very much about your answers so far. I wanted to point out that this is a question about UART only. I am not looking for alternative solutions. I'm just trying to find some answers about the above implementation.
EDIT2: Thank you very much for your answers! I ended up modifying a little my schematic. I disabled the internal pullup resistors of the microcontrollers and I placed external ones at the master's board. Their value would be around 1 KOhm to 3 KOhm. I have to do some tests more to decide the final value. I also replaced all series resistors with 130 Ohm.
I tested 5 slaves over 20 metre cable (with pullup 3 KOhm and 130 Ohm series resistors) and it worked fine.
Would it be better to add open drain/open collector line drivers on every TX lines?