diff --git a/esp-hal/src/timer/timg.rs b/esp-hal/src/timer/timg.rs index 80ee4400f75..d83877d9ed1 100644 --- a/esp-hal/src/timer/timg.rs +++ b/esp-hal/src/timer/timg.rs @@ -983,18 +983,18 @@ where if !enabled { reg_block.wdtconfig0().write(|w| unsafe { w.bits(0) }); } else { + reg_block.wdtconfig0().write(|w| w.wdt_en().bit(true)); + reg_block .wdtconfig0() .write(|w| w.wdt_flashboot_mod_en().bit(false)); - reg_block.wdtconfig0().write(|w| w.wdt_en().bit(true)); - #[cfg_attr(esp32, allow(unused_unsafe))] reg_block.wdtconfig0().write(|w| unsafe { w.wdt_en() .bit(true) .wdt_stg0() - .bits(MwdtStageAction::Off as u8) + .bits(MwdtStageAction::ResetSystem as u8) .wdt_cpu_reset_length() .bits(7) .wdt_sys_reset_length() diff --git a/examples/src/bin/rtc_watchdog.rs b/examples/src/bin/rtc_watchdog.rs index 3a232e1f4b7..e28cec9fe57 100644 --- a/examples/src/bin/rtc_watchdog.rs +++ b/examples/src/bin/rtc_watchdog.rs @@ -30,7 +30,7 @@ fn main() -> ! { rtc.set_interrupt_handler(interrupt_handler); rtc.rwdt.enable(); - rtc.rwdt.set_timeout(0, 2000.millis()).unwrap(); + rtc.rwdt.set_timeout(0, 2.secs()).unwrap(); rtc.rwdt.listen(); critical_section::with(|cs| RWDT.borrow_ref_mut(cs).replace(rtc.rwdt)); @@ -49,7 +49,7 @@ fn interrupt_handler() { println!("Restarting in 5 seconds..."); - rwdt.set_timeout(0, 5000.millis()).unwrap(); + rwdt.set_timeout(0, 5.secs()).unwrap(); rwdt.unlisten(); }); }