Arduino: Upload Timeout error

I'm new to the Arduino programming. I'm using an Arduino Mega 2560 R3 and use Arduino IDE 1.5.5-r2. I have a very simple program and when I try to upload, it locks near the end. Some time appears to me the following 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_getsync(): timeout communicating with programmer

I am using the correct COM port and I have the right board selected

When I try to connect the Rx pin with the pin Tx, writing in the console I get the data correctly in the monitor.

Any ideias?

Thanks.