# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# PIC24FJ64GA004 -- UART

- 1
- 2
…
- 27
- 28
- 29
- 30
- 31
…
- 55
- 56

 2009-2013 Microchip Technology Inc. DS70000582E-page 29
UART
9.0 OTHER FEATURES OF THE UART
9.1 UART in Loopback Mode
Setting the LPBACK bit (UxMODE<6>) enables the Loopback 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 Loopback mode, follow these steps:
1. Configure the UART module for the desired mode of operation.
2. Enable transmission as defined in Section 5.0 “UART Transmitter”.
3. Set the LPBACK bit = 1 to enable Loopback mode.
The Loopback mode is dependent on the UEN<1:0> bits, as shown in Table 9-1.
Table 9-1: Loopback Mode Pin Function
9.2 Auto-Baud Support
To allow the system to determine baud rates of the received characters, the ABAUD bit
(UxMODE<5>) is enabled. The UART begins an automatic baud rate measurement sequence
whenever a Start bit is received while the Auto-Baud Rate Detect is enabled (ABAUD = 1). The
calculation is self-averaging. Once the ABAUD bit is set, the BRG counter value will be cleared
and will look for a Start bit, which in this case, is defined as a high-to-low transition, followed by
a low-to-high transition.
Following the Start bit, the auto-baud expects to receive an ASCII U (55h) in order to
calculate the proper bit rate. The measurement is taken over both the low and the high bit time
in order to minimize any effects caused by asymmetry of the incoming signal. On the 5th UxRX
pin rising edge, an accumulated BRG counter value, totaling the proper BRG period, is
transferred to the UxBRG register. The ABAUD bit is automatically cleared. If the user
application clears the ABAUD bit prior to sequence completion, unexpected module behavior
can result. See Figure 9-1 for the Auto-Baud Rate Detection sequence.
UEN<1:0>
Pin Function, LPBACK = 1
(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;
BCLKx pin functions; UxCTS
/UxRTS unused
Note 1: The LPBACK bit should be set to 1 only after enabling the other bits associated
with the UART module.
Note: Depending on the specific device used, the ABAUD feature of a respective UART
may automatically use the corresponding Input Capture x (ICx) peripheral for
UARTx auto-baud measurements. For devices that use the corresponding ICx
peripheral, the user application should not use the respective ICx peripheral for
other purposes. See the specific device data sheet regarding this dependency.

- 1
- 2
…
- 27
- 28
- 29
- 30
- 31
…
- 55
- 56