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.

CC1350: Watchdog timer

Part Number: CC1350

hello sir

i am working on cc1350 launchpad . and i have implemented the watchdog timer for my application

my question is that , when my watchdog has been reset. after time overflow. it will stuck somewhere . i when i press the button it will start. but second time after the time overflow. it is not stuck it will reset automatically.

just i need press the reset button first time. after program has been flashed.

i dont understand why it is happening , i am attaching my code below please check it. 

void *mainThread(void *arg0)
{
   unsigned char i=0;
    Watchdog_Params params;
    /* Call driver init functions */
    GPIO_init();
    Watchdog_init();
    /* Configure the LED and button pins */
    GPIO_setConfig(Board_GPIO_LED0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    GPIO_setConfig(Board_GPIO_BUTTON0, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
    /* Turn off user LED */
    GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);
    GPIO_write(Board_GPIO_LED1, Board_GPIO_LED_ON);
    sleep(5);
  /* Create and enable a Watchdog with resets disabled */
    Watchdog_Params_init(&params);
    params.callbackFxn = NULL;
    params.resetMode = Watchdog_RESET_ON;
    watchdogHandle = Watchdog_open(Board_WATCHDOG0, &params);
    if (watchdogHandle == NULL)
    {
        /* Error opening Watchdog */
        while (1);
    }
    Watchdog_setReload(watchdogHandle, 3000000);
    /* Enter continous loop */
    while (true)
    {
        i++;
        Watchdog_clear(watchdogHandle);
        GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_OFF);
        GPIO_write(Board_GPIO_LED1, Board_GPIO_LED_OFF);
        sleep(1);
        GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);
        GPIO_write(Board_GPIO_LED1, Board_GPIO_LED_ON);
        sleep(1);
        if(i>10)
        {
            i=0;
            while(1);
        }
    }
}
  • Hi Nilesh

    I'm not fully understanding your issue here, could you maybe elaborate and clarify what you mean?

    As I understand it, you setup your Watchdog to expire at 3000000 ticks, would be ~2s timeout.
    The watchdog functions in such a way that the first timeout do not trigger an reset, while the second timeout (IF the first left the watchdog un-handled) will reset the device.

    It is not clear on what you "button" does in your program or if it affects the watchdog at all, maybe you could provide snippets on this as well.

    A common issue people see when using the watchdog is the device "freezing" following a reset when they have the debugger attached. This is per design and are meant to give you the opportunity to debug the system (to find out why you reset) when the debugger is attached. When disconnecting the debugger, the device will simply reset and start running as normal.
  • Thanks for your instant reply

    first the  i am not using any button in my program. actually it get copied by me.

    first of all, when i flash the above code. i need to press the reset button. after pressing reset button. i don't need to reset. the code running as a normal. even after watchdog reset is occured.

    only first time after program. when my watchdog is expired. i need to press the reset button. after that my code is running abnormal.

  • Hi Nilesh,

    That sounds like you, following the flash, are having the debugger connected. The reset of the device then "disconnects" the debugger and the watchdog are able to reset as "expected".
  • hi sir

    my watchdog timer is reset when whatever time that i have given to it. so it is fine for me.
    but it reset when i am giving to USB supply. but instead of USB when i connect the 3.3 V Battery Externally . my WatchDog timer does not reset after timer overflow.

    i don't understand this issue. please guide me.


    Thank you
  • Hi Nilesh,

    Are you saying your watchdog timer do not properly reset when you are operating on external power (3V3 battery in this case)? How are you verifying this, have you tried the simple watchdog example provided in the SDK?
  • Thanks sir for your reply.

    yes sir i have tried sdk example of watchdog timer.
    my battery voltage is 3.6 but still the my watchdog is not working
  • Is the debugger disconnected fully at this point? Have you verified that the device is actually running?
    When the device is in standby, the watchdog timer will not count and thus never reset the device. If the debugger is attached, the system is typically kept alive which result in the watchdog "always" counting.