IDE hangs on "uploading" - out of the blue

I had been making tiny changes to a sketch that writes to a display screen for about 6-7 hours today, then randomly when I hit upload, the process took a very long time.

I waited and waited, then eventually pulled the USB plug and restarted IDE (1.6.3).

Restarted Windows, same problem.

The little light flashes on the Arduino during the process, then stops for a minute, then starts flashing again, the process can continue for 5-10 minutes before I stop it.

I tried with a blank sketch, this worked fine - upload completed straight away.

I tried the same with a basic example sketch - upload completed straight away.

I tried with a bigger sketch (different to my sketch above) and it took ages again!

Then I tried all of the above with another Mega 2560 I had hanging around (which I've never had problems with) - the same problem!

I removed the driver in Windows and deleted the driver files and re-installed - same problem!

I changed the COM port from 3 to 4 in the Windows device driver - properties for the USB Serial Device. Fixed! It then uploaded an old sketch I'd written that was large - did it in the usual relatively quick time (10 seconds).

THEN... I uploaded the original sketch that I was working on when the problem started - and argh! The "uploading..." is displayed for a very long time again!

Any ideas?

I had some funnies yesterday or the day before when programming an Uno. What pointed me in the right direction was that I noticed that during one of the compiles (verify) that it all-at-a-sudden stated that the configuration was changed. Worked out to be selection of the wrong board (not sure how it happened as I only have an Uno).

It might be simple like that so check your board selection.

You can also run the loop-back test described at the top of this forum section.

I have seen two causes of this issue.

There was a bug in previous versions of the Arduino IDE that caused it, I ran into it with 1.6.4 but it may have been present in 1.6.3 also so you might try updating to 1.6.5 or later version.

Another cause can be your antivirus software. To determine if this is the cause temporarily disable your antivirus and see if that solves the issue.

Hi

Thanks - I just upgraded IDE to 1.6.7 and temporarily disabled antivirus.

But sadly the same thing is happening. I don't understand, one second it was fine, the next it's screwed with no warning!

Any other ideas?

Turn on verbose output during compilation and upload in File > Preferences then you can see what is happening when it hangs. When you Upload the Arduino IDE first has to compile your sketch and it is more likely that it's hanging during the compilation than during the actual upload to the board because usually it will time out if there is a problem during upload.

Output from the log. I especially like the comment about command 0x1d :P

avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_getsync(): timeout communicating with programmer avrdude: stk500v2_command(): failed miserably to execute command 0x1d avrdude: stk500v2_cmd(): failed to send command avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 avrdude: reading input file "C:\Users\Mat\AppData\Local\Temp\build5657940558530537639.tmp/test_display_weathermode.cpp.hex" avrdude: writing flash (18626 bytes):

Writing | ##########avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout

That indicates the problem is occurring during upload and not compilation. Could you post the sketch that causes the problem(use code tags).