The watchdog timer, set to specific time intervals, handles gross system misbehavior. The watchdog timer can be enabled or disabled depending on the operating condition. Once the watchdog timer is activated, it must be serviced by software on a periodic basis. If servicing does not take place in time, the watchdog times out and issues a system reset.

The ConnectCore 6 Plus has:

  • Two watchdogs available on the i.MX6 system-on-chip

  • One watchdog available on the DA9063 PMIC

The Board Support Package (BSP) only supports the i.MX6 watchdogs.

Features

The features of the i.MX6 watchdog include:

  • Configurable timeout counter between 0.5s and 128s

  • Time resolution of 0.5s

  • Option to disable the watchdog timer count during low power mode

  • Assertion of WDOG_RESET_B_DEB reset signal on timeout

  • Inability to stop watchdog once started

Kernel configuration

You can manage the i.MX6 watchdog driver support through the kernel configuration option IMX2+ Watchdog (CONFIG_IMX2_WDT).

This option is enabled as built-in on the ConnectCore 6 Plus SBC kernel configuration file.

Kernel driver

The watchdog driver for the i.MX6 is located at drivers/watchdog/imx2_wdt.c.

Device tree bindings and customization

The watchdog device tree binding is documented at Documentation/devicetree/bindings/watchdog/fsl-imx-wdt.txt.

The i.MX6 watchdog timers are defined in the common i.MX6 device tree file:

Common ConnectCore 6 Plus device tree
wdog1: wdog@020bc000 {
        compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
        reg = <0x020bc000 0x4000>;
        interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&clks IMX6QDL_CLK_DUMMY>;
};
wdog2: wdog@020c0000 {
        compatible = "fsl,imx6q-wdt", "fsl,imx21-wdt";
        reg = <0x020c0000 0x4000>;
        interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
        clocks = <&clks IMX6QDL_CLK_DUMMY>;
        status = "disabled";
};

The ConnectCore 6 Plus uses watchdog 1 (WDOG1) on the i.MX6 CPU to reset the system.

ConnectCore 6 Plus SBC device tree
&gpc {
        fsl,cpu_pupscr_sw2iso = <0xf>;
        fsl,cpu_pupscr_sw = <0xf>;
        fsl,cpu_pdnscr_iso2sw = <0x1>;
        fsl,cpu_pdnscr_iso = <0x1>;
        fsl,ldo-bypass = <0>; /* No ldo-bypass */
        fsl,wdog-reset = <1>; /* watchdog select of reset source */
        pu-supply = <&reg_pu>;
};

Watchdog user space usage

Linux creates a device node /dev/watchdog that you can use to manage the watchdog timer.

For information about the watchdog API, refer to the Linux kernel documentation: Documentation/watchdog/watchdog-api.txt.

Watchdog test application

You can install the package dey-examples-watchdog, which includes the test application watchdog_test.

The watchdog_test application allows you to specify the watchdog timeout value and the test time. The application refreshes the watchdog timer every second during the test time. After the test time is over, the application no longer refreshes the watchdog. The driver resets the system when the configured timeout period ends without the watchdog being refreshed.

Syntax

To display the application syntax, run:

watchdog_test -h

Example

Run the test for 10 seconds, setting the watchdog timeout to two seconds:

watchdog_test -n 10 -t 2

In this example:

  • The watchdog timeout is set to two seconds

  • The watchdog timer is enabled

  • The application refreshes the watchdog timeout count every second for 10 seconds

  • After 10 seconds, the application quits and stops refreshing the watchdog

  • The driver resets the system two seconds after the application has stopped refreshing the watchdog