stuck in WD interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

stuck in WD interrupt

1,032 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 12345 on Mon Jul 11 20:30:57 MST 2011
Program stuck in WD interrupt handler!
  How can I jump out from the WD interrupt handler?

void WDTInit( void )
{
  LPC_SYSCON->SYSAHBCLKCTRL |= (1<<15);

  wdt_counter = 0;

  /* Enable the WDT Interrupt */
  NVIC_EnableIRQ(WDT_IRQn);

  LPC_WDT->TC = WDT_FEED_VALUE;//timer constant register 1.576Sec /* once WDEN is set, the WDT will start after feeding */
  LPC_WDT->MOD=0x00;
  LPC_WDT->MOD=WDEN;

  LPC_WDT->FEED = 0xAA;/* Feeding sequence */
  LPC_WDT->FEED = 0x55;   

  return;
}



void WDT_IRQHandler(void)
{

  //UARTSendOne(0x13);
  if (LoadCG==0)
  {
  NVIC_SystemReset();
  }

   NVIC_DisableIRQ(WDT_IRQn);// Disable the watchdog- interrupt flag cannot
  // be cleared except by reset

   LPC_WDT->MOD &= ~WDTOF;/* clear the time-out interrupt flag */
                                //reset to zero watchdog timeout flag//
   LPC_WDT->MOD &= ~WDINT;/* clear the time-out flag and interrupt flag */
   //wdt_counter++;
   LPC_WDT->FEED = 0xAA;/* Feeding sequence */
   LPC_WDT->FEED = 0x55;
   //WDTFeed();

}
0 Kudos
Reply
3 Replies

951 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by martinho on Tue Jul 12 22:45:12 MST 2011

Quote: NXP_USA
The watchdog interrupt flag cannot be cleared once it has timed out, so the interrupt will continue to be called repeatedly.



But you can disable the WDT Interrupt in the NVIC.

By the way the WDT Interrupt mode is only there for debugging the watchdog behavior of you code. If you need a periodical interrupt use one of the timers!
0 Kudos
Reply

951 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Tue Jul 12 15:23:39 MST 2011
The watchdog interrupt flag cannot be cleared once it has timed out, so the interrupt will continue to be called repeatedly.
0 Kudos
Reply

951 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Jul 12 04:20:45 MST 2011

Quote: 12345
Program stuck in WD interrupt handler!
  How can I jump out from the WD interrupt handler?



1. Start with standard:
[INDENT]
/*****************************************************************************
** Function name:        WDTHandler
**
** Descriptions:        Watchdog timer interrupt handler
**
** parameters:            None
** Returned value:        None
** 
*****************************************************************************/
void WDT_IRQHandler(void)
{
  LPC_WDT->MOD &= ~WDTOF;        /* clear the time-out interrupt flag */
  wdt_counter++;
}
[/INDENT]2. Avoid nonsense like:
[INDENT]
LPC_WDT->MOD=0x00;
LPC_WDT->MOD=WDEN;
[/INDENT]and
[INDENT]
LPC_WDT->MOD &= ~WDINT; /* clear the time-out flag and interrupt flag */
[/INDENT]
0 Kudos
Reply