Hello I have to use a Attiny1614 watchdog, but I haven't found a suitable library anywhere (probably because the chip is new). I have to wake Attiny a second after I put him to deep sleep.
why you think library is needed? is it very hard to write wdt_enable();
?
here is link to datasheet
wake-up can be made from RTC. Is it mean without watchdog at all?
In this case, watchdog wakes up the MCU in 500ms, not in 2 seconds.
#include <avr/wdt.h>
#include <avr/sleep.h>
void setup()
{
wdt_enable(WDTO_2S); // it is not so hard to write :]
}
void loop()
{
//wdt_reset();
//do something for a while...
if(millis() >= 100){
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_cpu();
}
}
If I change wdt_enable(WDTO_2S); to wdt_enable(WDTO_4S); or wdt_enable(WDTO_8S);
'WDTO_8S' was not declared in this scope
'WDTO_4S' was not declared in this scope
If I choose for a board "Arduino Nano", the sketch is compiled successfully
that's why I think library is needed.
Solution:
Replace: wdt_enable(WDTO_2S);
with: _PROTECTED_WRITE(WDT.CTRLA,0x9); // for 2sec
////////////////////////////////////////////////////////////////
0x0 OFF -
0x1 8CLK 0.008s
0x2 16CLK 0.016s
0x3 32CLK 0.031s
0x4 64CLK 0.063s
0x5 128CLK 0.125s
0x6 256CLK 0.25s
0x7 512CLK 0.5s
0x8 1KCLK 1s
0x9 2KCLK 2s
0xA 4KCLK 4s
0xB 8KCLK 8s
other - Reserved
////////////////////////////////////////////////////////////////
Thank you.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.