1
\$\begingroup\$

In Arduino Mega (ATMEGA2560), when I enabled the interrupts, the watchdog got overflown, so the chip restarted each time the program counter achieved the interrupt enabling line.

So I tried to disable the watchdog, setting WDTCSR_WDCE to 1 and WDTCSR_WDE to 1, and after setting all WDTCSR to 0.

But when I did this, I realized that my reset pin does not work anymore. Now when I click on it, simply does not happen anything, and I cannot load a new .hex to the chip.

I burnt the bootloader again using ICSP, but the problem still happens.

Thus, how can I fix it?

\$\endgroup\$
0

2 Answers 2

1
\$\begingroup\$

My experience is there was 2560 bootloader provided on Arduinos (at least 2-3 years ago). Watchdog is not disabled in bootloader and because watchdog timer is not reset on non power-cycle reboot then watchdog reboot causes forever rebooting in bootloader because of timeout waiting for potential upload. You can prove it that main program starts after power cycle but not when watchdog forces reboot.

Fix was uploading non bugged bootloader.

\$\endgroup\$
0
\$\begingroup\$

One Arduino Mega there are 2 MCUs. Which one's fuses did you change? Which one did you program with ICSP?

Try reverting things back to defaults; flash the small MCU (USB side) and program its fuses correctly. Check the fuses of AtMega2560 and revert them to defaults as well. Be careful as programming fuses wrongly can brick an MCU and then you need high voltage programming to revive them.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.