I am getting a hang on the upload on a sketch that is 32,180 long.
If I comment out some code and get it back down to 32,132 it loads fine.
I have installed a function to report free SRAM and it says I have over 5k available.
The only way I have found to clear the hangup is to unplug the usb. This gives a timeout
error in the error window which I expect. No error reported until I pull the plug--just stops. Status led flashes normally until it hangs with the led either on or off.
I have tried two different XP machines and they both do the same.
I haven't tried the beta arduino ide.
Also, I don't know what bootloader is on the 2560.
Using Arduino 1.0.3
Any ideas how I should troubleshoot this ? Thanks
Make sure none of the strings in your sketch contain '!!!'. Some Arduino MEGA bootloaders use that as a signal to go into 'monitor mode' where they take commands from Serial Monitor to read and write memory. This causes a hang on upload.
Thanks, but I saw that when searching for what was causing it.
Seems strictly related to size of sketch. I can put in a few lines of Serial.print("xxxxx" ); and cause it
to hang. Whenever the sketch size goes over approximately 32,132 in hangs. My project still works as I can keep it under that for now, but have bigger plans in the future for this thing. I was looking for a way to test the program memory on the Ardunio, but didn't find a sketch to do that. I was wondering if it is getting a memory error on the load and stopping. I am assuming that the loader somehow verifies the data during the load process.
Next thing to do is to turn on verbose upload logging. Then you will see the step that hangs.
Well, Never assume anything I guess. I assumed that I didn't have any !!'s in my sketch and since it always loaded fine until I got to around 32,130+ bytes . Just too be sure I did a search this morning and in fact there were a couple of !! in a comment I had made to myself. Why it loads fine until the size hits a certain threshold seems a little weird, but oh well. Anyhow, I took them out and added some dummy code to get the size up and it loads fine now. Is this a ide or bootloader "Feature" that causes the hang.
Thanks for the feedback.
Good to see you got it fixed, but I think the issue related to 3 x ! i.e. !!! and not 2 x ! or !! which you appear to have had in your sketch.
Below is the actual comment I had made to myself. Since the code was commented out a while back I can't remember what I was doing on at the time. I have uploaded many times without problems with the !!!!!!!!'s comment and the code was block commented out too. It only presented a problem when the program crossed the size I mentioned earlier. At this point I am happy to just go with it as I don't have the problem after getting rid of the statements I was no longer using anyhow.
eedata = highByte(pointer1); // These two commands don't change the data in eedata and eedata
eedata = lowByte(pointer1); // What the Hell am I doing wrong!!!!!!!!