avrdude: stk500v2_ReceiveMessage(): timeout
Asked Answered
W

16

38

This is the main error that I get when I try to run my ARDUINO program. The full list of errors is as follows:

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

My code is as follows:

int led=13;
void setup()
{
    pinMode(13,OUTPUT);
}

void loop()
{
    digitalWrite(13,HIGH);
    delay(1000);
    digitalWrite(13,LOW);
    delay(1000);
}

I have tried updating the drivers (they are fully updated) and downloading some programs. I have Windows 7 and my arduino is a MEGA 2560. It shows up in the Device Manager and all of my connections are correct. The green PWR light is on and so is the flashing L light. The RX and TX lights flash when I update. I have tried almost everything on the web. What is the problem?

Wavelet answered 28/10, 2013 at 21:30 Comment(2)
While this question is maybe OK here, you'd get a lot more knowledgeable eyes on it over at EE.SE.Airspeed
I had the same issue when I tried to upload sketch while esp8266 was connected to my arduino (mega 2560) into 3.3V, GRD, Rx and Tx. After disconnection it worked wellMiniver
C
25

Another possible reason for this error for the Mega 2560 is if your code has three exclamation marks in a row. Perhaps in a recently added string.

3 bang marks in a row causes the Mega 2560 bootloader to go into Monitor mode from which it can not finish programming.

"!!!" <--- breaks Mega 2560 bootloader.

To fix, unplug the Arduino USB to reset the COM port and then recompile with only two exclamation points or with spaces between or whatever. Then reconnect the Arduino and program as usual.

Yes, this bit me yesterday and today I tracked down the culprit. Here is a link with more information: http://forum.arduino.cc/index.php?topic=132595.0

Consonant answered 19/3, 2015 at 0:16 Comment(3)
Thank you!!!! This has saved me what would otherwise have been many hours of headache.Legislative
Unbelievable, but exactly what I ran into. Thanks.Catharine
Thank you, thank you, thank you. I ran into this issue but only with 2 explanation points. Regardless I just won't be exclaiming anything through the serial monitor from hereon out...Detention
A
15

The error message basically means that the programmer is unable to contact the bootloader on the device; the code you're trying to upload has no bearing on the problem.

What causes this can be numerous and varied, some possible issues:

  1. UART communications

    • Blinking is happening, so hopefully you aren't using the wrong port. It might be worth checking again though, sometimes USB COM devices install on strange port numbers.

    • Connect TX to RX (and disconnect them from the AVR if possible) then open a terminal on the COM port, you should see characters echoed if you type them. If you don't, something is wrong up-stream of the chip, it could be the communications chip (I think the Arduino 2560 uses a secondary AVR instead of an FTDI for some reason, so that could be broken, either its software or hardware)

  2. ATmega* bootloader

    • The AVR is not executing the bootloader for some reason. If the programmer is not resetting the micro before attempting to connect, this might be the reason. Try to reset the AVR (press and release the button) while the programmer is attempting to connect. Sometimes software that runs in a tight loop will prevent the bootloader from connecting.

    • Barring that, the fuses might have gotten messed up or the code erased. You would need to reflash the bootloader and proper fuses, again, see the appropriate info page for your device.

  3. Arduino Mega 2560 only: ATmega8U/16U software

    • Might not be working and would need reprogramming. See the Programming section on the info page, you will need the firmware and Atmel-compatible DFU (device firmware update) software on your computer to reflash the target.
  4. Hardware damage to the board, AVR(s), or FTDI chip

    • You're hosed; need a new chip.

Check this forum post for some more ideas.

Airspeed answered 28/10, 2013 at 22:0 Comment(1)
I've an Arduino Mega precisely of the same problem. Most probably it's a bootloader issue - because if I shut down the "enable chip enable cycle" option by passing -D flag, I successfully burn the program to the chip (although a tad slower I think). Thanks, these are good guidlines.Ilailaire
P
8

To my humble understanding, this error arises in different scenarios:

  1. you have selected the wrong port or you haven't at all. go to tools > ports and select the com port with your Arduino connected to.

  2. you have selected the wrong board. go to tools > board and look for the right board.

  3. Do you have one of these Arduino replicas or you don't have the boot-loader installed on the microcontroller? I don't know the solution to this! if you know please edit my post and add the instructions.

  4. (windows only) you don't have the right drivers installed. you need to update them manually.

  5. sometimes when you have wires connected to the board this happens. you need to separate the board from any breadboard or wires you have installed and try uploading again. It seems pins 0 (RX) and 1 (TX), which can be used for serial communication, are problematic and better to be free while uploading the code.

  6. Sometimes it happens randomly for no specific reason!

There are all kinds of solutions all over the internet, but sometimes hard to tell the difference between magic! Maybe the Arduino team should think of better compiler errors to help users differentiate between these different causes.

The same problem happened to me and none of the solutions above worked. What happened was that I was using an Arduino UNO and everything was fine, but when I bought an Arduino Mega 2560, no matter what sketch I tried to upload I got the error:

avrdude: stk500v2_ReceiveMessage(): timeout

And it was just on one of my windows computers and the other one was just ok out of the box.

Solution:

What solved my problem was to go to tools > boards > Boards Manager... and then on the top left of the opened windows select updatable in the Type section. Then select the items in the list and press update on the right.

I'm not sure if this will solve everyone's problem, but it at least solved mine.

Potamic answered 18/7, 2017 at 12:59 Comment(0)
B
7

I got this error because I didn't specify the correct programmer in the avrdude command line. You have to specify "-c arduino" if you are using an Arduino board.

This example command reads the status of the hfuse:

avrdude -c arduino -P /dev/ttyACM0 -p atmega328p -U hfuse:r:-:h
Briquet answered 5/2, 2014 at 11:29 Comment(0)
M
1

Open Terminal and type:

$ sudo usermod -a -G dialout 

(This command is optional)

$ **sudo chmod a+rw /dev/ttyACM0** 

(This command must succeed)

Mai answered 16/2, 2020 at 17:9 Comment(0)
V
0

This isn't really a fixing solution but it may help others. Unlike Nick had said for me it was due to code in my program. I have the mega ADK model. The issue was tied to a switch statement for processing and parsing the returned byte[] from the usb connection to the Android. Its very strange because it would compile perfectly every time but would fail as the OP had stated. I commented it out and it worked fine.

Vitals answered 2/2, 2014 at 1:38 Comment(0)
E
0

I was running this code from Arduino setup , got same error resolve after changing
serial port to COM13
GO TO Option
tool>> serial port>> COM132

Earthwork answered 21/8, 2014 at 9:24 Comment(0)
S
0

If you use the ino command line:

ino upload

it can be because you use the arduino software at the same time, try to kill it.

Sancho answered 18/11, 2014 at 20:1 Comment(0)
F
0

My aurdino mega 2560 returned same error. It seems the problem exists in unofficial clones. The issue solved by pressing reset button just before uploading starts, as advertised in following video.

https://www.youtube.com/watch?v=tAzjO4v7oF4&list=LLDn5ewJDzz53IiwWmZTgQnQ&index=1

Firth answered 19/2, 2017 at 6:44 Comment(0)
C
0

I've connected to USB port directly in my laptop and timeout issue has been resolved.

Previously tried by port replicator, but it did not even recognized arduino, thus I chosen wrong port - resulting in timeout message.

So make sure that it is visible by your OS.

Cowl answered 19/6, 2017 at 20:50 Comment(0)
L
0

Ensure the serial monitor is not running and nothing is reading/writing dev/tty/S0 (or whichever port you're using), which may cause uploading interference.

Laocoon answered 14/1, 2019 at 23:10 Comment(0)
A
0

I had the same problem, and in my case, the solution was updating the usb-serial driver using windows update on windows 10 device's manager. There was no need to download a especific driver, I just let windows update find a suitable driver.

Anther answered 9/12, 2019 at 13:39 Comment(0)
A
0

I faced same problem. but Root cause of issue. Incorrect communication was set and thats why I occurred Communication timeout.

Solution: If you connected to laptop through USB port. Change Port as USB. Please follow steps

  1. Open Arduino-IDE
  2. Go to Menu "Tools --> Port" and Select option "USB" { for me its showing as /dev/ttyUSB0 }

It working fine for me.

Alboran answered 8/6, 2021 at 16:39 Comment(0)
F
0

Something not yet mentioned is that this message also appears when the baudrate is not properly set... for Arduino, it is generally 115200.

Flotation answered 8/12, 2021 at 23:23 Comment(0)
M
0

I had this problem when I had the Arduino connected thru nested USB hubs. Funny thing it was listed properly by 'lsusb' and if I clicked 'Tools' -> 'Get Board Info' I got the 'Board Info' dialog just fine. But still could not upload a sketch. Then unplugged from the nested hub and plugged directly into a USB port on the motherboard and problem went away.

Matchwood answered 3/3, 2023 at 8:32 Comment(0)
L
0

I had this issue. The solution I found was I had to disconnect my LCD screen from the board.

Launalaunce answered 18/11, 2023 at 18:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.