Sleep Timer as a Wake-Up Source in PSoC® 3 and PSoC 5LP – KBA90926

Version: **


Question: What are the important points to be noted when the Sleep Timer is used as a wake-up source in PSoC 3 or PSoC 5LP?



The Sleep Timer can be used as a wake-up source to wake up PSoC 3 or PSoC 5LP devices from Alternate Active or Sleep. It uses the Central Time Wheel (CTW), which is based on the 1-kHz internal low-speed oscillator (ILO).

The following figure shows the Sleep Timer Component that is available with PSoC Creator™:

Important: When the Sleep Timer is used as a wake-up source, the SleepTimer_GetStatus API must be called every time the Sleep Timer generates an interrupt. If the SleepTimer_GetStatus() function is not called in an interrupt associated with the Sleep Timer, the interrupt is not cleared. As soon as the interrupt is exited, it will be re-entered. This function can be written inside the ISR associated with the Sleep Timer.

The SleepTimer_GetStatus() function internally calls the CyPmReadStatus function with CY_PM_CTW_INT, which is the second bit of the CY_PM_INT_SR_REG Status Register, as the parameter. The status register also contains status bits for other events such as FTW and OPPS. However, because only the Mask Bit is passed for the CTW event, this function clears only the bit corresponding to the CTW event. Thus, the CTW interrupt status is cleared.

For a proper operation of the Sleep Timer Component, you should call the SleepTimer_GetStatus() function every time the device wakes up and every time the Sleep Timer interrupt is issued.