English
Language : 

EFM32WG Datasheet, PDF (456/834 Pages) List of Unclassifed Manufacturers – The EFM32WG Wonder Gecko is the ideal choice for demanding 8-, 16-, and 32-bit energy sensitive applications.
...the world's most energy friendly microcontrollers
17.3.2.6.1 Single Data-link
In this setup, the USART both receives and transmits data on the same pin. This is enabled by setting
LOOPBK in USARTn_CTRL, which connects the receiver to the transmitter output. Because they are
both connected to the same line, it is important that the USART transmitter does not drive the line when
receiving data, as this would corrupt the data on the line.
When communicating over a single data-link, the transmitter must thus be tristated whenever not
transmitting data. This is done by setting the command bit TXTRIEN in USARTn_CMD, which tristates
the transmitter. Before transmitting data, the command bit TXTRIDIS, also in USARTn_CMD, must be
set to enable transmitter output again. Whether or not the output is tristated at a given time can be read
from TXTRI in USARTn_STATUS. If TXTRI is set when transmitting data, the data is shifted out of the
shift register, but is not put out on U(S)n_TX.
When operating a half duplex data bus, it is common to have a bus master, which first transmits a request
to one of the bus slaves, then receives a reply. In this case, the frame transmission control bits, which
can be set by writing to USARTn_TXDATAX, can be used to make the USART automatically disable
transmission, tristate the transmitter and enable reception when the request has been transmitted,
making it ready to receive a response from the slave.
Tristating the transmitter can also be performed automatically by the USART by using AUTOTRI in
USARTn_CTRL. When AUTOTRI is set, the USART automatically tristates U(S)n_TX whenever the
transmitter is idle, and enables transmitter output when the transmitter goes active. If AUTOTRI is set
TXTRI is always read as 0.
Note
Another way to tristate the transmitter is to enable wired-and or wired-or mode in GPIO.
For wired-and mode, outputting a 1 will be the same as tristating the output, and for wired-
or mode, outputting a 0 will be the same as tristating the output. This can only be done on
buses with a pull-up or pull-down resistor respectively.
17.3.2.6.2 Single Data-link with External Driver
Some communication schemes, such as RS-485 rely on an external driver. Here, the driver has an extra
input which enables it, and instead of tristating the transmitter when receiving data, the external driver
must be disabled.
This can be done manually by assigning a GPIO to turn the driver on or off, or it can be handled
automatically by the USART. If AUTOCS in USARTn_CTRL is set, the USn_CS output is automatically
activated one baud period before the transmitter starts transmitting data, and deactivated when the last
bit has been transmitted and there is no more data in the transmit buffer to transmit, or the transmitter
becomes disabled. This feature can be used to turn the external driver on when transmitting data, and
turn it off when the data has been transmitted.
Figure 17.8 (p. 456) shows an example configuration where USn_CS is used to automatically enable
and disable an external driver.
Figure 17.8. USART Half Duplex Communication with External Driver
µC
USART
CS
TX
RX
2013-05-08 - Wonder Gecko Family - d0233_Rev0.50
456
www.energymicro.com