Can't upload to Arduino Mega 2560

Since yesterday, I can no longer connect to my arduino Mega 2560. I was playing with a servo when the servo had some strange behavior (turning left, right, right, left etc etc). After that, I can't upload anything to my Arduino. I'm running Windows 7 and I had never problems before.

When I try to upload something to the board with the shift key enabled, I get the message 'avrdude: stk500_getsync(): not in sync: resp=0x00'. I tried to burn the bootloader through usb but that gives me the same error.

In the Arduino environment are the board type and the port entered correctly.

I hope someone can help me with this. Thanks in advance.

How are you powering the 2560? USB or power jack? Do you still have 5v on the +5v pin? How are you powering the servo?

edit: Before you think about powering the Uno or Mega with the +5v pin, you should read this topic http://arduino.cc/forum/index.php/topic,82046.0.html and this response from the Arduino crew http://arduino.cc/forum/index.php/topic,82046.msg758170.html#msg758170

The 2560 gets its power from an usb port. There is 5.00V on the +5V pin en 3.29V on the +3.3V pin. I was powering the servo from the +5V, ground and digital pin 9.

I can not really measure the power on pin 9 cause I only have a multimeter and not a scope (I was sending pulses to pin 9 with 9ms interval). Although I can measure that pin 9 is powered.

When I power the servo with an external power supply my program works. So the arduino is still alive.

Do not power the servo from the +5v pin. Bad idea. It is not as much the current, but the inductive nature of servos cause some bad sags and spikes on the power input.

Ok, I will take that into account, but what could cause the problem that i can't upload a sketch or the bootloader?

Samueldw: Ok, I will take that into account, but what could cause the problem that i can't upload a sketch or the bootloader?

If the com port appears in arduino, the cause probably is the bootloader. If not, can be several things, mostly the small chip that handles usb-serial connection

Well, the com port appears. If I do not connect the arduino, the compiler returns 'avrdude: ser_open(): can't open device "\.\COM3"'. So my arduino connects to my pc. It start compiling and uploaden so the com port is in use. If I want to try uploading again, I first have to disconnect my arduino from the usb port, otherwise it says 'com port in use'.

Samueldw: Well, the com port appears. If I do not connect the arduino, the compiler returns 'avrdude: ser_open(): can't open device "\.\COM3"'. So my arduino connects to my pc. It start compiling and uploaden so the com port is in use. If I want to try uploading again, I first have to disconnect my arduino from the usb port, otherwise it says 'com port in use'.

OK, try this mod: http://arduino.cc/forum/index.php/topic,118440.0.html if it works to you please tell me :)

Unfortunately it didn't seem to work. Still the same problem. When I press shift+ U, your ide asks to apply a fix and afterwards it's says 'Done Uploading' but nothing has happend.

Although I like your work :) I like the button in the taskbar.

I came across the same problem. I have a friend that is really good at this and I told him to take a closer look. I will keep you posted if I get any news from him.

Samueldw: Unfortunately it didn't seem to work. Still the same problem. When I press shift+ U, your ide asks to apply a fix and afterwards it's says 'Done Uploading' but nothing has happend.

Although I like your work :) I like the button in the taskbar.

Windows version? 32 or 64 bits? If unplugging your arduino fixes it temporalilly it should work + new winavr seems to not drive to the "serial is already in use".

If you are in win vista or 7, does some permission request pops when you press fix? I am thinking that I forget something for 32 bits :D (I only have win7 64 bits to test)

I'm using win7 64bit. There is indeed a permission request when I apply the fix.

Samueldw: Well, the com port appears. If I do not connect the arduino, the compiler returns 'avrdude: ser_open(): can't open device "\.\COM3"'. So my arduino connects to my pc. It start compiling and uploaden so the com port is in use. If I want to try uploading again, I first have to disconnect my arduino from the usb port, otherwise it says 'com port in use'.

Are you able to upload something? Maybe I misunderstood what you said earlier.

No, I can't upload anything. It starts uploading but does not finish. Also the leds TX and RX don't blink, like the normally do when you upload something.

Samueldw: No, I can't upload anything. It starts uploading but does not finish. Also the leds TX and RX don't blink, like the normally do when you upload something.

Ahh, in that case my mod version can't fix anything because it is not the serial port being use, it is probably a problem in the bootloader. Reading the last sentence of that message I thought by mistake you were saying: "first time works, second says serial already in use".

First test loopback test (google that). If goes wrong = small chip has something weird -> test DFU mode and updating that firmware (16u2 or 8u2 depending on your arduino). If loopback test is OK: look for instructions how to upload the bootloader again.

The loopback test goes wrong. I'm now trying to update the firmware of the 8u2 chip but I can't reset it.

Maybe I have to solder a 10k resistor on my board but I don't know where. Only the uno is shown in the tutorial. And I don't know if I've got a revision 1 or 2.

No resistor, just a screwdriver.

First red arrow, then bridge and hold the 2 pads in the green arrow until windows detect a DFU device

I tried it but nothing is installing and com3 is still there.

it can be tricky you may solder the resistor if you can’t do it with the screwdriver. I tried and it works eventually

the screwdriver works, but windows does not detect a dfu device.