Pages: [1] 2   Go Down
Author Topic: Mega 2560 randomly hanging  (Read 1646 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My Arduino Mega 2560 is randomly hanging while I try to upload. One the same program is uploaded without any glitches. Other times it just hangs. If I press the upload button again I am getting the error saying the the COM5 port is already in use. I either have to remove the USB and plug it in again(sometimes even this doesn't work I have to restart the PC). Then again it works fine .
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 178
Posts: 12291
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Uploading what?
Logged

USA, OH
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Obviously, uploading a sketch.
I also have multiple issues like that.
I have a feeling there is some 'gray area' somehow related to MEGA bootloader.
Sketch is complicated enough, with Adafruit datalogger shioeld, LCD shield and QuadRAM shield.
It might be working perfectly well for days, than something happens and you cannot upload anymore.
Sometimes uploading another  simple sketch helps, sometimes it does not.
My common impression is that Arduino MEGA 2560 is very unstable board, hardly useful for anything more complicated than blinking LEDs smiley-sad
BTW, Ard DUE is even  worse.


Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 16568
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The arduino mega boards use a bootloader that has a 'special but never used' feature that if it sees three !!! characters in a row in the data being sent to the board during a upload operation, the bootloader enters a 'monitor' mode waiting for user commands from the PC that will never come. So while it may not be your problem specifically, but it has trapped a lot of other people, so check to see if you have any !!! strings in the sketch code and change them.

Lefty
« Last Edit: December 09, 2012, 11:02:55 am by retrolefty » Logged

USA, OH
Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Interesting. What exactly 3 characters? Any link to more detailed info on this?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 332
Posts: 16568
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Interesting. What exactly 3 characters? Any link to more detailed info on this?

The ! ASCII character, as in 0x21. So three 0x21 bytes sent in a row anywhere in the upload data stream locks up the bootloader waiting for user monitor commands from the PC which will never come. As far as more detailed info, there has been a lot posted in the forum over the years sense the original mega1280 board was released, but I'm not aware of any 'official' document posted on the arduino web site. There is mostly likely a old and mouldy bug report in the arduino developers bug reporting archive list wherever one finds that.

The source code for the mega bootloader is included in the IDE software distribution if you want to seek it out and read about this wonderful feature included in the mega bootloader code.

Lefty
« Last Edit: December 09, 2012, 12:39:25 pm by retrolefty » Logged

Offline Offline
God Member
*****
Karma: 21
Posts: 650
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The ! ASCII character, as in 0x21. So three 0x21 bytes sent in a row anywhere in the upload data stream locks up the bootloader waiting for user monitor commands from the PC which will never come.

Just as an update, the _latest_ Mega2560 bootloader is supposed to have fixed this particular problem. But that is no use to you if have a Mega with the old bootloader installed (unless you want to reflash the bootloader with the newer one.)

However, the latest version seems to have some new issues of  its own. Refer this thread:

http://arduino.cc/forum/index.php/topic,136233.0.html

 
« Last Edit: December 10, 2012, 01:55:49 am by pico » Logged

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
if it sees three !!! characters in a row

...

Quote
What exactly 3 characters?

Three !!! characters. Wasn't that part clear?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm sorry if I seemed a bit short. I meant, the character '!', three times. As in: !!!
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the latest bootloader for the Mega2560, the one that fixes the watchdog problems. It also does not have the problems reported in the above thread. Running the test sketch:

Code:
void setup(){
  Serial.begin(9600);
}

void loop(){
  Serial.println("Hello world");
  delay(1000);
}

It commences executing immediately.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This file, I think:

https://github.com/arduino/Arduino-stk500v2-bootloader/blob/master/goodHexFiles/stk500boot_v2_mega2560.hex

Just confirmed it handles the "!!!" problem, it doesn't have a watchdog timer issue, and it doesn't have the problem with the 10-second wait. So, good to go!
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

However, the latest version seems to have some new issues of  its own. Refer this thread:

That thread doesn't actually say he has "the latest version".
Logged

Offline Offline
God Member
*****
Karma: 21
Posts: 650
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That thread doesn't actually say he has "the latest version".

No, but I do have the latest version of the bootloader, and can report the problem occurs for that version interacting with IDE version 1.0.2 under Win XP sp 3.
« Last Edit: December 10, 2012, 07:11:39 am by pico » Logged

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

Offline Offline
God Member
*****
Karma: 21
Posts: 650
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

and it doesn't have the problem with the 10-second wait. So, good to go!

Which version of OS and IDE are you using to test the bootloader interaction with?
Logged

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My test was on 1.0.1 and Mac OS/X.
Logged

Pages: [1] 2   Go Up
Jump to: