AnsweredAssumed Answered

How to use Watchdog Interrupt in KE02

Question asked by xpress_embedo on Jan 3, 2018
Latest reply on Jan 11, 2018 by xpress_embedo

Hello Everyone,

I am working on a project, based on Kinetics KE02 micro-controller and I am facing a problem, where system is resetting due to WatchDog timeout, so I decided to use WatchDog Interrupt so that I can have 128 Bus clocks to analyse something, but unfortunately my WatchDog Interrupt code is not working.
I created a sample project separately to test watchdog interrupt, but it is not working, can anyone please help me, what I am doing wrong.

#include <stdint.h>

#include "isr.h"
#include "common.h"
#include "ics.h"
#include "sysinit.h"
#include "wdog.h"

int main()
{
volatile static uint8_t test;
WDOG_Feed();
test = 1;
WDOG_ConfigType sWDOGConfig = {0}; /*! < watchdog configuration structure */

/* Perform processor initialization */
NVIC_EnableIRQ( Watchdog_IRQn);
__enable_irq();
sysinit();
sWDOGConfig.sBits.bIntEnable = TRUE;
sWDOGConfig.sBits.bWaitEnable = FALSE;
sWDOGConfig.sBits.bStopEnable = FALSE;
sWDOGConfig.sBits.bDbgEnable = FALSE;
sWDOGConfig.sBits.bUpdateEnable = FALSE;
sWDOGConfig.sBits.bDisable = FALSE; /* enable WDOG */
sWDOGConfig.sBits.bClkSrc = WDOG_CLK_INTERNAL_1KHZ;
sWDOGConfig.u16TimeOut = 1000; /*< 1s */
sWDOGConfig.u16WinTime = 0;

WDOG_Init(&sWDOGConfig);

while(1)
{
if( test )
{
WDOG_Feed();
}
}
}

void WatchDog_ISR( void )
{
static uint8_t x;
x=0;
while(1)
{
x++;
}
}
void NMI_Isr(void)
{
/*!
* endless loop to generate watchdog reset
*/
while(1)
{
printf("Running in NMI_Isr()!\n");
}
}

 

I tried to use the code formatting, but unfortunately that doesn't work.

When i run the above code, it works properly without resetting, to stop watchdog refresh, test value is updated to "0" and due to this watchdog refresh or watchdog feed function will not get call, leading to system reset after 1 second. 

So my system is getting reset when I update the value of test to "0", but I want that before resetting Watchdog Interrupt shall be generated.

Please help me to identify what I am doing wrong.

 

Thanks in Advance

Outcomes