This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294KCPDT: WatchDog timer -TM4c1294KCPDT

Part Number: TM4C1294KCPDT

Hi,

   In my coustom board using TM4C1294KCPDT controller , in that i need to enable watchdog timer for my application. I am following TI Example Watchdog timer code ,interrupt is generating every one second once. Problem is when i am pusing the variable g_bFeedWatchdog as "Zero"  Controller doesn't get  reset instead of that its show  " Device is locked up in Hardware fault" . Below i have attached fault screenshot as well as code for your refernce . Please let me know if did any mistake in coding ?

Regards,

Rani 


volatile bool g_bFeedWatchdog = true;


void
WatchdogIntHandler(void)
{
    //
    // If we have been told to stop feeding the watchdog, return immediately
    // without clearing the interrupt.  This will cause the system to reset
    // next time the watchdog interrupt fires.
    //
    if(!g_bFeedWatchdog)
    {
        return;
    }

    //
    // Clear the watchdog interrupt.
    //
    MAP_WatchdogIntClear(WATCHDOG0_BASE);

    //
    // Invert the GPIO PN0 value.
    //
}

void watch_dog()
{
    //
       // Enable the peripherals used by this example.
       //
       MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0);
       MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);

       //
       // Enable processor interrupts.
       //
       MAP_IntMasterEnable();

       //
       // Set GPIO PN0 as an output.  This drives an LED on the board that will
       // toggle when a watchdog interrupt is processed.
       //
       MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
       MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0);

       //
       // Enable the watchdog interrupt.
       //
       MAP_IntEnable(INT_WATCHDOG);

       //
       // Set the period of the watchdog timer to 1 second.
       //
       MAP_WatchdogReloadSet(WATCHDOG0_BASE, (g_ui32SysClock));

       //
       // Enable reset generation from the watchdog timer.
       //
       MAP_WatchdogResetEnable(WATCHDOG0_BASE);

       //
       // Enable the watchdog timer.
       //
       MAP_WatchdogEnable(WATCHDOG0_BASE);
}

  • Hello Rani,

    That wouldn't make sense to me either so I suspect this is either misunderstanding how the IDE connects to the device and the impact of a reset, or there is something systemic going wrong that we would need to try and debug.

    The first set of question I have are:

    • Can you load any projects into the device? If yes, please see the second set of questions.
    • If not, have you tried unlocking the device?
    • If so, have you run this code and caused the device to lock up every time it runs?

    The second set of questions are:

    • If you are able to load programs, what are you doing that prompts that error?
    • Have you tried to, after a reset, reconnect to the core without breaking the debug session?
    • Are you able to get access to any of the device registers?

    The more information I get about these, the better chance I will have to help guide you to a solution here.

    Best Regards,

    Ralph Jacobi

  •  

     Jacobi,

    Can you load any projects into the device? If yes, please see the second set of questions.

    Yes, I can download project into the device.

    My aim is to be add watchdog timer concept into my application code  to reset the device. After adding as such, watchdog interrupt is cleared every one seconds once.When i try to reset the device by blocking watchdog interrupt clear set as variable Zero .As  that time getting error as mentioned above .

    • If you are able to load programs, what are you doing that prompts that error?
    • Have you tried to, after a reset, reconnect to the core without breaking the debug session?
    • Are you able to get access to any of the device registers?

    I can able to load program . Tried many time after reset and reconnect the device ,but forcing  to block watchdog timer interrupt clear getting error instead of device get reset.

    Best regards,

    Rani

  • Hello Rani,

    So when the device resets via the watchdog, the whole JTAG resets as well which severs the connection to the IDE. You have to manually reconnect by right clicking the core and selecting Connect Target:

    Sometimes you have to do so twice to fully re-establish the debug connection.

    Best Regards,

    Ralph Jacobi

  • Hi Jacobi ,

        In debug mode if i give reconnect target is working fine . In case of  running  mode(without debugger) watchdog timer get reset what would happen ? Target will reconnect automaticlly ? program start to execute from main?

    Best Regards,

    Rani 

  • Hello Rani,

    The Watchdog reset would restart from the program from main.

    Best Regards,

    Ralph Jacobi