2
\$\begingroup\$

We used to use Watchdog signatures in our control applications.

Basically we used to allocate a reserved memory in RAM(uninitialized) and used to store the watchdog signatures.

On power on, the system checks for the watchdog signature and based on that we used to find out whether it is watchdog reset or normal reset that has happened.

My question is, which memory is better for storing the watchdog signatures whether it is RAM or Flash?

\$\endgroup\$
4
\$\begingroup\$

Usage of memory storage signatures to determine if a watch dog timer is what has caused your last reset is a scheme that should be avoided at all costs. That scheme is fraught with problems and does not provide a fool proof scheme.

Here are some key factors to consider here that lead to this being a problematic approach. (There are others as well so analyze carefully).

1) Signatures stored into RAM may or may not be legitimate after a power cycle reset becasue RAM can maintain its content for some period of time after a power cycle.

2) A watch dog reset is likely caused by a spurious error in the hardware electronics some place. How can you be certain that this has not compromised the storage of the signatures?

3) The storage of signatures into FLASH or other non-volatile memory is problematic due to the fact that the watch dog timeout / reset could occur during the time that such signatures are being stored.


It is far superior to setup your system hardware with logic that captures the "reset reason" into special flop-flops or register bits that the software can poll in its startup sequence to determine if the restart was due to a watch dog timeout. If your system processor does not have this built right into the chip then consider substituting another processor that does include this capability. In cases where the watch dog is implemented outside the controller look into adding a simple external circuit that can provide the "reset reason" to the processor through an I/O pin.

\$\endgroup\$
  • \$\begingroup\$ Thanks for your elaborate reply. I have one doubt regarding your last sentence "In cases where the watch dog is implemented outside the controller look into adding a simple external circuit that can provide the "reset reason" to the processor through an I/O pin. If I do this, I will get a status indication, but as the processor has resetted still I will not have the indication isnt it?? \$\endgroup\$ – badz Oct 7 '12 at 8:12
  • \$\begingroup\$ @badz - A lot really depends on how your hardware in currently implemented. My last sentence was based upon a system where the power on reset (POR) and watchdog timer (WDT)are both implemented outside the processor. In this case you would have the POR and WDT circuits implemented in a way that the POR clears the added flip-flop and the WDT sets it (either by preset or edge clocking it). For this to work correctly it is necessary that the POR and WDT be distinct signals before being combined to reset the processor. Note that it is far easier these days to find a processor with this built-in. \$\endgroup\$ – Michael Karas Oct 7 '12 at 8:58
2
\$\begingroup\$

If you don't need to retain the information through a power cycle then RAM is better particularly if your signature is something which is rewritten often and may create Flash wear problems. The only other concern you might have is if power supply stability is a concern and then a power transient might wipe out your signature.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the reply. I have one particular doubt in writing to RAM. As per the definition of RAM as power goes off the info is lost. But how the uninitialized location(which is defined for watchdog signature) still maintains the value stored. Am I missing some basic here? \$\endgroup\$ – badz Oct 7 '12 at 7:19
  • \$\begingroup\$ A power glitch that is brief enough will retain contents of RAM, as pointed out in another answer. Also, not sure where in the question it is implied that the signature needs to be rewritten frequently. \$\endgroup\$ – Anindo Ghosh Aug 29 '13 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.