stk500v2_ReceiveMessage(): timeout Why this issue is still around?

Hello, I used Arduino 1.6.7 with Mega 2560. It was working fine yesterday but when I tried to use the board today, I keep getting "stk500v2_ReceiveMessage(): timeout" error even I tried to upload the same code that worked yesterday. I upgraded to Arduino 1.6.13 but the situation is still the same. There is no !!! in my program. I am using macOS Sierra 10.12.1. Programmer is set to AVRISP mkII by default. Anybody knows what to do?

Here is the detailed error:

Sketch uses 23,180 bytes (9%) of program storage space. Maximum is 253,952 bytes.
Global variables use 2,474 bytes (30%) of dynamic memory, leaving 5,718 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
Invalid library found in /Users/usera/Documents/Arduino/libraries/MicroSD-breakout-board: /Users/usera/Documents/Arduino/libraries/MicroSD-breakout-board
Invalid library found in /Users/usera/Documents/Arduino/libraries/MicroSD-breakout-board: /Users/usera/Documents/Arduino/libraries/MicroSD-breakout-board

P.S. In the past, even I got Invalid library related to MicroSD, the program still worked and uploaded file.

This morning I tried to upload again and got a bit different set of errors. I see two solid orange and a solid green LED lights on the Mega 2560. I have tried several suggestions found on the internet. I have changed a few usb cables and tried different ports. I have tried to hit the reset button when the uploading was almost done (found on youtube). I have tried 1.6.7 and1.6.13 versions of the IDE. Even I tried the Examples which came with the IDE, I still have the same timeout problem. After changing ports and cable, I got the list of errors in the original post.

Sketch uses 23,180 bytes (9%) of program storage space. Maximum is 253,952 bytes.
Global variables use 2,474 bytes (30%) of dynamic memory, leaving 5,718 bytes for local variables. Maximum is 8,192 bytes.
avrdude: ser_open(): can't open device "/dev/cu.usbmodemFA141": No such file or directory
ioctl("TIOCMGET"): Inappropriate ioctl for device
ioctl("TIOCMGET"): Inappropriate ioctl for device
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: Bad file descriptor
avrdude: stk500_send(): failed to send command to serial port
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
the selected serial port avrdude: stk500v2_getsync(): timeout communicating with programmer
does not exist or your board is not connected
Invalid library found in /Users/usera/Documents/Arduino/libraries/MicroSD-breakout-board: /Users/usera/Documents/Arduino/libraries/MicroSD-breakout-board
Invalid library found in /Users/usera/Documents/Arduino/libraries/MicroSD-breakout-board: /Users/usera/Documents/Arduino/libraries/MicroSD-breakout-board

I have been searching the internet for a solution. I noticed that many people using the Mega 2560 have this problem for a few years. May I ask why the issue is not fixed? I already checked that under Tools, I got the correct board and port. Some posts mentioned that it is due to bootloader. Am I correct? Is there some bugs in the bootloader or firmware that came with the board? The firmware on my board is version 0.01. Will the problem be fixed if I upgrade the bootloader or firmware? How can I tell if it is time to throw away the board and get a new one? My Arduino is an original, real one. Should not have such problem. This problem appeared in the past but somehow it disappeared. This time, it is still there for two days.

bbqq:
May I ask why the issue is not fixed?

Typically these sorts of errors are caused by user error or hardware problems. Thus it's not likely to be a bug with the Arduino software. If you discover otherwise I'm sure the Arduino developers would be willing to work on a fix. There is a ton of information available on these sorts of upload errors but they can result from various causes. It seems like these things are so frequently reported on the forum that they usually get ignored so you will have to filter through a lot of posts to find useful information.

I think it's a very useful troubleshooting tool to have a known-working Arduino board and USB cable stashed away to use as a sanity check when you run into problems. If only one board stops working then you know the problem is probably with the board. If they both stop working then the problem is with the software or USB port on the computer.

Thanks for your reply. I tried another Arduino Mega 2560 board. It is working fine. Does that mean the board in the original post is faulty? What can I do to a faulty board? I think after lots of attempts to fix the problem, at one point, I chose "Tools->Burn Bootloader" by mistake.

Over the past year, I noticed that sometimes the board had this problem until I had updated all the drivers for the shields and the board when the small update window showed up. Same thing when the Serial Monitor was on. How can I tell if all the drivers for the fields and the board are up to date?

bbqq:
at one point, I chose "Tools->Burn Bootloader" by mistake.

That won't do anything unless you had an programmer connected to your Arduino at the time.

It is worth a try to burn the bootloader on your non-working Arduino. If you don't own a dedicated programmer you can use the ArduinoISP sketch on your working Arduino to turn it into an "Arduino as ISP" programmer.

I think the reason people ignore these on the forums is that (like the sync error on stk500-using boards) the error is extremely non-specific, so you're basically talking people who are typically new to Arduino through all of the dozens of things that could cause the problem (and there are so many bizzaro cases that I've seen go by that resulted in that error; you can't really rule much of anything out. I used to think it was for sure that this couldn't be a driver issue - how could it possibly be?! But nope - people report it being fixed by driver updates sometimes!). So the error effectively means "something - could be anything - is wrong" - you'd get the same error if you sawed your Arduino board in half and threw out the half with the microcontroller on it.

The success rate with resolving it (based on forum threads) doesn't seem to be particularly good either. So helping people solve that issue is uninteresting, unenjoyable and frequently unsuccessful - so it's hardly surprising that people answering questions for free choose to answer different ones.

Thanks all. Is it dangerous to burn the boot loader? I mean will I damage either board permanently?

Is there a reliable, easy to understand step by step instructions on how to do it?

bbqq:
Thanks all. Is it dangerous to burn the boot loader? I mean will I damage either board permanently?

Is there a reliable, easy to understand step by step instructions on how to do it?

I don't think burning bootloader is dangerous as I did many times without any problem. You could try follow Gammon's tutorial. It's easy way as I know: Gammon Forum : Electronics : Microprocessors : Atmega bootloader programmer

Good luck.

Thank you. Under: arduino_sketches/Atmega_Board_Programmer at master · nickgammon/arduino_sketches · GitHub

Is Atmega_Board_Programmer.ino the only file I need to download to my laptop to upload to the source Arduino UNO?

bbqq:
Thanks for your reply. I tried another Arduino Mega 2560 board. It is working fine. Does that mean the board in the original post is faulty? What can I do to a faulty board? I think after lots of attempts to fix the problem, at one point, I chose "Tools->Burn Bootloader" by mistake.

Over the past year, I noticed that sometimes the board had this problem until I had updated all the drivers for the shields and the board when the small update window showed up. Same thing when the Serial Monitor was on. How can I tell if all the drivers for the fields and the board are up to date?

I removed the original Mega 2560 and replaced it by the working Mega 2560. After I put it in my system with other shields and tried to upload again, I got the

avrdude: stk500v2_ReceiveMessage(): timeout

error!

Somewhere on the internet I read that having many print, println and delay with large parameter values could cause such timeout error. Is this true?

Oh, you have other hardware connected to your Arduino while you're trying to upload? Sometimes that can interfere (if it's trying to use the same pins used for uploading code), depending on what's connected.

Throwing my hat in the ring...

Feel free to edit and change as you will...but let me have a copy back with changes if you would.

OK latest version working.

Also available on Google drive

Arduino troubleshooting for beginners.doc (368 KB)

DrAzzy:
Oh, you have other hardware connected to your Arduino while you're trying to upload? Sometimes that can interfere (if it's trying to use the same pins used for uploading code), depending on what's connected.

What pins are used for uploading code?

I tried a third Mega 2560 board. With it alone, no problem with uploading.

Ballscrewbob:
Throwing my hat in the ring...

Feel free to edit and change as you will...but let me have a copy back with changes if you would.

OK latest version working.

Also available on Google drive

Thanks. Am I supposed to install "FTDIUSBSerialDriver_10_4_10_5_10_6.pkg" ? I am using macOS Sierra 10.12.1

Same boards from different sources or different age may require different drivers.

Same links should also get you close to mac driver locations too.

As I say in the doc I dont know enough about some OS so its up to you to search for that aspect.

See the search box at the very top right of this page...type "sierra 10.12" in there and see what it gets you.

You could refine that with ftdi or ch340 etc. to get closer.

Thanks for the hint but I upgraded to Sierra 10.12 few weeks ago and did not have any uploading problem until few days ago.

That seems a common thing on the mac's. More so that windows.

Working one minute and not the next.
With Win it is usually an update or some other change.

So you are sure there were no changes since you went to Sierra ?

Mac OS does not get update as often as Windows. Hadn't done any updating weeks before it started happening last weekend.

was just a thought