3 Replies Latest reply on Jun 28, 2019 1:32 PM by RodolfoG_11

    PSoC 6 wake up from deep sleep periodically using WDT

    JaSi_1632926

      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:

      And the corresponding interrupt:

      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?