Go Down

Topic: Upload Timeout Error on Mega 2560 - Not Sure What Changed (Read 261756 times) previous topic - next topic

ThreeDMD

Hi,


I am also getting the same error but till now unable to fix it.I have arduino mega2560 board which is showing the same error as mentioned abobe.

I have tried the Resetting while compiling and tried to dump the arduino usb serial code also and tried even stk500boot_V2_mega2560.hex.


But it is showing in device manager for the Board detection but unable to dump the code.While dumping it is showing me the same error.


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

If somebody please help regarding this it will be great as i have spend almost 1 week on this issue but still no success

Regards,
Vipin


I just started working on this similiar problem today and am trying to figure it out. Looking through this thread would be a good place to start.

akatchi

I'm experiencing the same issue with the timeout error for my Arduino Mega on a MacBook. And no it's not in the '!!!' because I don't have that. The Arduino Uno is still working but the Arduino Mega isn't. I'm looking for an answer for so long now! Please someone help :(!

Elchickeno

I am getting the same error when i try to upload something to my Arduino mega 2560 rev3 + EMW3162 WiFi Shield. When i disconnect the shield it works fine ? Did someone heave solution for this ?

InfernoST

I had the same problem, and searching I found that:
https://stackoverflow.com/questions/19645441/avrdude-stk500v2-receivemessage-timeout/29135050#29135050?newreg=0314d331f90e4d158569f0b63cd75695

In one comment it says:
So in my code were strings with "!!!". I deleted them and now the program uploads with no problems.
The above was exactly the problem in my Sketch, changed it as outlined and it downloaded just fine.

Thanks for the help

musicalsaw

What worked for me...
I had this error time after time.
Finally, I unplugged one of the 3 devices I had plugged into the USB ports on my laptop and moved the Arduino USB cable to this vacant port.
Worked! - I have no idea whether this was coincidence or not.

tommie93

When i disconnect the shield it works fine ?
Hey Elchickeno,

I don't know, you tell me.

Elitism

I've been having this problem too

I figured out it was because of an (addhandler) within some code i wrote using visual studio, Since the system has absorbed the port handler and is constantly using it and didn't close, i resorted to closing down the process that was abusing the handler (GTAV) yes, I'm a game modder....

Anyway, If you have any programs that are auto booting from windows which take over the comport with handlers, you should close the process down, Reconnect the board after 5 seconds, It will work perfectl

(Not related to the problem above)
(just a tutorial on how to reflash the firmware on the sainsmart mega2560):
If you've burned another hex file to your sainsmart 2560 Make sure you have atmel flip to burn the bootloader of your specific chip, You will need to use Genuino-usbserial-atmega16u2-Mega2560-R3.hex if you're using a sainsmart 2560 (which is what i use) the firmware hex is inside the arduino firmware folders, Just do a search for it and you're good to go.

1. Short the two top most pins near the usb socket of your board to enter DFU
  + Before you can use atmel flip to flash the bootloader, you need to install the dfu drivers for your board
  - To do this follow these instructions
  - After entering DFU, go to device manager and update the drivers for your [libusb-win32 devices]
     + To do this look for the file usb in Flip 3.4.7 folder and click next, This will install the dfu driver
2. Select your chip AT90USB82
3. Open the port (USB CABLE BUTTON)
4. Click the red book with the arrow pointing towards it
5. Find Genuino-usbserial-atmega16u2-Mega2560-R3.hex
6. Press the reset button on the board (YOU MUST DO THIS)
7. click run
8. (WHEN THE PROCESS HAS FINISHED CLICK [start application]
9. RESET THE BOARD AGAIN WITH THE ON BOARD RESET SWITCH (YOU MUST DO THIS)
10. UNPLUG THE ARDUINO
11. REPLUG IT BACK IN

SUCCESS!

jascf

I was having this problem too in one of my 2 arduino mega boards and only with a program that is > 1000 lines of code.

The work around I found was to let the source coding uploading while grab a cup of coffe...

It seams that after some time, lets say 5 minutes, the code ends up uploaded.

I hope that this work around works for you too.

Thanks.

ballscrewbob

@ jascf

Problems like that tend to be associated with an antivirus program or similar.
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

ASFALCAO

I have a Dell notebook with Windows 10 Pro 64 bits and Arduino 1.8.3.

When I upload a simple code (17 lines) the task finish successful, as seem below:


Arduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
.......
Sketch uses 5970 bytes (2%) of program storage space. Maximum is 253952 bytes.
Global variables use 873 bytes (10%) of dynamic memory, leaving 7319 bytes for local variables. Maximum is 8192 bytes.
......
Writing | ################################################## | 100% 0.98s
......
Reading | ################################################## | 100% 0.77s
....
avrdude: verifying ...
avrdude: 5970 bytes of flash verified
avrdude done.  Thank you.

When I upload a medium size code (190 lines) the task get lot of time and finish unsuccessful:

Arduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
........
Sketch uses 22130 bytes (8%) of program storage space. Maximum is 253952 bytes.
Global variables use 1564 bytes (19%) of dynamic memory, leaving 6628 bytes for local variables. Maximum is 8192 bytes.
.........
Writing | #################################################avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
......
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_command(): failed miserably to execute command 0x13
avrdude: stk500v2_paged_write: write command failed
# | 100% 214.64s
avrdude: stk500v2_ReceiveMessage(): timeout
.......
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
.........
avrdude: stk500v2_ReceiveMessage(): timeout
An error occurred while uploading the sketch

May someone have a hint how cam I solve this issue?

MubarakAli

I had this problem and I solved it, Solution is so simple if you have another Arduino. I change the board from tool>board then programmed another Arduino, then I came again to my required mega Arduino and it worked.

BaSingSe

Hello,

i had the same problem and i searched everywhere for a solution and couldn't find one.
I tried flashing different bootloaders to the Atmega2560 and different firmwares to the Atmega16u2 with no luck.

So i decided to do some measuring and found out that the resistor value of TX0 RX0 was about 170 Ohm and the Resistor Value of another working Arduino Mega2560 was about 0,9 Mega Ohm.

So i had the suspicion that the USART0 is dead and thought about using the USART1 instead.

For that i needed a to recompile the bootloader changing the USART0 to USART1, after that i flashed the Arduino Mega2560 with ISP Programmer using the ArduinoISP Sktech.

I attached the official Arduino Bootloader the the Atmega2560 with the only change of USART0 to USART1.

After that i removed the resistor array with the 4x 1K Ohm and replaced it with 4x single resitor
then soldered the 2x 1K Ohm for the LEDs back on the board.
The other 2x 1K Ohm only on the side of the Atmega16u2 and with cables to the TX1 RX1 pins of the Atmega2560.

Now i got my Arduino mega working and everything is fine besides the USART0 pins which i don't use so much and the Atmega2560 has 3 other USART communication ports.

You should keep in mind though to use the Serial1 function instead of Serial.

I hope i could help someone who has had the same problem.

JosefN

I had the same problem.

avrdude: stk500v2_ReceiveMessage(): timeout

I spend a lot of time to solve the problem. Now i have a solution. I changed the usb-cable and it works. No timeout... no more problems.

eskuvofoto

Best Regards,
https://davidfoto.hu/

Luke21206

I have had this same problem too and I can t figure out how to fix it!
Code: [Select]
#include <LiquidCrystal.h>
#include <Keypad.h>
int opt1 = '+';
int opt2 = '+';
int find = 0;
int answer = 0;
char num[3];
int clear = 0;
int currentlength = 0;
int optlength = 0;
byte divide [8]={
  0b00100,
  0b00100,
  0b00000,
  0b11111,
  0b11111,
  0b00000,
  0b00100,
  0b00100,
};
const byte ROWS = 4;
const byte COLS = 4;

char Keys[ROWS][COLS] = {
  {'1', '2', '3', '+'},
  {'4', '5', '6', '-'},
  {'7', '8', '9', 'x'},
  {'*', '0', '=', 1}
};

byte rowPins[ROWS] = {5, A5, A4, A2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {A1, A0, A3, A6};

Keypad keypad = Keypad(makeKeymap(Keys), rowPins, colPins, ROWS, COLS);

LiquidCrystal lcd(7,9,10,11,12,13); // the pins we use on the LCD
int P = 8;


void setup() {
digitalWrite(6, HIGH);
  pinMode(6, OUTPUT);
lcd.createChar(1, divide);
lcd.begin(16, 2);
lcd.print("Type an equation");
lcd.setCursor(0,1);
lcd.cursor();
  while(find==0){
 
  while((optlength == 0)&&(currentlength == 0)&&(find == 0)){
  char key = keypad.getKey();
 
    key == NO_KEY;
   
    if (key != NO_KEY){
      if ((key != '+')&&(key != '-')&&(key != 'x')&&(key != 1)&&(key != '=')){
     
      if(key == '*'){
        digitalWrite(6, LOW);
       
      }
       
      if (key != '*'){
      lcd.print(key);
      num[0] = key;
      currentlength++;   
      }

  }
    }
    }
  while((currentlength == 1)&&(optlength == 0)&&(find == 0)){
  char optkey = keypad.getKey();
  optkey == NO_KEY;
   if ((optkey != NO_KEY)&&(optlength == 0)&&(currentlength == 1)){
     if ((optkey == '+')||(optkey == '-')||(optkey == 'x')||
     (optkey == 1)||(optkey == '=')||(optkey == '*')){
       
       if(optkey == '*'){
       digitalWrite(6, LOW);
       }
       if(optkey == '='){
        lcd.print(optkey);
       
        find++;
       }
       
       if((optkey != '=')&&(optkey != '*')){
       lcd.print(optkey);
       opt1 = optkey;
       optlength++;
       }
     }
     }
  }
 
while((currentlength==1)&&(optlength==1)&&(find == 0)){
  char key2 = keypad.getKey();
 
    key2 == NO_KEY;
   
    if ((key2 != NO_KEY)&&(currentlength == 1)){
      if ((key2 != '+')&&(key2 != '-')&&(key2 != 'x')&&(key2 != 1)&&(key2 != '='))
      {
        if (key2 == '*'){
          digitalWrite(6, LOW);
        }
      if (key2 != '*'){
      lcd.print(key2);
      num[1] = key2;
      currentlength++;   
      }

  }
    }
    }
while((currentlength == 2)&&(optlength == 1)&&(find == 0)){
  char optkey2 = keypad.getKey();
  optkey2 == NO_KEY;
   if ((optkey2 != NO_KEY)&&(optlength == 1)&&(currentlength == 2)){
     if ((optkey2 == '+')||(optkey2 == '-')||(optkey2 == 'x')||(optkey2 == 1)||
     (optkey2 == '*')||(optkey2 == '=')){
    if(optkey2 == '*'){
       digitalWrite(6, LOW);
       }
       if(optkey2 == '='){
        lcd.print(optkey2);
        find++;
       }
       
       if((optkey2 != '=')&&(optkey2 != '*')){
       lcd.print(optkey2);
       opt2 = optkey2;
       optlength++;
       }
     }
     }
  }
    while((currentlength==2)&&(optlength==2)&&(find == 0)){
  char key3 = keypad.getKey();
 
    key3 == NO_KEY;
   
    if ((key3 != NO_KEY)&&(currentlength == 2)){
      if ((key3 != '+')&&(key3 != '-')&&(key3 != 'x')&&(key3 != 1)&&(key3 != '=')){
      if (key3 == '*'){
      digitalWrite(6, LOW);
      if (key3 != '*'){
      lcd.print(key3);
      num[2] = key3;
      currentlength++;   
      }

  }
    }
    }
    }
    while((currentlength==3)&&(optlength==2)&&(find == 0)){
      char findkey = keypad.getKey();
 
    findkey == NO_KEY;
   
    if(findkey != NO_KEY){
      if((findkey == '=')||(findkey == '*')){
        if (findkey == '*'){
          digitalWrite(6, LOW);
        }
        if(findkey == '='){
          find++;
        }
      }
     
    }
     
    }
}
}

void loop(){

}

 My arduino can upload different code, but not this one, so I can't figure out what the problem is

Go Up