Jump to content
Sign in to follow this  
daviddigo

Watch Dog timer

Recommended Posts

How to use the watch dog timer in the MSP430G2553 with Energia?

 

It will be very helpul if someone could post a very simple exemple of the necessary code to "auto-reset" the micro when the program takes more time then predicted.

Share this post


Link to post
Share on other sites

Energia uses the WDT in timer mode to provide the time base for millis and delay. To use it as a watchdog would require giving up these features, which would break a lot of core & library functionality.

 

 

Sent from my iPhone using Tapatalk

Share this post


Link to post
Share on other sites

Three ways. Use an external Watchdog Timer ic. Create a passive or simple watchdog timer from a 555 ic (google "watchdog 555" or "555 watchdog"). Or if you have a msp430 ic to spare (you should, the launchpad comes with two), create a watchdog timer with it.

 

In all three cases, you would need to drop a few digitalwrites (high and low) into your code, on a spare pin.

Share this post


Link to post
Share on other sites

All these solutions use an external WDT, needs to be noted that you can use the internal WDT. If you use the internal WDT, you will sacrifice basically all things that depend on the Energia framework timers (millis, micro, delay, etc.)

Share this post


Link to post
Share on other sites

I don't know Energia so this question might sound out of place.

 

The most ideal and desirable watchdog device is a hardware based solution. That being said, why not use software timers instead?

 

I use state machines in C to manage many repetitive tasks. Some of those tasks implement a software watchdog.

 

One state is to increment the timer count. Another state is to check that value. If that value is below the threshold (ie: 1 second [x counts]) then carry on to run state. If that value is above the threshold then force the MSP430 to reboot by sending it to the reboot state.

 

This method is not absolutely foolproof since it is completely dependent on the fitness of the hardware. But it works well when the hardware is working flawlessly.

 

If Energia can do state machines then you could implement this method.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...