I am using atmega 128 for a smart vehicle tracker. I am trying to use watchdog timer for this controller.But problem is that I have found the maximum watchdog reset time is 2 seconds. I need watchdog reset time 8 seconds. Now what can I do ?
Run it 4 times to get 8 seconds.– GerbenSep 12, 2018 at 10:02
Any other way ??– Iqbal HossainSep 12, 2018 at 10:30
Sorry. I assumed you used the watchdog to wake up the MCU after sleep. Apparently the 128 doesn't even support that. The only option would be to change your code, so wdt_reset gets called more often and make sure there are no delays/waits/timeouts longer than 2 seconds. 2 seconds is quite a long time for a processor. What's your code doing that it requires more than 2 seconds?– GerbenSep 13, 2018 at 9:22
There is no way you can make the Watchdog timer longer on Atmega 128. It is max 1.8 sec if you set all 3 bits of Timer Prescaler.
For Atmega 328 the max watchdog time is 8 sec and longer time can be achieved using watchdog interrupt and count up (or down) until you want a reset and then force the reset by setting the shortest watchdog timer.
Atmega 128 doesn't support watchdog interrupt, so the trick with interrupt can't be used.