Skip to content

Instantly share code, notes, and snippets.

@MabezDev
Created September 14, 2019 15:32
Show Gist options
  • Save MabezDev/122254f1a8f9097b00e107e3729c53a3 to your computer and use it in GitHub Desktop.
Save MabezDev/122254f1a8f9097b00e107e3729c53a3 to your computer and use it in GitHub Desktop.
/// Feed the WDT watchdog
pub fn feed_wdt() {
const RTC_WDT_BASE: u32 = 0x3ff48000;
const RTC_WDT_WPROTECT: u32 = RTC_WDT_BASE + 0xa4;
const RTC_WDT_FEED: u32 = RTC_WDT_BASE + 0xa0;
unsafe {
core::ptr::write_volatile(RTC_WDT_WPROTECT as *mut _, 0); // disable write protection
{
core::ptr::write_volatile(RTC_WDT_FEED as *mut _, 0x1); // feed the watch dog
}
core::ptr::write_volatile(RTC_WDT_WPROTECT as *mut _, 1); // enable write protection
}
}
@lockness-Ko
Copy link

How did you get the values for the address?

@MabezDev
Copy link
Author

MabezDev commented Feb 3, 2024

The reference manual. This was just used for demo purposes a full implementation for all drivers, including TIMG0, can be found in esp-hal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment