The MCA implements a watchdog timer in its firmware. Any internal CPU watchdog timer on the ConnectCore 8M Nano is disabled by default because the MCA is responsible for the power/reset initialization of the SOM as a whole.

Features

You can configure the following MCA watchdog features:

  • Set the timeout to a value between 1 and 255 seconds.

  • Initiate interrupt or system reset.

  • Initiate full-system reset (including the MCA itself) or CPU-only reset.

Kernel configuration

You can manage the MCA watchdog driver support through the following kernel configuration option:

  • Digi ConnectCore SOMs Micro Controller Assist Watchdog (CONFIG_MCA_WATCHDOG)

This option is enabled as built-in on the default ConnectCore 8M Nano kernel configuration file.

Kernel driver

The MCA watchdog driver is located at:

File Description

drivers/watchdog/mca_wdt.c

MCA watchdog driver

Device tree bindings and customization

The MCA watchdog device tree binding is documented at Documentation/devicetree/bindings/watchdog/digi,mca-wdt.txt.

Watchdog inside the MCA

ConnectCore 8M Nano device tree
mca_cc8m: mca@63 {

	...

	watchdog {
		compatible = "digi,mca-cc8m-wdt";
		digi,full-reset;
	};
};

Using the watchdog

The watchdog is accessible via the file descriptor /dev/watchdog0.

For information about the watchdog API, see the Linux kernel documentation at Documentation/watchdog/watchdog-api.rst.

When a device enters suspend mode, the watchdog timer is suspended as well. The timer resumes when the device resumes operation.

Sample application

An example application called apix-watchdog-example is included in the dey-examples-digiapix recipe (part of dey-examples package) of meta-digi layer. This application uses the Digi APIx library to enable a watchdog device on the ConnectCore 8M Nano.

Go to GitHub to see the application instructions and source code.

See Watchdog API for more information about the watchdog APIx.

Enabling the watchdog in U-Boot

In a typical use case, a user space application or service starts the watchdog. However, if the system hangs before reaching this point, the watchdog is not able to reset the device. To avoid this situation, you may want to start the watchdog as early as possible, such as at the bootloader stage. Since the default U-Boot cannot start the watchdog, you must change the configuration and recompile U-Boot to add this functionality. To enable the MCA watchdog in U-Boot, add the following configuration options in the defconfig file that corresponds to your ConnectCore 8M Nano variant (see U-Boot files by variant):

CONFIG_WDT=y
CONFIG_WDT_MCA=y
U-Boot not only enables but also starts the watchdog when compiled with these entries.

The default timeout for MCA watchdog is 128000 milliseconds. You can override that value by setting the following entry to a timeout in ms on the defconfig file:

CONFIG_WATCHDOG_TIMEOUT_MSECS=50000

Recompile U-Boot with the new configuration options, then program it on the device. See Program firmware from U-Boot for more information. The new U-Boot banner displays a new WDT line showing the watchdog started with the configured timeout:

U-Boot SPL dub-2020.04-r2.2 (Jan 18 2021 - 15:54:36 +0000)
DDRINFO: start DRAM init
DDRINFO: DRAM rate 3000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from BOOTROM
image offset 0x0, pagesize 0x200, ivt offset 0x0


U-Boot dub-2020.04-r2.2 (Jan 18 2021 - 15:54:36 +0000)

CPU:   i.MX8MNano Quad rev1.0 1400 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 36C
Reset cause: POR
DRAM:  1 GiB
MCA:   HW_VER=1  FW_VER=1.01
WDT:   Started with servicing (128s timeout)
MMC:   FSL_SDHC: 1, FSL_SDHC: 0
In:    serial
Out:   serial
Err:   serial
Model: Digi ConnectCore 8M Nano Development Kit
ConnectCore 8M Nano SOM variant 0x01: 1 GiB LPDDR4, Wi-Fi, Bluetooth, MCA, Crypto-auth
  Board version 3, ID undefined
Boot:  MMC2

 BuildInfo:
  - ATF 9447098
  - U-Boot dub-2020.04-r2.2

flash target is MMC:0
Net:   eth0: ethernet@30be0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0
=> 
Your application must refresh the MCA watchdog as soon as Linux starts; otherwise the system reboots after the configured timeout. See Using the watchdog.