You are here

Trouble waking from Sleep with SleepTimer with PSoC5LP | Cypress Semiconductor

Trouble waking from Sleep with SleepTimer with PSoC5LP

Summary: 1 Reply, Latest post by Bob Marlowe on 27 Sep 2016 01:22 PM PDT
Verified Answers: 1
Last post
Log in to post new comments.
Nathan Jozwiak's picture
2 posts

Hi all,

I'm having problems waking from Sleep using the SleepTimer with the PSoC5LP. I am trying to implement an auto-wake feature and would like to use the SleepTimer to wake the device when it has been asleep for 4096ms (max SleepTimer counter).

I implemented the SleepTimer_Interrupt_Sleep demo project on my development board and observed the LED indicating the toggling of the LED at the appropriate period based on the SleepTimer duration. Great. The I proved the component works...

The problem that I encountered is that the counter does not appear to be reset when SleepTimer_Stop() and SleepTimer_Start() are called. In the demo project the SleepTimer component is started prior to the main loop and never disabled. In my application, I want to enable the SleepTimer() component only when I am about to sleep. I don't want the ISR continuously executing while I the application is running. I just want to wake ~4s after going to sleep.


(My SleepTimer ISR is identical to that of the demo in that it only calls SleepTimer_GetStatus() according to the driver requirements.)

The behavior I observe is when I put the device to sleep the wake period is erratic. It can be anywhere between immediately waking and the ~4s maximum period. 

As a test, I moved the SleepTimer_Start() to the initialization section of my application so that it runs constantly as the demo project illustrates. I did this to prove that the SleepTimer ISR is, in fact, being called every 4096ms in my application. I then induced sleep at various times between ISRs and correctly saw the device waking at each ISR execution.

The problem appears to be when I use the SleepTimer_Start() function it is not starting the timer from 0, it is continuing the counter from where SleepTimer_Stop() was called. I have tried issuing SleepTimer_Init(), SleepTimer_SetInterval(SleepTimer__CTW_4096_MS), etc to re-initialize the SleepTimer component, but have not had any success.

How do I start the counter from 0 every time I call SleepTimer_Start()?


user_1377889's picture
10699 posts

The CTW (Central Time Wheel) is running continuously, you just can specify at which interval an interrupt is generated. From the description you can see that the first interrupt can be as short as 1 ms until up to the desired period.



Log in to post new comments.