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.

RTOS/CC1310: Confusion with Watchdog

Part Number: CC1310


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. */
}

  • Hello Saycoda,

    I started with the watchdog example and did a SysCtrlSystemReset() once the wathdog expired. I removed the debugger and pressed the button to initiate the timer. Exactly after 20 seconds, it did do the callback and reset the system. It did not wait for 20 more seconds to do the reset. It worked fine as expected.

    In your code you have a CPU delay in a for loop in the callback function. Please note that the call back functions should typically be used to set flags and should not be used for excessive processing or delays. Can you try moving that out.

    Regards,
    Prashanth