Timeout connecting to programmer: avrdude: stk500v2_getsync()

Hello, we are using an Arduino Mega (ATMega2560) and we are getting this error even when we try to upload an example code. It is not a problem for the PC or the USB cable because i can upload the code to an Arduino UNO.
How do i solve this problem? the ON led lights up, but the L led doesnt. TX and RX blink when i try to upload it.