For setting the USART in full-duplex mode,
the following initialization sequence is recommended:
- 1.Set the TxD pin value high, and
optionally set the XCK pin low (OUT[n] in PORT.OUT).
- 2.Set the TxD and optionally the XCK pin
as output (DIR[n] in PORT.DIR).
- 3.Set the baud rate (USART.BAUD) and
frame format.
- 4.Set the mode of operation (enables XCK
pin output in synchronous mode).
- 5.Enable the transmitter or the
receiver, depending on the usage.
For interrupt-driven USART operation,
global interrupts should be disabled during the initialization.
Before doing a re-initialization with a
changed baud rate or frame format, be sure that there are no ongoing transmissions while
the registers are changed.
For setting the USART in one-wire mode,
the following initialization sequence is recommended:
- 1.Set the TxD/RxD pin value high, and
optionally set the XCK pin low.
- 2.Optionally, write the ODME bit in the
USART.CTRLB register to '1' for Wired-AND functionality.
- 3.Set the TxD/RxD and optionally the XCK
pin as output.
- 4.Select the baud rate and frame
format.
- 5.Select the mode of operation (enables
XCK pin output in synchronous mode).
- 6.Enable the transmitter or the
receiver, depending on the usage.
For interrupt-driven USART operation,
global interrupts should be disabled during the initialization.
Before doing a re-initialization with a
changed baud rate or frame format, be sure that there are no ongoing transmissions while
the registers are changed.