This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Watchdog timer use case sensitive application

Hi, 

Good day!

Statement of problem: In our application, we are using nrf52832 SoC to control critical components (heater). So I was suggested to use a watchdog timer to control the critical elements. I tried to search online about this watchdog timer application and did not quite get the application part of it.

Query:

How I can use this watchdog timer to clear any application lockup situation so that heater can be set to default state? 

Is it possible to retain the application data after the watchdog timer is reset? If so how it can be implemented?

Thank you,

Aim High!

  • Hello,

    it's possible (RAM contents is not cleared upon reset), but in general you shouldn't rely on any app state after watchdog reset. You don't know what's happen - there may be power glitch or bug in the code that corrupts some RAM regions. The rule - after reset, put your system in safe state by hardware (for example, ensure pullups/pulldowns on pins that control critical elements).

  • Hi Dmitry,

    Thank you for your suggestion. 

    How I can implement this watchdog timer with the application to protect its critical elements?

    I am asking a very basic question when it comes to application am I not sure where to add this watchdog timer?

  • Hi,

    The watchdog in the nRF is just a simple downwards counting timer that you configure to run with a predefined counter reset value. During normal operation, you reload the counter (feed/kick it). If the application for some reason fails to do this (due to a deadlock or something else), then the counter will reach 0 and trigger a watchdog reset. The application will be notified by an interrupt before the reset, giving you time to put external signals in a safe state,etc (but there is no time to write to flash).

    Essentially you should design your system so that the watchdog timeout is long enough that it does not occur during normal operations, and you should try to make sure that you don't feed it in an error condition. (For instance, don't use a high priority timer interrupt to reload it, since in that case it may very well be reloaded even though there is an error state).

    You can refer to the WDT example to see how it can be used.

  • Thank you, Einar. Your information is all I wanted to know about Watchdog timer. 

Related