arduino mega impossible to upload sketch

hello, i got an arduino mega, and from a few days i cant upload my sketch,

the error: avrdude: ser_open(): can't open device "\.\COM12": access denied

avrdude: ser_drain(): read error: Handle invalid

and i get time out(), but some times my sketch is loaded, can some one of you help me pls?
Thank you

let us know which OS & which version OF IDE using??

Make ensure when you connected Arduino mega port being detected in device manager. You choosen proper port & proper board from IDE.

Also send me link from Where it download/

i tried a lot of version, and yes i chose the right port and board.

Ghislacchio:
i tried a lot of version, and yes i chose the right port and board.

So OK,

  • board is detected on COM port, as the driver is installed
  • you have selected the correct COM port in the IDE
  • you have selected the correct board type MEGA2560 in the IDE

So what's the problem:

  • NO sketch will upload, even not "Blink" and "BareMinimum" examples?
  • YOUR sketch will not upload?

no one sketch,

Ghislacchio:
no one sketch,

So please describe your system a little bit more detailed than with the error message:

the error: avrdude: ser_open(): can't open device "\\.\COM12": access denied

The "access denied" message directs to a problem with the Windows user account control (uac) restrictions.

So what might be the problem, that your access to COM12 is denied by the system?

Software installed as an "Administrator" and trying to use as a "Standard User"?

Is it a "normal" installation of something like "Windows 7 Home Premium Edition"?

Or is it some kind of "virtualized" operating system that prevents you from using all ressources of the system due to configuration settings of the hosting system?

i tried with administrator and with a standard user, my windows is windows 7 home premium, i don't know why is is denied, with my other arduino it works

Ghislacchio:
i tried with administrator and with a standard user, my windows is windows 7 home premium, i don't know why is is denied, with my other arduino it works

And you are sure that COM12 is really the COM port of your MEGA?

When you open the Device Manager and connect the board to USB, COM12 appears? And if you disconnect the board COM12 disappears?

Would it be possible that you use some software with "Serial auto detect" features, such as possibly mobile phone software? If you are running any software with features like "Serial port auto detect" you should deactivate the "auto detect" feature and set to "manual COM port setting".

not sure if this will help as I am new, but, I have several Megas, and I was not able to upload, even though everything said it was set properly, I replaced the USB cable and never had the problem again

yes,the com 12 appears,and when i get out the cable it disappears. i can't fix this problem :frowning:

Ghislacchio:
i can't fix this problem :frowning:

I can't, either.

The error message "access denied" points to some security problem.
I don't know what might cause that.

Do you have installed other "Firewall" software except the Windows firewall?

Do you have installed other "Anti-Virus" software except Microsoft Security Essentials?

If so, the problem might be caused due to your user settings of additional third-party Firewall and/or Anti-Virus software.

Perhaps give it a try while deactivating additional Firewall/Anti-Virus software while trying uploading on COM12.

I'm clueless what's in your system that might prevent access to the COM port.

Would a clone board cause problems?

bluejets:
Would a clone board cause problems?

Most unlikely.

If you have several Megas, you probably know what you are doing, and I think the real problem is that you have several Megas and this confuses Arduino or Windows, probably both, and may even be confusing you.

I have had similar problems although I don't think I was actually told access was denied. I despaired for a while and ran one on another computer but I think it has now sorted itself out. I believe I did this by re-installing the IDE from scratch. I don't suppose that I need remind you the every Mega works off a different COM port and those ports will be different on other computers. Put labels on the Megas and make a table in NotePad.

As far as I can see, the OP has just the one board, #8 was the one with several.

Just wondering if the OP has worked through the troubleshooting section one step at a time?

http://arduino.cc/en/guide/troubleshooting

First entry is about uploading problems.

I get that ser_drain() too sometimes. Im using 1.5.7 and it happens to all of my boards. However if I use 1.0.6 it works with no problem. I think it might be a bug with the IDE.

It could be the dreaded fake ftdi chip issue. There's a zip file available with drivers that work with the fake chips. I can't remember where I downloaded them from but I still have the zip file sitting on my machine here.

Mega's never used FTDI chips, did they?

CrossRoads:
Mega's never used FTDI chips, did they?

I believe you are right!

i tried in another one pc and it works, i don't know why on mine don't!