I'm facing this issue for quite a while now, I have a real Arduino Mega 2560, I have the IDE (since it's a real Arduino I won't have to install extern drivers like for a fake Arduino, the normal IDE will install the drivers for this Arduino automatically, if I'm right) installed and such and usually I know how to fix the problem (I also have a lot of fake arduino's which do work), but for some reason this one won't work, the code won't upload and I get the timeout error.
The error:
Arduino: 1.8.1 (Windows 10), Board:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
De schets gebruikt 17994 bytes (7%) programma-opslagruimte. Maximum is 253952 bytes.
Globale variabelen gebruiken 1102 bytes (13%) van het dynamisch geheugen. Resteren 7090 bytes voor lokale variabelen. Maximum is 8192 bytes.
avrdude: ser_open(): can't open device "\\.\COM4": Toegang geweigerd.
avrdude: ser_drain(): read error: De ingang is ongeldig.
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: De ingang is ongeldig.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: De ingang is ongeldig.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: De ingang is ongeldig.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: De ingang is ongeldig.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: De ingang is ongeldig.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: De ingang is ongeldig.
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
de geselecteerde seriële poort avrdude: stk500v2_getsync(): timeout communicating with programmer
bestaat niet of uw board is niet aangesloten.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Here are some screenshots from the IDE, as you can see it recognises the board + port!
Here you see it recognises it:
I've tried to upload a code on multiple different PC's and it's not working, I'm using Windows 10.
Any help would be appreciated, sorry if I haven't provided enough information, please ask.
My german isn't that great.. I did see this at the bottom though
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I'd suggest trying that and perhaps it'll give the detail necessary to find the trouble.
Also, I would try changing the COM port the Mega uses (windows control panel, device manager, click on "Com port, and in the Advanced tab you should be able to change the COM port it uses)
That message is a bug. I have reported it to the Arduino developers:
I've been trying to reproduce that for a long time and just now finally figured out when it occurs.
You won't get any help with an upload error from verbose compilation output. File > Preferences > Show verbose output during: > upload (check) is generally very useful and I always have that enabled. Unfortunately I don't think it will help in this case as the problem avrdude is having is already clear from the "can't open device "\.\COM4":" message.
Of course the key is to find out why it can't open it but I don't think verbose output will help with that. I agree with DrAzzy about another application having COM4 open causing the error. For example, if you're using a serial terminal on that port. Serial Monitor shouldn't cause the issue but other ones will. I can reproduce the issue by opening the COM port of my Mega in RealTerm then trying an upload.
pert:
Of course the key is to find out why it can't open it but I don't think verbose output will help with that. I agree with DrAzzy about another application having COM4 open causing the error. For example, if you're using a serial terminal on that port. Serial Monitor shouldn't cause the issue but other ones will. I can reproduce the issue by opening the COM port of my Mega in RealTerm then trying an upload.
Yes I know about this, for example if you're using Processing Serial, Serial monitor etc, but that's not it. I do not have anything opened, also not in the background, I've restarted my computer multiple times without any succes, and the error messages keeps changing actually, but it has always something to do with 'timeout error'...
It's not the USB cable, I've tried different USB cables now, and the USB cables work for an Uno..
It's not the PC (I think..) I've tried on multiple different PC's, and yet again for the Uno it does work.
It's a real Arduino Mega which is recognised in the IDE, the IDE settings are all correct
No background program running that is using Serial..
How to fix this..
Rx7man:
My german isn't that great.. I did see this at the bottom though
It's Dutch ;), it's basically saying: Port acces denied.
Rx7man:
Also, I would try changing the COM port the Mega uses (windows control panel, device manager, click on "Com port, and in the Advanced tab you should be able to change the COM port it uses)
Well this is interesting, my Arduino Uno goes into the same USB port as this one and the Uno takes COM5.
The mega takes COM4, and when I go into the tab and try to change it to COM5 it says "COM5 in use"...
I have no idea what is using COM5.. it's on all the other PC's as well!
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\Name\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf"
Using Port : COM4
Using Programmer : wiring
Overriding Baud Rate : 115200
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
avrdude done. Thank you.
Er is een fout opgetreden bij het uploaden van de schets (Error occured while uploading sketch it says)
Just wondering aloud if it is worth clearing the windows com port list completely.
It would at least give you a fresh start on the COM ports.
The trick is to use the the Command Prompt as administrator
Open device manager from the same command prompt.
Dont do this with anything connected to the USB ports apart from mouse and keyboard.
A. Right-click “Command Prompt” in Accessories and choose “Run as Administrator”
(You may have to enable it in WIN 10)
B. Type set devmgr_show_nonpresent_devices=1 and press ENTER
C. Type devmgmt.msc and press ENTER
D. Device manager should now open
E. In the windows that opens, select Show hidden devices in the VIEW menu.
F. You should now be able to expand COM ports and it should list all the COM ports that have ever
been used, the non present ones should be light grey.
Then uninstall anything that you don’t want.
I usually uninstall them all and then reboot and let windows do its thing.
You may also see the option to also remove drivers and my suggestion would be NO in most cases. That said I often do remove the drivers in case it was a corrupted driver but I make sure I have the correct ones on hand ready to re-install if needed.
I know this is dumb; but here are my COM3 settings, just in case it is a problem with baud rate, or such.
Also, you might check the stickynote about installing the right COM driver. Might be that the COM driver which loaded isn't compatible with your board.
The com settings for USB can be over ridden by the IDE as it is not a true com port in that sense.
Just don't try to LOCK them down (except maybe the port itself on occasion) or you may get other issues !
BTW which sticky are you referring to as without some sort of link iot could be a few ?
sterretje:
If that CH340 disappears when you disconnect the Mega, you have a fake Mega, not a real one. Download and install CH340 driver.
COM3 uses my fake Arduino's, the CH340 drivers are already installed :D, but this is a real one and this one uses COM4, even tho my real Arduino Uno uses COM5.
akatchi:
Well this is interesting, my Arduino Uno goes into the same USB port as this one and the Uno takes COM5.
The mega takes COM4, and when I go into the tab and try to change it to COM5 it says "COM5 in use"...
I have no idea what is using COM5.. it's on all the other PC's as well!
This is a Windows system.
It reserves COM5 for your Uno, so COM5 is already taken.
Even if it is not plugged in.
You can see what ports are taken/reserved in the list you'll see when browsing for a new manual assignment.
If you want to free those ports, plug in the device of which you know it has that assignment, and change that one (to COM25 or so, one that will be free for sure).
Now plug in your Mega, and tell it to use the now freed COM5.
After that COM4 should be available for your Uno or any other new serial device you plug in next.