1.8.2 Wake-up on Break
The UART module is inactive in Sleep mode since the clock sources are disabled. This means that the UART cannot transmit or receive data while the device is in Sleep mode. The UART module offers an automatic wake-up feature that will wake the device when activity on the RX pin is detected.
The auto-wake-up feature is enabled by setting the Wake-Up Enable (WUE) bit of UxCON1. When WUE is set, the UART remains in an Idle state while waiting for a transition from the Idle state to the active state on the RX pin. To prevent data loss, the RXIDL bit should be read to ensure that the receiver is idle before setting WUE and issuing a Sleep command.
If the WUE bit is set, but before the Sleep command is issued, and a transition from the Idle-to-Active state is detected, module hardware sets the WUIF at the beginning of the next instruction cycle, but does not enter Sleep. Once the transition from the Active-to-Idle state occurs, hardware clears the WUE bit.
When the wake-up event occurs, the Wake-Up Interrupt Flag (WUPIF) bit of the UxUIR register and the UART Interrupt Flag (UIF) of the Peripheral Interrupt (PIRx) register are set. At this point, the receiver will begin to monitor for a transition from the Active state back to the Idle state. When the Active state is detected, module hardware clears the WUE bit. It is important to note that the UIF is read-only; software must clear WUPIF to clear UIF.