Go Down

Topic: Arduino Mega Suddenly Not Programmable Anymore on Win7 But Still Works with Mac (Read 1 time) previous topic - next topic

BM8000

I have a strange problem with my Mega 2560. It used to work fine with my Win7 set-up for weeks of programing and testing. Then one day, I changed one code line in my sketch, and after that I was not able to upload it anymore. The Mega still shows up as a device on the computer. I re-installed the driver but to no avail. It compiles and then gets stuck indefinitely while 'uploading'.

Now the strange part: I connected a spare (i.e. different) Mega 2560 to my Win7 machine (showing up on a different com port, on 6 instead of 5) and everything worked fine. My sketch uploaded as usual. Then I connected the initial (problematic) board to my MacBook. The Mac was able to upload my sketch w/o trouble!! This probably means the Mega is o.k..

I am at a loss right now what to do, since both the Win7 machine and the problematic Mega board seem to be o.k individually, but when connecting the two, it does not work. What else can one check on the computer? The driver seems to work etc...
Any input would be greatly appreciated! Thanks much in advance!

el_supremo

Quote
I changed one code line in my sketch

What was it and what did you change it to?

Quote
It compiles and then gets stuck indefinitely while 'uploading'

I had a weird problem like that quite a while ago. It turned out that I had a very long comment at the end of the sketch which contained all sorts of notes to myself and code fragments that I was keeping for reference. When I removed that comment the sketch uploaded with no problem.

Another shot from the hip is, do you have a lot of string constants in your code? E.g. like this:
Code: [Select]
Serial.print("Lots and lots of these?");
If so, you might have run out of SRAM and need to change statements like that to:
Code: [Select]
Serial.print(F("Lots and lots of these?"));
which puts the string in flash ram.

Pete




BM8000

Thanks much for your quick reply. All I did was to uncomment a command that I had commented out for trouble shooting. In other words I reverted the code to a state that previously uploaded w/o trouble. Also, consider that the troubled board worked fine with my Mac and the same code, suggesting that the board and the code are actually o.k....I have a bunch of Serial.prints in there, but I did not add any before the phenomenon started. Thanks!

James C4S


I have a bunch of Serial.prints in there, but I did not add any before the phenomenon started. Thanks!


OSX and Win7 implement their USB stacks very differently.  It could be that you're flooding some buffer on win7.  Try programming a simple "blink" sketch to the board from the Mac, and then see if win7 works.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

BM8000

I do not think this is the issue, since it worked with a second Mega on Win7...also the identical code worked on the troubled Mega before commenting out and in my command. Thanks for your consideration!

James C4S

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Louis Davis

Are the Mega's the same revision and same version of bootloader?

BM8000

Point taken, James C4S ;). Blink does not work either. The two Megas are identical. Purchased at the same time from Newark. In the meantime, I was able to fix my sketch via the Mac, and then run it on the troubled Mega. The sketch involves talking to LabVIEW on my Win7 machine via USB. This works perfectly, no issues at all...It seems everybody is happy with this Mega, except the Windows Arduino 1.0 IDE. I probably should have never 'upgraded'...only headache since leaving 0022 behind!!


Go Up