stk500v2 Error


Im working with the pressure sensor BMP180 and Arduino Mega 2560. Im not able to upload the program. There are no compilation errors. I have used the same board to work with other sensors LM35 and DHT11 and it worked absolutely fine.

I checked the ports, connections and there are no issues with that.

Arduino: 1.6.13 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Sketch uses 6,978 bytes (2%) of program storage space. Maximum is 253,952 bytes.
Global variables use 483 bytes (5%) of dynamic memory, leaving 7,709 bytes for local variables. Maximum is 8,192 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
An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

This is the error message. Can anyone suggest me a better solution?

This is too much of a “GENERIC” code to give any one answer.
Best bet is start at the top of this list and eliminate as many issues mentioned as possible.
Then do a search of the forum for “stk500” and follow each answer to the end of its thread and try what other people have tried. Quite often there are “Oh My God” moments where something you didn’t think would work suddenly does.
OR one step you tried may depend on another step from a completely different post.

Some of the fixes / answers below but this is by no means a complete list and are a small compilation of real answers from the forum. I claim no credit for any of these.

“I had this issue a couple of times and l it happened while unplugging and giving power to the arduino while other things plugged in. I had to restart the computer this fixed it in both of my cases.”
“The problem is that the com port has changed. Check the Device Manager then check the compiler Tools/Serial Port; they should be the same.”
“Had this problem on my Windows machine. The problem was simply drivers. I had not installed the drivers for my Arduino yet. “
“fyi you should only have to reseat the Atmega chip once, if at all. The idea is to make sure all its pins are contacting, which generally only takes one try. 98% of the time this is not going to help, it's only for the rare cases where the chip and socket are not aligned.”
“I had to press the Reset Button AFTER I pressed "Upload to I/O Board". And when I say AFTER, I mean 4 to 5 seconds after. Seriously. Of course, this is the opposite advice from the feedback returned by the Arduino IDE....

It also turns out that (in my case anyway) there is a very narrow window of time where the Uploader will work. If I press the button too early, "Programmer is not Responding". If I press it too late, "Programmer is not responding". I have less than a second's time to get it right. “
“Burning the bootloader helped.”
“Windows 10 and arduino drivers don't get along. Only suggestion is to reinstall drivers and make sure they are the correct ones.”
“I got this when i used an ultrasound sensor in my project which is connected on the rx/tx pins. After disconnecting it for the upload it worked. You did not write if there was anything connected at the time of the upload. Maybe this helps?”
“Check that you have chosen the correct board under Tools before uploading, unplug usb and re plug it in, that should do the trick.”

On Mac OS X:
/Users/(username)/Library/Arduino15 (a.k.a. ~/Library/Arduino15)
(Note: The 'Library' folder is greyed out in Finder. The folder can't be opened with a double-click. To browse the contents of 'Library', ctrl-click on it and select "Open in New Tab" from the pop-up menu.)

On Windows delete or rename both:
Arduino IDE 1.6.5r5 and previous: C:\Users(username)\AppData\Roaming\Arduino15
Arduino IDE 1.6.6 and later: C:\Users(username)\AppData\Local\Arduino15

On Linux:
/home/(username)/.arduino15 (a.k.a. ~/.arduino15)
(Note: file/folder names starting with '.' are not normally shown in directory listings. Use 'ls -a' to get a directory listing that includes the hidden files.)

“If you are using an Arduino Nano w/ OSX you need to install the drivers.

Download and execute it:

And you'll find this files:

• FTDIUSBSerialDriver_10_3.pkg which is specific to OSX 10.3 (Panther)

• FTDIUSBSerialDriver_10_4_10_5_10_6.pkg which is specific to OSX 10.4 (Tiger), OSX 10.5 (Leopard)
and 10.6 (Snow Leopard).

Execute "FTDIUSBSerialDriver_10_4_10_5_10_6.pkg" if you are using OSX 10.5+ (Leopard+)”
“Do you have a USB hub handy (thingy that plugs into the USB and splits off 3 or 4 other ports)? I am not sure how the MacOS handles the Hub, but with Windoze, it assigns another device and starts the installation process again. Make sure you have proper permissions (User Account with Admin rights).”
“My problem was that I previously installed the FTDI drivers on my MAC even though I was working with an Arduino Mega (Which does not need those drivers) . Apparently the arduino program was using those drivers to communicate with my Mega that is why in Tools-Port I had tty-USBSerialxxx. I uninstalled those drivers and I got tty.usbmodem1411. My arduino MEGA ran perfectly fine. I hope this helps “
Lots more HERE