13

what is the difference between hardware watchdog and software watchdog ?

M Sharath Hegde
  • 435
  • 1
  • 6
  • 20

2 Answers2

15

A hardware watchdog is hardware. Software watchdog is software. For a hardware watchdog, there is hardware that if it is not kicked often enough will assume the software has hung and will reset the system usually or whatever the design dictates. The hardware is assumed to be more reliable than the software. For a software watchdog, one software task/thread/whatever is assumed to be more reliable than another, if the questionable code fails to kick the reliable code then the reliable code kills the questionable code (or whatever the design dictates). There is a problem if the questionable code fails due to hardware which could take down all of the code including the software watchdog. So a software watchdog is only useful if you have the watchdog running in such a way that it is more reliable than the task in question, for example it may be there to prevent a task from wandering out of its memory space and getting a protection fault (which you could have just watched for in a fault handler rather than setup a watchdog, but anyway)...

old_timer
  • 62,459
  • 8
  • 79
  • 150
  • In many cases, hardware and watchdog approaches may be combined. For example, many systems only have one or at most two hardware watchdogs, but the routine which "feeds" those can also ensure that many other things that should be happening, are in fact doing so. – supercat Sep 19 '13 at 22:13
10

HW watchdog resets the system automatically, if the shutdown is not (periodically) prevented by software; SW watchdog OTOH can do something only, when given CPU time. Thus it must periodically check if the system needs to be reset and respond to that by programming HW.

The end result is that a SW watchdog can fail to respond to total system crash.

Typical programming models of those are:

HW watchdog:   [HW circuit]  <-- [low priority timer interrupt postponing reset]
--
vs.
--
SW watchdog:   [Low priority SW process feeding SW Watchdog]
           +   [High priority SW process requiring "food"]
Aki Suihkonen
  • 15,929
  • 1
  • 30
  • 50
  • 1) does this(software watchdog) mean one can adopt watchdog mechanism even if he don't have watchdog timer hardware ? 2) What is OTOH ? – M Sharath Hegde Sep 17 '13 at 10:47
  • 1) Yes, it means that if SW watchdog is a valid concept, it must simulate the non-existing HW by the means, that do exists. This presumes at least a regular timer interrupt. 2) OTOH='On the other hand' – Aki Suihkonen Sep 17 '13 at 11:06
  • Is watchdog timer(HW) internal to micro controller ? – M Sharath Hegde Sep 17 '13 at 11:13
  • You have to consult the reference sheet of your micro controller. Today WD timer can be an essential part of any SoC; but also it makes sense to externalize WD features in a separate unit, that integrates e.g. RTC and power management, as different parts of a system may require to be shut down at different stages. – Aki Suihkonen Sep 17 '13 at 11:44
  • I gradually felt "Software" part of SWT(software watchdog Timer) is misleading after reading [this](http://www.freescale.com/files/32bit/doc/ref_manual/MPC5510RM.pdf) more specifically section 16.2.2.1 – M Sharath Hegde Sep 27 '13 at 07:36
  • I wonder what a HW WD without any SW would look like. Also one can suspect that a SW only WD is an impossible concept. – Aki Suihkonen Sep 27 '13 at 08:15
  • i guess there is nothing like HW or SW only watchdog, WatchDog Timer can be accomplished by using both(HW registers, A SW module that monitors the Registers) – M Sharath Hegde Sep 27 '13 at 09:44