USART with Hardware Modification

It is necessary to connect the RXD and TXD pins externally to use the USART for one-wire communication. Enabling other devices to pull the line low also requires additional external circuitry. The circuit shown below is the recommended circuit for implementing one-wire on older tinyAVR and megaAVR devices.

Figure 1. megaAVR® and tinyAVR® Hardware Modification
This circuit is an open-collector solution. TXD, which is an output pin, is protected behind the open-collector circuit, while RXD, set as an input pin, can be connected directly to the bus.

When TXD is high, the leftmost transistor will conduct. This causes the rightmost transistor to see zero volts on its base and hence not conduct between the bus and ground, allowing the bus to be pulled high through the resistor. If a device on the bus pulls the line low while TXD is still high, current will flow through the rightmost pull-up resistor without creating a low resistance path between VCC and the line that is pulled to zero volts.

If, on the other hand, TXD goes low, the leftmost transistor will stop conducting. The rightmost transistor will then see VCC on its base and start conducting. The bus will go low, and the rightmost resistor will prevent a low resistance path between VCC and ground. The input circuit in RXD is high-impedance (high resistance) and will not impact the bus notably.

The circuit will ensure that no direct current path is created between VCC and ground and that the USART can send and receive data on the same line.