2 Replies Latest reply on Nov 11, 2015 5:44 PM by 58013216_1409526

    About WatchDog Reset

    58013216_1409526

      Hi, I have a question about WatchDog Reset. I use WatchDog to wakeup CPU from deepsleep mode, but I found the LEDs will be turn on during working. I guess there is a reset by watchdog during it's working. My question is why the watchdog enable reset function even when I did not enable it?

         

      Following is my code,

         

      void watchdog_init()

         

      {

         

          CySysWdtEnable(CY_SYS_WDT_COUNTER0_MASK);

         

          WdtIsr_StartEx(WdtIsrHandler);
          
          CySysWdtDisable(CY_SYS_WDT_COUNTER0_MASK);
          
          
          /* Set WDT interrupt period */
          CySysWdtSetMatch(CY_SYS_WDT_COUNTER0,WDT_MATCH_SLEEP_VALUE_400MS);
          
          /* Enable WDT interrupt */
          CySysWdtEnable(CY_SYS_WDT_COUNTER0_MASK);

         

      }

         

      void main()

         

      {

         

          uint8 resetCause = 0;    
          /*===========================================================================================
           * this code piece detects the reset cause, if the last reset is caused by watchdog, a red LED
           * indicator is turn on
           *==========================================================================================*/
          /* Get reset cause after system powered */
          resetCause = CySysGetResetReason(CY_SYS_RESET_WDT | CY_SYS_RESET_SW | CY_SYS_RESET_PROTFAULT);
          if(resetCause == CY_SYS_RESET_WDT)
          {        
              /* turn on LEDs to indicate system id reset by watchdog */
              LED1_Write(0);
              LED2_Write(0);
              LED3_Write(0);
              LED4_Write(0);
              /* Delay 1 second */
              CyDelay(1000);
          }

         

        watchdog_init();

         

        OtherModule_init();

         

       

         

        while(1)

         

        {

         

           DoMyApplication();

         

        }

         

       

         

      }