Hey I was wondering what the correct way to use the watchdog timer on a mega2560? I tried the normal way for say an uno and after finding out that it works, I also found out that the mega2560 has a bug where the wdt time defaults and it eternally resets I want to use it but, I guess the normal way is not an option for the mega?
I also found out that the mega2560 has a bug
What do you think that bug is?
where the wdt time defaults
Defaults to what?
and it eternally resets
So, set the timeout to some other value.
Can you provide code that demonstrates the bug? For example, a sketch which configures the WDT correctly as you understand it but produces incorrect behaviour?
This is the exact webiste I got the code from http://tushev.org/articles/electronics/48-arduino-and-watchdog-timer I set the timeout to be 2 seconds and added various timer, like before during and after my sd writes, just to be safe however when I uploaded it defaulted somehow, a bug that I saw after it happened and I researched more, the only indicator being the led constantly lit as the bootloader constantly runs and resets
And the default wdt time I believe is like 200ms, which is not long enough for ,the bootloader so my mega was basically bricked, until I was able to catch it at just the right time to upload a new program without it, which required alot of time and luck, and I really don't wanna have to get lucky twice
When you say it "defaults" I think you mean the timer isn't reset. Some bootloaders do and others don't. Unless you find a bootloader that turns off the watchdog timer, I would use a larger interval.
But if I have it set for two seconds isn't that plenty of time for the bootloader? It doesn't take more than a second on a reular sketch
I haven't timed it, but on my one at least it starts by printing something (stkv2 maybe) to the serial port, waiting a bit, and then getting on with it. That might be a second or two.