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.

Using WatchDog Timer for Reset -TMS320F2808

Other Parts Discussed in Thread: TMS320F2808

Hello,

I am working on TMS320F2808 controller.

Using an External communication RS-232 we are sending commands to the controller to modify global variables.every time a watch dog reset occurs the global variables are also reset to their default values .

Whereas we are expecting the variables to contain the application modified values.

Kindly explain how to accomplish the required status.

regards,

Sanath Rai

  • Sanath,

    A WD reset is a real reset.  Your code starts over again from the reset vector.  Prior to getting to main(), you eventually run the compiler bootup routine _c_int00, and this re-initializes all initialized global vars.

    What you can do is NOT declare the global vars of interest with initial values.  In other words, DO NOT DO THIS:

    int x=5;

    Instead, just declare x:

    int x;

    and then manually initialize it to its initial value in your software, either in main() or some called function of your choice:

    x = 5;    // assign the intial value for x

    You need to do this for all vars that you don't want to default back to their intial value after a WD reset.

    Now, you also need to detect if the reset was a WD reset or a normal (e.g., power-up or XRSn pin reset).  To do this you use the WDFLAG bit in the WDCR register.  Check WDFLAG in software.  If WDFLAG=0, then you execute the var initializations since it was a normal reset.  If WDFLAG=1, then you DO NOT execute the var initialization routine.

    Note that it can be tricky to make WDFLAG reliable.  See the F280x System Control and Interrupts Manual, SPRU712G, p.64.  Some people have also used a slow-rise time RC circuit on a GPIO pin to differentiate between a power-on reset and a WD reset.  If a power-on reset, the cap will still be discharged and hence the GPIO will read 0.  This approach can have issues however with short duration brownouts.

    Good luck,

    David