Go Down

Topic: Mega 2560 timeout communicating with programmer (Read 336 times) previous topic - next topic

Arnau3899

Hello,

I was working with an arduino mega, when i tried to upload a new sketch but i was impossible due to this error. I have read a lot and it seems like this is a pretty common mistake, but any solution solved the problem in my case. I tried reburning bootloader. My usb cable its working fine since it uploads sketches correctly into my arduino uno. I tried uploading sketch using arduino as isp and the same error. I tried pressing reset button while uploading, betwen compilind and uploading and in all possible time combinations. I don't know what to do to save my mega.

Here's the output:

Arduino:1.8.9 (Windows 10), Tarjeta:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

El Sketch usa 6376 bytes (2%) del espacio de almacenamiento de programa. El máximo es 253952 bytes.
Las variables Globales usan 190 bytes (2%) de la memoria dinámica, dejando 8002 bytes para las variables locales. El máximo es 8192 bytes.
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
Ha ocurrido un error mientras se enviaba el sketch

Este informe podría contener más información con
"Mostrar salida detallada durante la compilación"
opción habilitada en Archivo -> Preferencias.

pert

What happened when you did the Burn Bootloader?

Arnau3899

#2
Aug 01, 2019, 01:37 pm Last Edit: Aug 01, 2019, 01:38 pm by Arnau3899
I don't remember exactly, but something saying that the bootloader was burned succesfully, the same message that i got when i burned bootloader to a chinese arduino nano. I think that there is no issue burning bootloader.

I have also tried to uptade software and drivers, but nothing seems to work.

pert

Make sure you have selected the port of your Arduino board from the Tools > Port menu.

Sometimes the port will be labeled with the board name in the menu. Other times it will not. If you don't know which port is your Arduino, you can find it like this:
  • Unplug your Arduino board from the computer.
  • Tools > Port
  • Note the ports, if any, listed in the menu.
  • Close the Tools menu
  • Plug your Arduino board into the computer.
  • Tools > Port - The new port listed in the menu is your Arduino board.

Arnau3899

Hello again pert,

The port is labeled and selected, this is not the problem.


connermacleod69

Hi to everyone,
I have the same problem since about one week. I started a project 3 weeks ago and could flash my 2 Megas 2560 without any problem. The I rebooted my laptop and since this moment I have problems. I tried a lot of solutions from the internet but nothing works for me. All other hardware works (Uno, Nano...)
Strangely the following example works everytime:

// the setup function runs once when you press reset or power the board
void setup() {
 // initialize digital pin LED_BUILTIN as an output.
 pinMode(LED_BUILTIN, OUTPUT);
 //Serial.println("Initializing...!!!!");
}

// the loop function runs over and over again forever
void loop() {
 digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(1000);                       // wait for a second
 digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
 delay(1000);                       // wait for a second
}
and this one never

// the setup function runs once when you press reset or power the board
void setup() {
 // initialize digital pin LED_BUILTIN as an output.
 Serial.begin(9600);
 pinMode(LED_BUILTIN, OUTPUT);
 Serial.println("Initializing...!!!!");
}

// the loop function runs over and over again forever
void loop() {
 digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
 delay(1000);                       // wait for a second
 digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
 delay(1000);                       // wait for a second
}




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

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\LOCALA~1\AppData\Local\Temp\arduino_build_709611/Blink.ino.hex"
avrdude: writing flash (2604 bytes):

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

Just the 2 serial lines added.

Arduino V1.8.9

Any advice appreciated
Regards



connermacleod69

Hi,
I found my error.
The problem comes from the line
Code: [Select]
Serial.println("Initializing...!!!!");
This line blocks uploading.
Replacing by
Code: [Select]
Serial.println("Initializing...!!");
works for me.
??????

Works
Code: [Select]
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println("Initializing...!!");
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}


The following dows NOT work for me
Code: [Select]
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println("Initializing...!!!!");
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}


Could anybody explain me the problem?

pert

Very old versions of the Mega bootloader want into a debug mode when !!! is in one of the strings in the program. The new version of the Mega bootloader does not have this problem.

Arnau3899

Yeah, the !!! problem is a known issue, but i dont have any "!!!" in my code. What is the problem in my case?

pert

What is the problem in my case?
Which USB to TTL serial chip is used on your Mega? This is the black chip near the USB jack. The most common ones are marked either "MEGA16U2" or "CH340".

connermacleod69

Thanks for the explanation. :)  :)  Did not know it.

Never worked with a Mega until last month. Bought 2 several years ago and now I'm working on a project where I need more IO.

So I can change the bootloader to avoid this problem?
Regards

pert

Yes. You will need an ISP programmer to burn the bootloader. If you don't own a dedicated ISP programmer, you can use a spare Arduino board as an "Arduino as ISP" programmer:
https://www.arduino.cc/en/Tutorial/ArduinoISP


Go Up