Edit online

测试指南

Read time: 1 minute(s)
Edit online

准备测试环境

Read time: 1 minute(s)
Watchdog 测试所需的测试环境如下:
  • 硬件:开发板
  • 软件
    • PC 端的串口终端软件,用于 PC 和开发板进行串口通信
    • Luban-Lite 中打开 Watchdog 模块和 test_wdt 功能

Edit online

测试 Watchdog 复位功能

Read time: 1 minute(s)
  1. 连接开发板和 PC。
  2. 按下开发板上的复位按钮或断开电源再重新上电来重启开发板。
  3. 使用 reboot 命令验证 Watchdog 的复位功能。
    WDT 驱动注册了一个 reboot 命令,可实现系统的复位,此命令可用来验证 WDT 的复位功能。 在串口终端中输入以下命令:
    reboot
    
    系统输出示例如下:
    01-01 08:05:22 I/WDT: Restarting system ...
    
    Pre-Boot Program ... (2023-03-02 14:20:30)
    Going to init DDR2. freq: 504MHz, size: 64MB.
    DDR2 initialized
    PBP done
    
    U-Boot SPL 2021.10-00008-g13511a4f-dirty (Apr 172023 - 13:25:13 +0800)
Edit online

测试 Watchdog 的综合功能

Read time: 1 minute(s)
WDT 注册了一个 test_wdt 命令,用于测试 WDT 的其它功能,比如喂狗,预处理等。以下为具体的使用示例:
  1. 设置 timeout 为 3 秒并开启看门狗:
    test_wdt -s 3

    结果:系统会在 3 秒后重启。

  2. 设置 pretimeout 为 3 秒并开启超时中断:
    test_wdt -p 3
    

    结果:3 秒后触发超时中断。

  3. 设置清除窗口为 3 秒:
    test_wdt -c 3
    

    结果:计数到 3 秒之后才能“喂狗”。

  4. 获取当前的 timeout:
    test_wdt -g
    

    结果:返回当前的 timeout 值。

  5. 开启喂狗功能 (空闲钩子):
    test_wdt -k
    

    结果:开启喂狗功能,防止系统因长时间未操作而重启。