Offline
Newbie
Karma: 0
Posts: 14
|
 |
« on: December 07, 2012, 04:37:07 pm » |
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
Shannon Member
Karma: 118
Posts: 10164
|
 |
« Reply #1 on: December 08, 2012, 06:39:19 pm » |
Uploading what?
|
|
|
|
|
Logged
|
|
|
|
|
USA, OH
Offline
Jr. Member
Karma: 0
Posts: 54
|
 |
« Reply #2 on: December 09, 2012, 04:16:59 am » |
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  BTW, Ard DUE is even worse.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #3 on: December 09, 2012, 11:01:21 am » |
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
Jr. Member
Karma: 0
Posts: 54
|
 |
« Reply #4 on: December 09, 2012, 12:11:34 pm » |
Interesting. What exactly 3 characters? Any link to more detailed info on this?
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15316
Measurement changes behavior
|
 |
« Reply #5 on: December 09, 2012, 12:34:47 pm » |
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
Sr. Member
Karma: 11
Posts: 393
|
 |
« Reply #6 on: December 10, 2012, 01:53:33 am » |
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
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13897
Lua rocks!
|
 |
« Reply #7 on: December 10, 2012, 03:52:14 am » |
if it sees three !!! characters in a row ... What exactly 3 characters? Three !!! characters. Wasn't that part clear?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13897
Lua rocks!
|
 |
« Reply #8 on: December 10, 2012, 03:53:00 am » |
I'm sorry if I seemed a bit short. I meant, the character '!', three times. As in: !!!
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13897
Lua rocks!
|
 |
« Reply #9 on: December 10, 2012, 03:55:34 am » |
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: void setup(){ Serial.begin(9600); }
void loop(){ Serial.println("Hello world"); delay(1000); }
It commences executing immediately.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13897
Lua rocks!
|
 |
« Reply #11 on: December 10, 2012, 04:05:45 am » |
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
Sr. Member
Karma: 11
Posts: 393
|
 |
« Reply #12 on: December 10, 2012, 07:05:01 am » |
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
|
|
|
|
|
Offline
Sr. Member
Karma: 11
Posts: 393
|
 |
« Reply #13 on: December 10, 2012, 07:06:41 am » |
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
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 218
Posts: 13897
Lua rocks!
|
 |
« Reply #14 on: December 10, 2012, 02:35:15 pm » |
My test was on 1.0.1 and Mac OS/X.
|
|
|
|
|
Logged
|
|
|
|
|
|