Hi All ,
I am trying to implement a watchdog timer which resets the device.
When running the program ,
The watchdog counter WDCNTR overflows, but the WDFlag gets set and then immediately resets itself , instead of waiting for me the clear the WDFlag .The program then continues running . I am not servicing the watchdog. Could you tell me what I am missing ?
#include "F28x_Project.h" // Device Headerfile and Examples Include File long int LoopCount = 0; void main(void) { // unsigned long delay; // Step 1. Initialize System Control: // PLL, WatchDog, enable Peripheral Clocks // This example function is found in the F2837xD_SysCtrl.c file. InitSysCtrl(); // Step 2. Initialize GPIO: // This example function is found in the F2837xD_Gpio.c file and // illustrates how to set the GPIO to it's default state. // InitGpio(); // Step 3. Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; // Initialize the PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // This function is found in the F2837xD_PieCtrl.c file. InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // This will populate the entire table, even if the interrupt // is not used in this example. This is useful for debug purposes. // The shell ISR routines are found in F2837xD_DefaultIsr.c. // This function is found in F2837xD_PieVect.c. InitPieVectTable(); // Step 4. Initialize all the Device Peripherals: // This function is found in F2837xD_InitPeripherals.c // InitPeripherals(); // Not required for this example // Connect the watchdog to the WAKEINT interrupt of the PIE // Write to the whole SCSR register to avoid clearing WDOVERRIDE bit EALLOW; WdRegs.SCSR.all = 0; EDIS; EINT; // Enable Global Interrupts // Reset the watchdog counter ServiceDog(); // Enable the watchdog EALLOW; WdRegs.WDCR.all = 0x0028; EDIS; // Step 6. IDLE loop. Just sit and loop forever (optional): for(;;) { LoopCount++; // ServiceDog(); } }