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.

Regarding Using Watchdog in MSP430F5340

Other Parts Discussed in Thread: MSP430F5340

I am using MSP430F5340 for my project and I want to reset it if anything goes wrong in the execution. I have used ADC12 as well as UART Interrupts and the rest of the code runs around in an infinite while loop in main. And if Watchdog is used then what should i do to periodically check any fault or glitch in the code and if any fault is found then reset the MSP using watchdog. How can I periodically check that the MSP is functioning properly and then reset the Watchdog if everything is found OK? So that when a fault occurs watchdog isn't reset and it eventually resets the MSP.

  • Hi Chinmay!
    You have to do whats known as "Kicking the Dog" or "Feeding the Dog".

    This means to place "WDTCTL = WDTPW+WDTCNTCL;" in your code, which resets the Watchdog so that it does not generate an interrupt or Reset. Where you do this is up to you, so choose the location(s) that make(s) the most sense. This will only catch faults that cause the code to hang up. See: e2e.ti.com/.../67148

    There is also a way to reset on an invalid address fetch, check out the code example "MSP430F534x_WDT_05.c"
  • The idea is to feed the watchdog only when everything is working correctly.

    If you put the feeding code into the main loop, then you can detect if the main loop no longer runs (probably because some interrupt is stuck).

    If your application regularly reads from the ADC and sends the value out over the UART, then you could put the feeding code into the "UART is finished" interrupt handler; this could detect if the ADC/UART processing no longer works. (And this requires that you actually do this processing regularly; if there can be pauses, the watchdog would trigger too early.)

    Where you put the feeding code depends on what your application does, and what errors you want to detect. You have to choose this yourself.

  • Chinmay,
    Does this answer your question?
  • I am extremely sorry for such a late reply. In the mean time I was checking the design on EFT/Burst and found that the MSP hangs when used with external crystal even at 500V pulse and If i used the MSP on DCO at 8Mhz it sustains even at 4KV pulse. I have posted it on a different thread : e2e.ti.com/.../563951


    I was going to use watchdog to ensure that my code won't hang in between. I understood what you said about the concept of watchdog but i am still unclear where to place the "petting". For that I need to explain what my code does and will get back to you when I sort out the EFT crystal failure problem.

**Attention** This is a public forum