NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on The site is now set to read only.

AM335x PSP WDT Driver User Guide

From Texas Instruments Wiki
Jump to: navigation, search
AM335x PSP WDT Driver User Guide
Linux PSP


Software stability is a major issue on any platform. Anyone who uses software has probably experienced problems that crash the computer or program in question. This is also true of embedded programs, and in most cases there is no user around to reset the computer when things go wrong. That job is occupied by the watchdog timer. The watchdog timer is a 32 bit counter that resets the processor when it rolls over to zero. The processor can reset the counter or turn it off, but, correctly used, it will reset the processor in case of a code crash. To avoid getting reset, the program must reset the timer every so often.

IP features

2 instances: 1 System watchdog timer (used in Linux) and 1 Security watchdog timer

  • Free running 32-bit upward counter.
  • Programmable divider clock source (2n with n=[0:7])
  • On the fly read/write register (while counting)
  • Reset upon occurrence of a timer overflow condition


AM335x has a 32-bit watchdog timer which can be used to reset the hardware in case of a software fault. Once the /dev/watchdog is opened, it will reboot the system unless a user space daemon resets the timer at regular intervals within a certain timeout period. If watchdog device node is closed before timeout also reboot won't happen. The WDT driver is registered as a misc device. Default timeout of this driver is 60 seconds



To enable/disable watchdog support, start the Linux Kernel Configuration tool:

$ make menuconfig 

Select Device Drivers from the main menu.

    Power management options --->
[ ] Networking support --->
    Device Drivers --->

Select Watchdog Timer Support as shown here:

< > Hardware Monitoring Support --->
< > Generic Thermal sysfs driver --->
[*] Watchdog Timer Support --->

Select OMAP Watchdog as shown here:

--- Watchdog Timer Support
[ ] Disable watchdog shutdown on close
< > Software watchdog --->
<*> OMAP Watchdog

Note: Watchdog timer is enabled by default in the am335x_evm_defconfig

Sample Applications

This chapter describes the watchdog sample application provided along with the package. The source for this sample application is available in the Examples (wdt) directory of the Release Package folder.

1) Change the relative path of the kernel directory in the 'Makefile' as per your directory structure :

# Kernel base directory name with path
KERNEL_DIR= <insert relative path to the kernel>

2) Compile the application using the 'make' command to obtain the executable :

$ make 

3) Run the executable application (saWatchdog) on the EVM :

The application sets the watchdog reset time to 10 seconds by default (this can be changed in the source file as per the user's convenience). To test the watchdog's functionality, run the following two test cases on the EVM and check if the results are as expected.

$ ./saWatchdog <a value less than the watchdog reset time>

(eg. $./saWatchdog 5)

$ ./saWatchdog <a value greater than the watchdog reset time>
(eg. $./saWatchdog 12)

The application will keep writing values before the timeout in the first case, thus not restarting the system and keeping it going.

The application will get late in writing a value before the timeout in the second case, hence restarting the system.