© 2004 Microchip Technology Inc. DS70066C-page 19-21
Section 19. UART
UART
19
19.10 Other Features of the UART
19.10.1 UART in Loopback Mode
Setting the LPBACK bit enables this special mode, in which the UxTX output is internally
connected to the UxRX input. When configured for the Loopback mode, the UxRX pin is
disconnected from the internal UART receive logic. However, the UxTX pin still functions
normally.
To select this mode:
1. Configure UART for the desired mode of operation.
2. Set LPBACK = 1 to enable Loopback mode.
3. Enable transmission as defined in Section 19.5 “UART Transmitter”.
The Loopback mode is dependent on the UEN<1:0> bits, as shown in Table 19-2.
Table 19-2: Loopback Mode Pin Function
19.10.2 Auto Baud Support
To allow the system to determine baud rates of the received characters, the UxRX input can be
internally connected to a selected input capture channel. When the ABAUD bit (UxMODE<5>) is
set, the UxRX pin is internally connected to the input capture channel. The ICx pin is
disconnected from the input capture channel.
The input capture channel used for auto baud support is device specific. Please refer to the
device data sheet for further details.
This mode is only valid when the UART is enabled (UARTEN = 1) and the Loopback mode is
disabled (LPBACK = 0). Also, the user must program the capture module to detect the falling and
rising edges of the Start bit.
19.11 UART Operation During CPU Sleep and Idle Modes
The UART does not function in Sleep mode. If entry into Sleep mode occurs while a transmission
is in progress, then the transmission is aborted and the UxTX pin is driven to logic ‘1’. Similarly,
if entry into Sleep mode occurs while a reception is in progress, then the reception is aborted.
The UART can be used to optionally wake the dsPIC device from Sleep mode on the detection
of a Start bit. If the WAKE bit (UxSTA<7>) is set, the device is in Sleep mode, and the UART
receive interrupt is enabled (UxRXIE = 1), then a falling edge on the UxRX pin will generate a
receive interrupt. The Receive Interrupt Select mode bit (URXISEL) has no effect for this
function. The UARTEN bit must be set in order to generate a wake-up interrupt.
The USIDL bit (UxMODE<13>) selects if the module will stop operation when the device enters
Idle mode, or whether the module will continue normal operation in Idle mode. If USIDL = 0, the
module will continue normal operation during Idle mode. If USIDL = 1, the module will stop in Idle
mode. Any transmission or reception in progress will be aborted.
UEN<1:0> Pin Function, LPBACK = 1
00 UxRX input connected to UxTX; UxTX pin functions; UxRX pin ignored;
UxCTS/UxRTS unused
01 UxRX input connected to UxTX; UxTX pin functions; UxRX pin ignored;
UxRTS pin functions, UxCTS unused
10 UxRX input connected to UxTX; UxTX pin functions; UxRX pin ignored;
UxRTS pin functions, UxCTS input connected to UxRTS; UxCTS pin ignored
11 UxRX input connected to UxTX; UxTX pin functions; UxRX pin ignored;
BCLK pin functions; UxCTS/UxRTS unused