I would like to start by saying I have probably read every thread on the new and old forums looking for a solution to this problem. I found people with the exact same issue and their problem was never resolved.
I am using an Arduino MEGA 2560 on Windows 7. I used it for 3 months prior to the uploading problem with no issues. The last program uploaded to the board is still on it; it is a small and simple program to run motors using the servo library. A week ago I attempted to upload another program and the program got stuck trying to upload. Since this time I have used 4 different USB cables on 3 different computers. I have updated from 021 to 022 arduino and have tried multiple programs (including the blink program) with no success. The uploader gives me a continuous loop of timeout errors and the LED at pin 13 stays lit the entire time (I waited over 30 minutes). The only way to stop the process is to hit the upload button again, in which case it says COM4 is already in use, or to unplug the USB cable.
I assumed it wasn't a driver problem since I have successfully uploaded programs from multiple computer before. The was no '!!!' in my code at all. Unfortunately I am using the board to control a robot that must be demonstrated in the next week and I fear that it will take longer than that to fix the board. Any help or advice would be greatly appreciated!
Get yourself a proper ISP programmer. Cheap ones (usbtiny) can be had for 20 bucks.
If uploading doesn't work with these, the board is seriously sick or even dead. The more threads on this subject I read - it must have been hundreds by now - the more I come to the conclusion that relying on a bootloader as the only means to get code onto the micro-controller is just a waste of time.
This is not your fault. Just get a proper programmer and be free. You can even configure the IDE to upload using the programmer directly, or just run avrdude by hand.
Unfortunately this won't fix your current problem quickly, but in the future it will save your ass many times.
Quick fix: get a new mega board for your display and deal with the other one later. Maybe it can be revived, maybe not.
I reinstalled the drivers and firmware with no success. I will rush order a new board today and hope it makes it on time. I will continue to search for a solution after the demo!
You can force the upload by pressing the reset botton and the just plug the usb cable and hit upload the new sketch.
this way you will put the board in reset and the arduino wont start running until you release the botton.
just try ...
Force upload did not work. I received the new MEGA 2560 today and it uploaded the same code no problem (Thank goodness). I will continue to look for a solution after the demo and post my progress. Thanks everyone!
The bootloader relies on the bootloader program itself being present in the firmware, and also various "fuses" being set to tell the processor to run the bootloader on reset. Conceivably a bit was changed somewhere in either the fuses or the bootloader which is why it won't work now. However the ISP programmer simply relies on the processor hardware itself and should be more reliable (for example, to replace the bootloader).
Interestingly, your project involves motors. Conceivably also a voltage spike damaged the processor, or even a single port on the processor, making the processor either fail entirely, or fail to read certain ports (for example, the port used by the bootloader). You may want to check that you have protection diodes in place across motors, or driver transistors.
We are using multiple motors, the highest of which are rated at 16A stall. However, we are using Victor 883 speed controllers to drive these motors, which are rated at 60A. I was under the impression that these controllers would prevent the spikes you are talking about. The Electrical's in our project, myself included, are very inexperienced with motors and motor drivers. Perhaps there are extra precautions we need to take?
I would hate for something to happen to this new board before the demo.
I am not really a motor expert, however I have heard before that there is a correlation between people powering motors from their Arduinos, and trouble.
The docs for the Victor 883 are not very specific about what you need to drive it, and you haven't provided any details about what you are actually doing.
Try Googling for: "Victor 883" +"pwm driver"
There seem to be hints there that some sort of driver might be needed between the Arduino and the Victor.
The Victor documents say:
You will need (1) PWM extension cable or PWM Signal Driver.
Use a PWM Signal Driver to ensure the signal from your receiver is Victor compatible if you are not using an IFI Control System.
So I don't know if your signal is "Victor compatible" whatever that means exactly.
I would post a query under the "Motors, Mechanics, and Power" section of the forum, asking for advice in connecting up the Victor. Preferably provide as much information as you can about what you have currently done.