cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

JaSi_1632926
New Contributor II

I'm having issues to get my PSoC 62 to wake up periodically from deep sleep using a watchdog timer.

The timer is configured as follows:

static void WatchdogIrq() {

    uint32 mcwdtIsrMask;

    Cy_GPIO_Write(LED2_0_PORT, LED2_0_NUM, 0);

    MCWDT_ClearInterrupt(CY_MCWDT_CTR0);

    NVIC_ClearPendingIRQ(MCWDT_IRQ_cfg.intrSrc);

    Cy_SysLib_Delay(25);

    Cy_GPIO_Write(LED2_0_PORT, LED2_0_NUM, 1);

}

And enabled like this:

    Cy_SysInt_Init(&MCWDT_IRQ_cfg, WatchdogIrq);

    NVIC_ClearPendingIRQ(MCWDT_IRQ_cfg.intrSrc);

    NVIC_EnableIRQ(MCWDT_IRQ_cfg.intrSrc);

    __enable_irq();

    MCWDT_Start();

The WDT is set up like this:

pastedImage_6.png

And the corresponding interrupt:

pastedImage_7.png

If I then run a

while (1) {}

LED2 will blink periodically - which proves that the WDT and interrupt are working as expected. However, if I go to deep sleep with

Cy_SysPm_CpuEnterDeepSleep(CY_SYSPM_WAIT_FOR_INTERRUPT)

The interrupt is never called (however, the watchdog will reset the CPU after three missed interrupts). I have confirmed that it gets assigned a deep sleep capable IRQ number (19).

Am I missing something?

0 Likes
Reply
3 Replies
RodolfoGL
Employee

Are you using the ILO as the Clk_LF? You can check that in the Design Wide Resources > Clocks > Miscellaneous Clocks.

If yes, try to enable the WCO and source it to Clk_LF and see if fixes the problem.

I have seen some issues to use the ILO before in Deep Sleep.

0 Likes
Reply
JaSi_1632926
New Contributor II

Thank you for your answer.

Yes, I am using ILO as source for CLK_LF. I don't have an external 32 kHz oscillator connected to P0_0 - I use that pin for a high-frequency oscillator instead, so WCO won't work for me.

I can't see why it shouldn't work with ILO.

0 Likes
Reply
RodolfoGL
Employee

Could you upload the project here in the community? You could remove any confidential code and just leave the watchdog part.

I tried to reproduce the problem, but I couldn't.

0 Likes
Reply
Top labels