Watchdog clock management on Arduino

Watchdog clock management on Arduino

Watchdog clock management on Arduino

In electronics and by extension in computing, the watchdog is a resource that allows a physical device or an application to restart when it stops working normally. Specifically, referring to microcontrollers, it is a countdown clock that produces a reset when it overflows.

Table of Contents

    Logically, the device does not know when it stops working correctly, the principle of operation is to prevent the countdown from ending and therefore the system reset. To do this, first the time interval in which the restart occurs is configured, and secondly this value is refreshed, thus indicating that the device is working correctly and should not be restarted at the moment.

    To manage the watchdog with Arduino the library should be used wdt.h and only three functions: wdt_disable() to disable it while configuring the reset time, wdt_enable(time) that configures and activates the watchdog at the time indicated as a parameter (time) and wdt_reset() that renews the interval that the watchdog counts.

    Constants that can be used with wdt_enable to set the countdown time are:

    • WDTO_15MS = 15 milliseconds
    • WDTO_30MS = 30 milliseconds
    • WDTO_60MS = 60 milliseconds
    • WDTO_120MS = 120 milliseconds
    • WDTO_250MS = 250 milliseconds
    • WDTO_500MS = 500 milliseconds
    • WDTO_1S = 1 second
    • WDTO_2S = 2 seconds
    • WDTO_4S = 4 seconds
    • WDTO_8S = 8 seconds

    Before using the watchdog it is important to ensure that the bootloader What does the microcontroller on the board have? Arduino that is being used has provided for the use of this resource. There is a known error in the plates of the Arduino Mega 2560 that were left hanging precisely with programs that used the watchdog.

    To learn more about what a bootloader or boot manager and how to record a different one than the one that comes with your plate, you can consult the article on methods for programming Atmel microcontrollers.

    Post Comment

    You May Have Missed