牛卧堂MCU技术交流
标题: [NUC980] Enabling Watchdog Timer on NUC980 [打印本页]
作者: admin 时间: 前天 13:06
标题: [NUC980] Enabling Watchdog Timer on NUC980
The NUC980 series supports a hardware watchdog timer (WDT), which can be used to improve system robustness by resetting the system in the event of a software fault. However, the method of enabling the WDT differs depending on the chip package.
Hardware Pin Limitation (PG3)- LQFP128 & LQFP216: Has a PG3 pin which can be used to configure whether the watchdog is enabled during boot via hardware.
- LQFP64: Does not have PG3 — therefore, watchdog must be enabled via software (U-Boot).
Enabling WDT in U-Boot (for LQFP64 or software control)1. Configure U-Boot to Enable NUC980 Watchdog Driver
$ make uboot-menuconfig
Navigate to:
Device Drivers ---> NUC980 Watchdog
Save and exit.
2. Rebuild U-Boot$ make uboot-rebuild
$ make
After this, U-Boot will include the NUC980 watchdog support.
Controlling WDT Activation via env.txtIn your U-Boot environment file (env.txt), add one of the following:
watchdog=off # or watchdog=0
watchdog=on # or watchdog=1 # or any non-zero, non-off string
If watchdog is undefined or set to any value other than off or 0, the watchdog timer will be enabled.
Default Timeout BehaviorBy default, the watchdog configuration in U-Boot uses the following:
- Clock source: PCLK2 / 4096
- Timeout count: 1,000,000 ticks
Given:
- PCLK2 = 75 MHz
- WDT clock = 75,000,000 / 4096 ≈ 18,310.5 Hz
- Timeout = 1,000,000 / 18,310.5 ≈ 54.6 seconds
You may modify this behavior in the U-Boot source if needed:
buildroot/output/build/uboot-custom/drivers/watchdog/nuc980_wdt.c
Reference:
https://github.com/OpenNuvoton/NUC970_U-Boot_v2016.11/blob/master/drivers/watchdog/nuc980_wdt.c
Linux Kernel ConsiderationIf WDT is enabled by U-Boot, the Linux kernel must either:
- Periodically reset the watchdog timer during boot and runtime, or
- Disable the watchdog timer once the kernel is up and running.
Since the WDT was software-activated, it can also be cleanly disabled by the Linux kernel.
Documentation Reference- Watchdog Register Map: Refer to the Watchdog Timer chapter in the [NUC980 Technical Reference Manual (TRM)].
- WDT Control in U-Boot: Refer to U-Boot driver source linked above.
If you need help with modifying the timeout behavior or integrating WDT into your Linux application, please let us know.
欢迎光临 牛卧堂MCU技术交流 (http://www.nuvoton-mcu.com/) |
Powered by Discuz! X3.2 |