5 Replies Latest reply on Feb 5, 2016 2:19 AM by JoMe_264151

    How to increase watchdog timer wakeup interval from deepsleep mode?

      Hi,

         

      Could someone guide how to increase the wakeup interval from DeepSleep mode when using watchdog timer?

         

      In my example, I want an interval of 10 seconds before interrupt fires, but it seem to fire every second or 500 ms. Blue led toggles very frequently.

         

      Below is the code I am using -

         

       

         

       

         

      #include <project.h>
      #define PERIOD 3200000u

         

      static uint8 Toggle = 0u;

         

      CY_ISR_PROTO(WDT_ISR);

         

      CY_ISR(WDT_ISR1)
      {
          // Blue LED toggle to test if ISR code is running
          CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER0_INT);
          ISR_WDT_ClearPending();
      }

         

      int main()
      {
          /* Setup WDT Counter 0 to generate interrupt on match */
          CySysWdtWriteMode(CY_SYS_WDT_COUNTER0,CY_SYS_WDT_MODE_INT);

         

          /* Write match count */
          CySysWdtWriteMatch(CY_SYS_WDT_COUNTER0, PERIOD);
           
          /* Enable clear of counter on match */
          CySysWdtWriteClearOnMatch(CY_SYS_WDT_COUNTER0, 1u);

         

          /* Enable WDT counter 0 */
          CySysWdtEnable(CY_SYS_WDT_COUNTER0_MASK);

         

          // Test if WDT resets...
          Red_LED_Write(0u);
          CyDelay(1000);
          Red_LED_Write(1u);

         

          /* Map interrupt vector to the WDT_ISR */
          ISR_WDT_StartEx(WDT_ISR1);  
          /* Enable Global Interrupt */
          CyGlobalIntEnable;
       
          /* 200us delay to ensure WDT configuration is complete */
          CyDelayUs(200);

         

          for(;;)
          {
              
          Blue_LED_Write(Toggle);
          CyDelay(200);
          Blue_LED_Write(~Toggle);
          
          CySysPmDeepSleep(); // Doesent work correct with Deep sleep
          //CySysPmSleep(); // It works with Sleep mode ???
          }
      }

         

       

         

      Please help!! What parameter value I need to change here?

         

      Thanks,

         

      Jitender