4 Watchdog;相关

4.1 Watchdog;WDT在Standby后的State;


alt text

如上Code;,The current SDK keeps the watchdog powered on after entering standby, but the code will stop the wdt. No matter how long it sleeps, the watchdog will not trigger a reset;。
When resuming from standby, the “resume” case will be executed, reinitializing the wdt, which is equivalent to restarting the counting;。

4.2 JlinkClose;看WDT的Method;

1,Scenario;1,If both Hcpu and Lcpu have enabled the watchdog and the machine repeatedly restarts, making it impossible to dump memory for problem diagnosis, you can use jlink to disable the watchdog;, Execute;:

tools\segger\halt_all_cpu_and_disable_all_wdt_a0.bat

This will disable the WDT of hcpu and lcpu and halt both cpus, facilitating memory dumping;。
2,Scenario;2:If you only want to disable the log of Hcpu and let Hcpu continue running;
Modify;:halt_all_cpu_and_disable_all_wdt_a0.bat对应的halt_all_cpu_and_disable_all_wdt_a0.jlink中Command;Content;,如下:

connect #Connect;jlink
w4 0x4004f000 0 #jlink切到Hcpu
connect #Connect;jlink
h #halt hcpu
w4  0x40014018  0x51ff8621
w4  0x4001400C  0x34
w4  0x40014018  0x58ab99fc
w4  0x4007c018  0x51ff8621
w4  0x4007c00C  0x34
w4  0x4007c018  0x58ab99fc
g #上Surface;Operation;完WDTRegister;后,go,Continue;Run;Hcpu
exit

3,Scenario;3:If you only want to disable the log of Lcpu and let Lcpu continue running;,截取halt_all_cpu_and_disable_all_wdt_a0.jlink中Command;一Part;并稍加Modify;即可。

connect
w4 0x4004f000 1
connect
w4 0x40070000 0 
h
w4  0x40055018  0x51ff8621
w4  0x4005500C  0x34
w4  0x40055018  0x58ab99fc
g
exit

4.3 清WDTLocation;在哪

1,The rt_hw_watchdog_init initialization function registers rt_hw_watchdog_pet as a hook function via rt_hw_watchdog_hook;;
2,When the system enters the idle thread rt_thread_idle_entry due to no tasks being processed, the hook functions registered in the idle_hook_list will be executed;;

__ROM_USED void rt_hw_watchdog_init(void)
{
    extern int rt_wdt_init(void);
    rt_wdt_init();
    wdt_dev = rt_device_find("wdt");
    if (wdt_dev)
    {
        rt_err_t err = rt_device_open(wdt_dev, RT_DEVICE_FLAG_RDWR);
        if (err == RT_EOK)
        {
            uint32_t count = WDT_TIMEOUT;
            rt_device_control(wdt_dev, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, &count);
        }
    }
    rt_hw_watchdog_hook(1); //After registering the wdt hook function, the watchdog will be automatically cleared in the idle thread;
}

__ROM_USED void rt_hw_watchdog_pet(void) //Manual watchdog-clearing function, this function can be called;
{
    if (wdt_dev)
    {
        rt_device_control(wdt_dev, RT_DEVICE_CTRL_WDT_KEEPALIVE, NULL);
    }
}