Sleep/wakeup

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 Hi again,

   

We are experiencing a very strange problem with the PSoC3. The device appears to successfully go to sleep and then wake up when it receives a pulse on a designated GPIO. The ISR connected to that pin then fires and executes successfully (we can see all of this in the debugger). On exiting the ISR though, the program enters an unknown state. We have discovered that the program in fact gets stuck in a function inside a switch-case in the main loop. The case that it gets stuck in though is not the expected case. In fact when I view the switch variable in the debugger it is not equal to the case that the program has entered. I have provided some of my code and my hardware setup to help illustrate. I have also pointed out where the program counter jumps to unexpectedly.

0 Likes
3 Replies
Anonymous
Not applicable

Hi kristen,

   

 

   

1) Does any of the ISR manipulate the value of the variable "state"?

   

2) What is done in the ISR associated with the PICU interrupt? Restoring the clocks in that ISR seems more intuitive.

   

3) When the device is in Sleep mode, the IMO is turned off. So, running the device in Debug mode is not possible while in sleep. Please verify if the chip functionality is as expected when it is run normally (without running in "Debug" mode).

0 Likes
Anonymous
Not applicable

I had a glance at the attached code. Although I could not find the exact issue at this point, I would suggest you to try the following things.

   

I see that you are enabling the ISR and calling a while loop after saving clocks using CyPmSaveClocks() API. It is advisable to call CyPmSleep( ) soon after saving clocks and not to do any other functions as all the pheripheral clocks are off and could result in undesirable results. Also restore clocks as soon as the part wakes up.

   

CyPmReadStatus() is not necessary as the part is not waking from a CTW event.

   

Try keeping all component wake-up APIs outside the interrupt routine (writing soon after the restore clocks in main.c) and 

   

thereby using ISR rotine only to clear interrup status bits/ setting flag etc..

   

If possible, can you attach the project here so that I can relook where exactly its goin wrong?

   

 

   

Thanks,

   

SRIM

0 Likes
Anonymous
Not applicable

I would suggest you to upload your project here, so that we get a complete poicture of your picture. We can suspect few things but we can not zero in on the root cause without your complete project.

0 Likes