Watchdog Timer

[中文]

1. Overview

The watchdog monitors system/software faults. If the watchdog is not fed before timeout, it resets the system.

See: WDT Driver Guide

Note

  1. Only one WDT hardware instance exists and is managed on CP—configure cp/middleware/soc/bk7258/bk7258.defconfig.

  2. Feeding occurs on CP; missing a timeout triggers reset.

  3. AP lacks WDT—it is monitored via inter-core heartbeat.

  4. AP applications may reboot via bk_reboot.

2. Code Path

  • CLI: components/bk_cli/cli_wdt.c

  • Driver: ap/middleware/driver/wdt/wdt_driver.c

  • API reference: WDT API

3. Configuration

Macros such as CONFIG_INT_WDT (hardware watchdog), period settings, CONFIG_TASK_WDT (software watchdog), and CONFIG_NMI_WDT_EN.

4. CLI Commands

WDT CLI commands

Command

Param

Description

wdt_driver init / wdt_driver deinit

none

Initialize or release driver resources

wdt start

start watchdog

Start the watchdog with the configured timeout

wdt stop

stop watchdog

Stop the watchdog

wdt feed

feed watchdog

Feed the watchdog

wdt enable / wdt disable

enable/disable

Enable or disable watchdog debug output

wdt while

loop feeding test

Continuously feed the watchdog in a loop

5. Demo

Example sequence:

  1. wdt start 1000

  2. wdt feed

  3. wdt stop

  4. wdt enable (debug)

  5. wdt disable

CLI logs show start/feed/stop actions.