Loading...
Pages: [1]   Go Down
Author Topic: Arduino Mega ADK (ATmega2560): Software Reset  (Read 507 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I need to reset my Arduino Mega ADK (based on ATmega2560) through software. A soft-reset (jumping to address 0) is not sufficient. I learned that I need to use the watchdog timer for this purpose:

Code:
wdt_enable(WDTO_8S);

This works fine, but once the board resets, it goes into a reset cycle until I power cycle it.

Therefore I added the following code to disable the watchdog timer after reboot:

Code:
void fetch_and_clear_mcusr (void) __attribute__((naked)) __attribute__((section(".init3")));
void fetch_and_clear_mcusr (void)
{
  mcusr_mirror = MCUSR;
  MCUSR = 0x0;
  wdt_disable ();
}

However, this does not work. It keeps resetting itself after the initial watchdog timer reset.

Can anyone help me? Any help is greatly appreciated.

Many thanks in advance,
Michael
Logged

Offline Offline
Newbie
*
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyone, please? :-/
Logged

0
Offline Offline
Newbie
*
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I'm having the same problem. After a lot of reading the problem seems to be in the bootloader.
Flashing the latest version included with arduino 1.0 doesn't solve the problem, at least with the atmega2560.

You can find more info here.... http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1255016475/1
Logged

0
Offline Offline
Newbie
*
Posts: 16
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Daneel,
I just update the bootloader with this checkin http://code.google.com/p/arduino/issues/detail?id=181
It's works!!
Logged

Pages: [1]   Go Up
Print
 
Jump to: