daviddigo 0 Posted November 27, 2013 Share Posted November 27, 2013 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. Quote Link to post Share on other sites
grahamf72 169 Posted November 27, 2013 Share Posted November 27, 2013 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 Quote Link to post Share on other sites
daviddigo 0 Posted November 28, 2013 Author Share Posted November 28, 2013 I undestand...so how can I make the micro to reset itself throught the reset pin when the program takes longer than predicted?(code) Quote Link to post Share on other sites
cde 334 Posted November 29, 2013 Share Posted November 29, 2013 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. daviddigo 1 Quote Link to post Share on other sites
roadrunner84 466 Posted November 29, 2013 Share Posted November 29, 2013 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.) Quote Link to post Share on other sites
daviddigo 0 Posted November 29, 2013 Author Share Posted November 29, 2013 Thanks for the 555 watchdog tip! Works fine! Quote Link to post Share on other sites
zeke 693 Posted November 29, 2013 Share Posted November 29, 2013 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. daviddigo 1 Quote Link to post Share on other sites
daviddigo 0 Posted November 29, 2013 Author Share Posted November 29, 2013 I didn Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.