Jump to content

Kannannatesh

Members
  • Content Count

    1
  • Joined

  • Last visited

About Kannannatesh

  • Rank
    Noob Class

Profile Information

  • Location
    TamilNadu, Chennai
  • Interests
    Embedded
  1. Kannannatesh

    watchdog timer

    Dear Experts, now i am working with TivaC TM4C123GH6PM an energia. i never work in watch dog timer before so i was rewrite the watch dog timer example code(i get code from google) like below, #include "driverlib/interrupt.h" #include "driverlib/sysctl.h" #include "driverlib/watchdog.h" #include "driverlib/rom_map.h" #include "driverlib/rom.h" void setup() { Serial.begin(9600); Serial.println("SETUP"); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0); // Enable the watchdog peripheral MAP_WatchdogReloadSet(WATCHDOG0_BASE, MAP_SysCtlClockGet() * 2); // Set timeout of watchdog to 2 sec MAP_WatchdogResetEnable(WATCHDOG0_BASE); // Reset when watchdog expires WatchdogIntRegister(WATCHDOG0_BASE, &WatchdogIntHandler); // Register the watchdog interrupt handler MAP_WatchdogEnable(WATCHDOG0_BASE); // Enable the watchdog if(SysCtlResetCauseGet() & SYSCTL_CAUSE_WDOG0) // Get and print the reset cause { Serial.println("Watchdog Reset"); } else if(SysCtlResetCauseGet() & SYSCTL_CAUSE_EXT) { Serial.println("External reset"); } SysCtlResetCauseClear(SYSCTL_CAUSE_WDOG0 | SYSCTL_CAUSE_EXT); } void loop() { Serial.println("MC Working"); delay(6000); } void WatchdogIntHandler(void) { WatchdogIntClear(WATCHDOG0_BASE); // Clear the watchdog interrupt. Serial.println("REG CLEAR"); } this code reset the watch dog timer register in every 2 sec, so watchdog is not resetting my controller, my doubt is this code is definitely reset the controller if my controller getting struck or hang for any disturbance. please make sure about this.
×