這是用戶在 2024-5-28 15:38 為 https://support.augentix.com/projects/sdk-r3-x/wiki/User-guide-r3-x-How_to_enable_Watchdog_service 保存的雙語快照頁面,由 沉浸式翻譯 提供雙語支持。了解如何保存?

Project

General

Profile

New wiki page Edit Watch Rename History
新維基頁面 編輯 監視 重新命名 歷史

How to Enable Watchdog Service
如何啟用看門狗服務


Confidentiality Notice 保密通知

Copyright © Augentix Inc. 2014-2025. All rights reserved.
版權所有 © Augentix Inc. 2014-2025。保留所有權利。

The contents of this document are proprietary and confidential information of Augentix Inc.
本文件的內容是 Augentix Inc.的專有和機密信息。

No part of this document may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of Augentix.
本文件的任何部分均不得在未经 Augentix 事先书面许可的情况下以任何形式或任何方式重印、分发或传播,包括复印、录音或其他电子或机械方法。


Brief 簡要

Watchdog timer (WDT) allows system to reset the system if serious system failure occurs.
看門狗計時器(WDT)允許系統在發生嚴重系統故障時重置系統。

This include but not limited to the following failures:
這包括但不限於以下故障:
  • An active interrupt is unhandled
    主動中斷未處理
  • Deadlock occurs in kernel space
    死結發生在核心空間
  • Critical system failure (kernel panic, corrupted critical code section, etc.)
    系統嚴重故障(核心恐慌、關鍵代碼部分損壞等)。

To keep the WDT running and not resetting the system, a watchdog daemon needs to frequently "pat" the watchdog to reset its countdown timer.
為了讓 WDT 保持運作並避免重置系統,看門狗守護程序需要經常「輕拍」看門狗以重置其倒數計時器。

If the system hangs, the watchdog daemon hangs, causing timeout of WDT engine, which resets the system.
如果系統掛起,看門狗守護程序也會掛起,導致 WDT 引擎超時,進而重置系統。

SDK user can enable watchdog timer in either U-Boot or in Linux.
SDK 用戶可以在 U-Boot 或 Linux 中啟用看門狗計時器。


Enabling Watchdog Service in U-Boot
在 U-Boot 中啟用看門狗服務

Note: User must enable watchdog service in Linux if watchdog is triggered in U-Boot.
請注意:如果在 U-Boot 中觸發了看門狗,用戶必須在 Linux 中啟用看門狗服務。
  1. In $SDK_DIR/bootloader/uboot/include/configs/<product>.h, add a new define macro CONFIG_HW_WATCHDOG:
    在 $SDK_DIR/bootloader/uboot/include/configs/<product>.h 中,添加一個新的定義宏 CONFIG_HW_WATCHDOG:

    #define CONFIG_HW_WATCHDOG

    After this configuration is enabled, WDT reset (pat) function is called in certain functions, so that watchdog timer will be reset constantly unless the system hangs.
    啟用此配置後,在某些功能中將調用 WDT 重置(pat)功能,因此看門狗計時器將不斷重置,除非系統掛起。

Enabling Watchdog Service in Linux
在 Linux 中啟用看門狗服務

Enabling Watchdog Driver 啟用看門狗驅動程序

Watchdog config CONFIG_HC1703_1732_1753_1783S_WATCHDOG is normally enabled in all HC1703, HC1723, HC1753 and HC1783s products.
看門狗配置 CONFIG_HC1703_1732_1753_1783S_WATCHDOG 通常在所有 HC1703、HC1723、HC1753 和 HC1783 產品中啟用。

User should only check whether this configuration is enabled in kernel config.
用戶應僅檢查此配置是否在內核配置中啟用。

Enabling Watchdog Service (Busybox)
啟用看門狗服務(Busybox)

CONFIG_WATCHDOG is to be enabled in Busybox menuconfig.
CONFIG_WATCHDOG 需要在 Busybox menuconfig 中啟用。

It will generates watchdog daemon in target rootfilesystem.
它將在目標根檔案系統中生成 watchdog 個守護程序。

Please refer to Busybox manual for usage.
請參考 Busybox 手冊以了解使用方法。

Enabling Watchdog Service (Augentix)
啟用看門狗服務(Augentix)

In Augentix SDK, a reference watchdog daemon watchd is provided to demonstrate control of watchdog device.
在 Augentix SDK 中,提供了一個參考看門狗守護程序 watchd ,用於演示對看門狗設備的控制。

To enable it:  啟用它:
  1. In $SDK_DIR/application/configs/<product>_defconfig, Enable the following option:
    在 $SDK_DIR/application/configs/<product>_defconfig 中啟用以下選項:

    CONFIG_APP_WATCHDOG=y
  2. User can decide whether to enable watchd service at boot time.
    用戶可以決定是否在開機時啟用 watchd 服務。

    In $SDK_DIR/fs/rootfs/scripts/<chip>/<product>.list, add S00watchd in [core] section:
    在 $SDK_DIR/fs/rootfs/scripts//.list 中,在 [core] 部分添加 S00watchd:

    [core]
    ...
    S00watchd
    ...

Enabling Watchdog Tick Log
啟用看門狗滴答日誌

In some cases, users might want to know if the watchdog correctly ticked for problem analysis.
在某些情況下,用戶可能想知道看門狗是否正確地進行了問題分析。

Since r3.16.0-rc9, the watchdog driver provides a switch to enable log printing on tick events. ---
自 r3.16.0-rc9 版本開始,看門狗驅動程序提供了一個開關,可以在時鐘事件上啟用日誌打印。

Setting uboot environment variable "wdt_log" as 1, enables printing tick log:
將 uboot 環境變量"wdt_log"設置為 1,啟用打印 tick 日誌:

[AGTX_WDT] ticked

Users can manipulate the "wdt_log" by commands, for example
用戶可以通過命令來操作“wdt_log”,例如

[root@Augentix:~]# fw_setenv wdt_log 0 //set wdt_log as 0
[root@Augentix:~]# fw_printenv wdt_log
wdt_log=0
[root@Augentix:~]# fw_setenv wdt_log 1 //set wdt_log as 1
[root@Augentix:~]# fw_printenv wdt_log
wdt_log=1

After reboot, The configuration applies to the watchdog driver.
重新啟動後,配置應用於看門狗驅動程序。


Using Watchdog 使用看門狗

Augentix watchdog driver implements partial of Linux Watchdog API:
Augentix 看門狗驅動程式實現了 Linux 看門狗 API 的部分功能:
  • Watchdog API:  看門狗 API:
    • SETTIMEOUT 設置超時
    • KEEPALIVE 保持連線
  • Sysfs  系統檔案系統
    • Trigger / ping 觸發 / ping
    • Magic close feature 魔法關閉功能

User should refer to Kernel Documentation for detailed usage:
用戶應參考內核文檔以獲取詳細使用說明:

https://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt

Also available in: PDF HTML TXT
也可用於:PDF HTML TXT