One-Wire Mode

One-Wire mode is enabled by setting the Loop-Back Mode Enable (LBME) bit in the USARTn.CTRLA register. This enables an internal connection between the TXD pin and the USART receiver, making the TXD pin a combined TxD/RxD line. The RXD pin is disconnected from the USART receiver and can be controlled by a different peripheral.

In One-Wire mode, multiple devices can manipulate the TxD/RxD line at the same time. If one device drives the pin to a logical high level (VDD) while another pulls the line low (GND), a short circuit will occur. To mitigate this, the USART features an Open-Drain mode (the ODME bit in the USARTn.CTRLB register), which prevents the transmitter from driving the pin to a logical high level and instead allows it only to pull the line low. Combining this function with the internal pull-up feature (the PULLUPEN bit in the PORTx.PINnCTRL register) allows the line to be held high through a pull-up resistor, enabling any device to pull it low. When the line is pulled low, the current from VDD to GND is limited by the pull-up resistor. The TXD pin is automatically set as an output by the hardware when Open-Drain mode is enabled.

When the USART transmits on the TxD/RxD line, it also receives its own transmission. This can be used to detect overlapping transmissions by checking whether the received data are the same as the transmitted data.