Nano Every wdt.h Issue

I’ve run into a bit of an issue trying to run the watchdog library on the new Nano Every board, when i try to enable the watchdog function via wdt_enable(WDTO_4S); i get an error saying WDTO_4S wasn’t declared.

After a bit of looking into it i found the library and saw the list of ‘Available controllers’ in the library, and am unsure if i should try to work around the declaration issue by defining WDTO_4S in my sketch (essentially just copy/pasting the define line in the header file into my sketch), or if i should find another way to do this.

Any help is greatly appreciated, thanks!

did you try the ATmega328p compatibility in Tools menu?

i did, i defaulted to leaving it on because i'm replacing an older nano v3, after discovering the problem i tried both with the register emulation on and off, both seem to give the same result on my end.

ATmega328p emulation won't help here, it handles only PORTx, DDRx and PINx registers.

oqibidipo:
ATmega328p emulation won't help here, it handles only PORTx, DDRx and PINx registers.

so? no library? we can only set the registers?

I plan to migrated a project from 328p to Nano Every, including watchdog.
I read the 4809 datasheet and the register is simple. I expected a mapping in compatibility mode.
(and I was disappointed by lack of wdt interrupt support)

Try

  wdt_enable(WDT_PERIOD_4KCLK_gc);

oqibidipo:
Try

  wdt_enable(WDT_PERIOD_4KCLK_gc);

It seems to compile with no problems, I've yet to properly test it though, will post when i have some results.

weirdwolf:
It seems to compile with no problems, I've yet to properly test it though, will post when i have some results.

it works

It does indeed seem to work without a problem, i did run into another issue after getting it working, but i believe it to be unrelated, so i'll take that one elsewhere.

Thanks for the help!