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.

Compiler/TMS320F28379D: watchdog

Part Number: TMS320F28379D

Tool/software: TI C/C++ Compiler

hello 

if i keep     WdRegs.WDCR.all = 0x002E; or     WdRegs.WDCR.all = 0x002F; then my watchdog is working fine it is getting reset.

But on keeping wdcr less than this values watchdog is not getting reset and its getting stuck in delay loop.

I have taken a delay of 500 ms

But if i take more than 500 ms (like 1500 ms) then my code control is stuck in the delay loop even after selecting maximum watchdog reset period ( WdRegs.WDCR.all = 0x002F;).

How watchdog counter depends on delay_us() function PLEASE Explain.

  • Ashish,

    Not very clear on the issue. WDCR is control register and bit 2-0 are the prescaler to divider the clock which increments the WD counter. If you are keeping this value less then your WD should issue reset even earlier. Can you post the snapshot of your code and let us know where it's getting stuck?

    Vivek Singh

  • THIIS IS MY MAIN FILE.

    #include "F28x_Project.h"

    #define BLINKY_LED1 31 //31 is Blue led.

    void InitWatchdog(void);

    Uint16 loopcount = 0;

    void main(void)
    {
    InitSysCtrl();
    InitWatchdog();
    GPIO_SetupPinMux(BLINKY_LED1, GPIO_MUX_CPU1, 0);
    GPIO_SetupPinOptions(BLINKY_LED1, GPIO_OUTPUT, GPIO_PUSHPULL);
    GPIO_WritePin(BLINKY_LED1,1);
    DELAY_US(1000*500);
    GPIO_WritePin(BLINKY_LED1,0);
    DELAY_US(1000*500);
    while(1)
    {
    loopcount++;
    }
    }

    THIS IS MY WATCHDOG CONFIGURATION CODE.

    #include "F2837xD_device.h"

    void ServiceDog(void);

    void InitWatchdog(void)

    {
    asm(" EALLOW");
    WdRegs.SCSR.all = 0x0000;
    asm(" EDIS");
    ServiceDog();
    asm(" EALLOW");
    WdRegs.WDCR.all = 0x002F;                     
    WdRegs.WDWCR.all = 0x0000;
    asm(" EDIS");
    }

    HERE IF I KEEP DELAY TIME OF 1500 ms THEN CONTROL GETS STUCK IN FIRST DELAY LOOP IN MAIN FILE.BUT IF I KEEP DELAY 500 ms THEN THIS WORKS FINE LIKE "IT IS TOGGLING LED ONCE PER RESET."

  • Ashish,

    Could it be that when your loop is bigger (or WD prescaler value is low) then WD count experes early and code execution does not reach to "GPIO_WritePin(BLINKY_LED1,0);" and this pin has external pull or floating value is seen as '1' by LED)hence you don't see LED toggling ?

    Regards,
    Vivek Singh
  • Hello Vivek,
    This is the issue only. But does it means that i cannot take a delay of more than 839.04 ms (this is maximum watchdog timeout period)
    How can i take a delay of more time than watchdog timeout period ,do i need to service watchdog inside the delay loop or do i need to disable the timer before going into the delay loop ?
  • Hi Ashish,

    Yes, you can use max value for WDPS and if the wait is more than that then you need to service the watchdog before it expires. I would not recommend disabling the watchdog because that defeats the purpose of using watchdog in application.

    Regards,

    Vivek Singh