MCWDT Interrupt not working as Deep Sleep wakeup source in Critical Section

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

cross mob
RaMu_4639021
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

We use Tickless Low power features in FreeRTOS to sleep/deepsleep when the system is idle. We want to go sleep/deepsleep in critical section so that system doesn't process interrupt and then go sleep if interrupt occurs between the sleep condition check to sleep, which makes us to wait longer than needed.

The MCWDT Interrupt doesn't seem to work as Deep Sleep wakeup source in Critical Section. The BLE Advertisement seem to work fine, but the Cy_SysPm_DeepSleep doesn't exit, it performs callback and goes to sleep again.

Here is the comparison between what we have vs what we want.

Screen Shot 2021-01-03 at 6.08.40 PM.png

CC: HarigovindA_96​ I have created new ticket as I was not able to respond in I2C Master High Level APIs Callback is not waking-up MCU from Sleep .

0 Likes
1 Solution
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @RaMu_4639021

This is a simple project which wakes the device when an MCWDT interrupt occurs. The Deep Sleep function call is placed inside the critical section as shown and this worked for me.

Rakshith_0-1610545786296.png

Can you please try the same and let me know if this works?

Thanks and Regards,
Rakshith M B

View solution in original post

0 Likes
3 Replies
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @RaMu_4639021

Apologies for the delay in the response.
Can you please let us know if the MCWDT ISR is not getting executed or if the device itself is not waking up from Deep Sleep?
In the What_We_Have.c file can you try adding a critical section between line numbers 28 to 38 and if that does not work between line numbers 31 and 37 and let us know your observations.
Can you also provide the function definition of StillOkToSleep()? Please attach the entire project so that we can try and recreate the issue.

Thanks and Regards,
Rakshith M B
0 Likes

Hey @Rakshith,

Thanks for response,

Can you please let us know if the MCWDT ISR is not getting executed or if the device itself is not waking up from Deep Sleep?

The MCWDT ISR doesn't execute. We confirmed by instrumenting to toggle a GPIO in ISR.

In the What_We_Have.c file can you try adding a critical section between line numbers 28 to 38?

The interrupt doesn't work if call Cy_SysPm_DeepSleep /Cy_SysPm_Sleep in critical section.

if that does not work between line numbers 31 and 37 and let us know your observations?

As long as critical section is not active while calling Cy_SysPm_DeepSleep /Cy_SysPm_Sleep, it works fine.

Can you also provide the function definition of StillOkToSleep()?

#define stillOkToSleep() (eAbortSleep != eTaskConfirmSleepModeStatus())

Please attach the entire project so that we can try and recreate the issue.

Let me see if I can create project using PSOC creator. We using gcc in python environment to compile.

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi @RaMu_4639021

This is a simple project which wakes the device when an MCWDT interrupt occurs. The Deep Sleep function call is placed inside the critical section as shown and this worked for me.

Rakshith_0-1610545786296.png

Can you please try the same and let me know if this works?

Thanks and Regards,
Rakshith M B
0 Likes