Reset via Watchdog for ATMega 4809

Hi there,

after some exhaustive googling I found out that the standard Arduino watchdog library is not working as intended on the ATMega4809 due to missing .

Does anybody have implemented a similar functionality for resetting the WiFi Rev 2 after x seconds of inactivity in the meantime and could give me a hint how to do it?

Thanks a bunch!!

… and yes, I know that I should have code that does not need this. Let’s just assume that I have exhausted that route :slight_smile:

void watchdogSetup() {
#ifdef ARDUINO_ARCH_MEGAAVR
  if (RSTCTRL.RSTFR & RSTCTRL_WDRF_bm) {
    Serial.println(F("It was a watchdog reset."));
  }
  RSTCTRL.RSTFR |= RSTCTRL_WDRF_bm ;
  wdt_enable(WDT_PERIOD_8KCLK_gc);
#endif
}

#include <avr/wdt.h> and wdt_reset() works

Thanks for the quick reply! Integrated and tested: works.

Just want to say thanks to juraj ! the code working well on my side too, this code save me a lot of time, because i was trying to setup a watchdog too!