I'm working on a project that involves multiplexing the UART interface so that a single device can talk to many. My original plan was to use transistors to direct which child device the parent is talking to.
Any number of transistors(I'm using 2N3904 NPN) are connected at their collector pin to the parent device's TX pin, the transistor's emitter pin obviously going to the RX pin of the child. Then a matching set of transistors in reverse, collector to the child's TX pin & emitter to the parent's RX. A final set are connected at their collector to a regular digital pin on the parent with the emitter leading to the reset pin of the child.
Now another regular digital pin of the parent is used to control which of any group of 3 transistors are called(an RX, TX, and Reset connected transistor all connected to the same child). This configuration resembles SPI but saves on two wires.
Yellow - Parent RX
Green - Parent TX
Orange - Reset Control Pin
Purple - Device 1 selector pin
Cyan - Device 2 selector pin
Prior to setting up the above diagram I tested my code and could reliably send/receive information with one child and no transistors. Then just inserted the transistors between the devices. That went from working perfectly without the transistors to only working some of the time. I've also confirmed that that reset pin works as intended through the transistor.
The problem is with the serial communication. Sometimes the commands the parent sends to the child work, sometimes they don't. and the information returned from the child is quite frequently distorted.
Is it possible to achieve what I am attempting here? Do I just need to use a different type of transistor or is there something inherent to how they work that transistors will always interfere with a communication signal?