AnsweredAssumed Answered

KL15 Watchdog not working

Question asked by Xavier Mao on Jun 6, 2014
Latest reply on Jun 8, 2014 by Xavier Mao

Dear Freescale Community,

 

I am currently developing on KL15 microcontroller, Bareboard without PE. As required, I would like to enable watchdog timer for security reasons. Right now I am running a small testing program with watchdog timer enabled at the starting of the main and do not feed anything to it. I expect that the program resets itself frequently. However, the program runs per normal. It looks like the watchdog is never enabled. I am attaching my code for reference. Hope I can get some help in clearing my doubts.

 

Thank you.

 

void __init_hardware()
{
  SCB_VTOR = (uint32_t)__vector_table; /* Set the interrupt vector table position */

  // Disable the Watchdog because it may reset the core before entering main().
  SIM_COPC = KINETIS_WDOG_DISABLED_CTRL;
}

void WDG_Enable()
{
  SIM_COPC = (0x08 & 0x0F); // Enable the clock and the timeout count
}

void SysInit()
{  /* Enable the COM Port UART with minimal settings */
  UART0Init(9600);
  UART0HWFCPinInit();
  UART1Init(9600);
  UART1HWFCPinInit();

  /* Initialize the WatchDog */
  WDG_Enable();
  COMSendString("\r\nWDG Enabled");
}

void EnvInit()
{
  /* Create the tasks here */
  CreateComTasks((configMAX_PRIORITIES-2)); // Create the COM task
  CreateModemTask((configMAX_PRIORITIES-2)); // Create the Modem Task
  CreateUpdateTask((configMAX_PRIORITIES-1)); // Firmware Update task with the default source as COM port


  /* Create the Semaphores related with UART1 and UART0 */
  CreateUART1Sem();
  CreateUART0Sem();

}

int main()
{
  /* Initialize the peripherals and GPIO in here */
  SysInit();

  /* Initialize the environment */
  EnvInit();

  vTaskStartScheduler();

  return 0;
}





Outcomes