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.

C2000 watchdog need second timer to reset?

Hi folks,

I'm just looking into setting up the watchdog for my F2802x project.

Am I correct in thinking that if I wish to have the watchdog reset the device if it has hanged, then I need to use a second timer ISR (e.g CPU timer 0) to actually service the watchdog during normal opertaion at some period less than that of the WDCNTR?

Is there no way of having the watchdog look after device reset without using a second timer in this manner??

Thanks

(Well, I guess I could call servicedog() every few lines throughout my code... ugh)

  • Toby,

    If you are using the WD timer, then yes, you need to service the WD from time to time before it times out.  A common way to do this is to use a periodic ISR to hold the code that does this.  There must be some ISR someplace in your code that already runs faster than the WD period.  For example, your control loop ISR, perhaps triggered by the ePWM.

    Note that you don't want to put both WD key writes in the ISR.  Put one in the background loop (e.g. 0x55), and the second in the ISR (e.g. 0xAA).  That way, you can catch both background and foreground code crashes.  If you put both in the ISR, then the background code can crash but if interrupts are still working then the WD will not catch it.

    Regards,

    David

  • Brilliant David, Thanks!

    Are there any issues to be aware of if stopping the WD? e.g. for critical code sections such as using the flashAPI

    Ta

  • Nothing special.  You can disable the WD if you want, provided that you haven't cleared the WDOVERRIDE bit in the SCSR register.

    Note that the flash APIs already disable the WD (again, provided SCSR.bit.WDOVERRIDE is not cleared).  It is up to the user to turn it back on afterwards.  This is all in the flash API documentation.

    - David