One-Wire Mode

Using only one wire effectively reduces the number of pins used for USART communication to one. RX and TX are internally connected, and only TX is used. This means that both incoming and outgoing data will share the same wire, so transmission and reception cannot happen at the same time. This is called half-duplex communication.

Figure 1. LBME Bit Field in Register CTRLA

The LBME bit field in the CTRLA register is used to enable internal loop back connection between RX and TX. An internal connection between RX and TX can be created by writing to USARTn.CTRLA.

USART0.CTRLA |= USART_LBME_bm;

This will internally connect the RX and TX pins, but only the TX pin will be used. Since the TX pin is used for both transmit and receive, the pin direction needs to be configured as output before each transmission and switched back to input when the transmission ends.

Since RX is internally connected to TX during transmission, it will receive the data being sent. This can be used as a collision detection mechanism. If there is another transmission occurring, the received data will not match the transmitted data. An advanced one-wire driver could take advantage of this strategy.