Need a robust way to change uart lines

atmegamsp430uart

I'm working on a project where I am sending data from an msp430 to an atmega328 through regular tx/rx lines. My board will also need the capability to perform software changes on the atmega through FTDI, which needs to be connected to the same tx/rx lines. So when the FTDI is connected, I'll need to break the lines from the MSP. My first thought was just to put a PMOS between the two lines and have the FTDI VCC connected to it. But I am not sure this would be the most robust solution. Can any one point me to the right direction?

Thanks,
Micah

Best Answer

The Arduino line uses a simple resistor setup to give one Tx/Rx pair priority over another.

enter image description here

The direct connection has priority over the resistor connection.

Note that this depends on the specific board you use, as some have the resistors going to the programmer and others to the external module. The Uno R3 has them to the programmer.

See: Arduino Uno R3 hardware serial: peripheral interfering with the USB/Serial-converter?