27.6.1 Wake-up Inputs

Any level change on a PIOBUx, WKUP pin, or Security Module event, can trigger a wake-up. Wake-up is configured in the Mode register (SHDW_MR) and Wake-Up Inputs register (SHDW_WUIR). The transition detector can be programmed to detect either a positive or negative transition on any PIOBUx, WKUP pin. The detection can also be disabled. Programming is performed by enabling the bit Wake-up Input Enable (WKUPENx) and defining the Wake-up Input Type bit (WKUPTx) in the SHDW_WUIR.

Moreover, a debouncing circuit can be programmed for PIOBUx, WKUP. The debouncing circuit filters pulses on PIOBUx, WKUP shorter than the programmed value in SHDW_MR.WKUPDBC. If the programmed level change is detected on a pin, a counter starts. When the counter reaches the value programmed in WKUPDBC, the SHDN pin is released. If a new input change is detected before the counter reaches the corresponding value, the counter is stopped and cleared. One counter is shared among all PIOBUx, WKUP inputs and all programmed level detection is merged into this counter. The bit WKUPISx of the Status register (SHDW_SR) reports the detection of the programmed events on PIOBUx, WKUP with a reset after the read of SHDW_SR.

Figure 27-3. Entering and Exiting Backup Mode with a PIOBUx, WKUP Pin

The SHDWC can be programmed to activate the wake-up using the RTC and RTT alarms or the Security Module event (detection of the rising edge event is synchronized with MD_SLCK). This is done by writing SHDW_MR.RTCWKEN or RTTWKEN, or by writing SHDW_WUIR.WKUPEN1 (Security Module event is connected on the WKUP1 wake-up input). When enabled, the detection of the RTC or RTT alarms or the Security Module event is reported in SHDW_SR.RTCWK, RTTWK or WKUPIS1. These bits are cleared after reading SHDW_SR. When using the RTC or RTT alarms or the Security Module event to wake up the system, the user must ensure that the RTC and RTT alarm status flags and the Security Module event flag are cleared before shutting down the system. Otherwise, no rising edge of the status flags may be detected and the wake-up fails