stm32 own build-in watchdog #1339

only:mre_f4
This commit is contained in:
rusefillc 2023-12-14 10:54:21 -05:00
parent 7d425e41c1
commit 6e945f60b6
2 changed files with 4 additions and 0 deletions

View File

@ -252,6 +252,8 @@ void initializeConsole() {
addConsoleAction("hard_fault", testHardFault);
addConsoleAction("threadsinfo", cmd_threads);
#if HAL_USE_WDG
addConsoleActionI("set_watchdog_timeout", startWatchdog);
addConsoleActionI("set_watchdog_reset", setWatchdogResetPeriod);
#endif
}

View File

@ -109,6 +109,7 @@ void startWatchdog(int timeoutMs) {
static WDGConfig wdgcfg;
wdgcfg.pr = STM32_IWDG_PR_64; // t = (1/32768) * 64 = ~2 ms
wdgcfg.rlr = STM32_IWDG_RL((uint32_t)((32.768f / 64.0f) * timeoutMs));
efiPrintf("[wdgStart]");
wdgStart(&WDGD1, &wdgcfg);
#endif // HAL_USE_WDG
}
@ -116,6 +117,7 @@ void startWatchdog(int timeoutMs) {
static efitimems_t watchdogResetPeriodMs = 0;
void setWatchdogResetPeriod(int resetMs) {
efiPrintf("[dev] wd %d", resetMs);
watchdogResetPeriodMs = (efitimems_t)resetMs;
}