About WatchDog Reset

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

cross mob
Anonymous
Not applicable

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();

   

  }

   

 

   

}

0 Likes
2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I do not see any place where you switch off the LEDs, nor can I see an "Enter  DeepSleep". Can you post your complete project, so that we all can have a look at all of your settings? To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi,Bob.I can't upload my project due to spam filter.

0 Likes