Tool/software: TI-RTOS
I see a lot confusion with the watchdog system for this device on these boards. I did a search to see if someone has encountered what I do, but nobody seems to have described my scenario.
It appears that the watchdog enters the callback as expected, if it is not "cleared" within the reLoad time. Watchdog_setReload(watchdogHandle, 30000000); // 20sec (WDT runs always at 48MHz/32)
But does it enter the callback immediately? I anticipated that it would and reset right away, but it does not. It appears that it DOESNT RESET UNTIL another reLoad period.
Example1 :
If reLoad is set to 20 seconds, when the watchdog is not triggered for 20 seconds it enters the caalback, but does not reset for 20 seconds.
Example 2:
If reLoad is set to 10 seconds, when the watchdog is not triggered for 10 seconds it enters the caalback, but does not reset for 10 seconds.
etc.........
Why is this? Code below.
////////////////////////////////
Watchdog_init();
Watchdog_Params wd_params;
Watchdog_Params_init(&wd_params);
wd_params.callbackFxn = (Watchdog_Callback)watchdogCallback;
wd_params.debugStallMode = Watchdog_DEBUG_STALL_ON;
wd_params.resetMode = Watchdog_RESET_OFF;
watchdogHandle = Watchdog_open(Board_WATCHDOG0, &wd_params);
Watchdog_setReload(watchdogHandle, 30000000); // 20sec (WDT runs always at 48MHz/32)
if (watchdogHandle == NULL) {
/* Error opening Watchdog */
while (1);
}
watchdog_rst_cnt = 0;
///////////////////////////////
void watchdogCallback(uintptr_t unused)
{
uint8_t i;
// return;
/* Clear watchdog interrupt flag */
//Watchdog_clear(watchdogHandle);
for(i=0;i<4;i++)
{
Toggle_LED(RED);
Toggle_LED(BLU); //FP LED tracks during lrn
CPUdelay(4000*200);
}
PIN_setOutputValue(ledPinHandle, Board_REDLED,1); //turn off red LED
PIN_setOutputValue(ledPinHandle, Board_900M_LED,1); //start at fixed state
watchdogExpired = true;
SysCtrlSystemReset(); //added to reset immeadately
//watchdog_rst_cnt++;
/* Insert timeout handling code here. */
}