Arduino leonardo not uploading

Hello,
I am having an issue that won t allow me to upload code to my Arduino Leonardo. This board its new, i just bought it. I am using a pc, and when i try uploading, it gves me this message:

avrdude: ser_open(): can't open device "\.\COM16": Access is denied.

The Arduino Leonardo is new i don t think is fried, and the COM port works with the other arduinos. I checked my device manager and made sure I have my settings the same as every other port. I made sure I had the proper port selected in tools>port before uploading. I tried several times, so it isn't a one-time thing. Anyone know why this might be?

I moved your topic to an appropriate forum category @talosluca.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Which settings? Did you manually interfere with the port settings in Device Manager?

So you have never been able to upload?

==

How Leonardos (and other boards with native USB work):

The board runs your sketch. You will see a COM port in device manager indicating Arduino Leonardo (comX). When the actual upload starts, the IDE resets the board by opening and closing the serial port comX. The Leonardo will reboot and start the bootloader; in device manager, you will see something like Arduino Leonardo bootloader (comY). You will also see the board's L LED slowing fading in and out for approximately 8 seconds. comY is the port that is used for the upload.

==

I'm not sure if I can help with te "Access denied" message.

  1. Which version of Windows?
  2. Which version of the IDE?
  3. Does the Leonardo disappear from the device manager when you disconnect it?
  4. Does your board behave as described above? Do you see the change in device manager?
  5. What happens when you double-tap the reset button? Does the L LED fade in and out? Do you see the change in device manager?

thank you for reply, i have windows 10, the IDE version is 2.1.1, the Leonardo does disapper from device manager when i disconnect it, when i upload a program i don t see the change in device manager and i don t see the board s LED slowing fading in and out, however when i double tap the reset button the LED fade in and out and in the device manager i see arduino leonardo bootloader.
I didnt interfer with the port settings in Device Manager, and i have never been able to upload.

Now it gives me another message:

avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

 System wide configuration file is "C:\Users\luca talos smecheru\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

 Using Port                    : COM13
 Using Programmer              : avr109
 Overriding Baud Rate          : 57600

avrdude: ser_open(): can't open device ".\COM13": The system cannot find the file specified.

avrdude done. Thank you.

Failed uploading: uploading error: exit status 1

Do you know why this might be ?

I don't know under which circumstances you got that.

So there is hope :wink:

Part of the code that you upload handles the USB serial communication; variables used by this can be corrupted by your part of the sketch in which case the Leonardo either does not identify itself and / or does not react on the software reset issued by the IDE.

The first requirement to solve it is that the IDE needs to use a valid port to issue the reset command. The options basically are:

  • If your Windows has a COM1 in device manager, select that port in the IDE.
  • If you have a board like an Uno, Mega or classic Nano, connect it and select its port in the IDE. Do not use another board that has native USB.
  • If you have a TTL-to-USB adapter, connect it to the PC and select its port.

Keep your board as Leonardo.

Next upload an innocent sketch like blink. When the IDE reports the memory usage, double tap the reset button on the Leonardo. The upload should now succeed.

After this, you should be able to perform uploads in the usual way.

Note:
There is a 4th way to get a port but I have not managed to get it working in IDE 2.x (I could in IDE 1.x).

Double tap the reset button and in the IDE select the Arduino Leonardo bootloader port. Start an upload and just before the IDE reports the memory usage double tap the reset button. It's always a bit tricky but if you enable verbose output during compilation in file → preferences you can basically find the right moment; that moment is when you see a line like "linking it all together".

i don t why but now everytime i try to upload it gives me this message:
avrdude: Version "C:\Users\luca talos smecheru\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\luca talos smecheru\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega32u4 -cavr109 "-PCOM6" -b57600 -D "-Uflash:w:C:\Users\luca talos smecheru\AppData\Local\Temp\arduino\sketches\027A870490436DAEC8F2337E3B1B36D6/project_test1.ino.hex:i"
6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Users\luca talos smecheru\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

     Using Port                    : COM6
     Using Programmer              : avr109
     Overriding Baud Rate          : 57600
     AVR Part                      : ATmega32U4
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PA0
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
       lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : butterfly
     Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "C:\Users\luca talos smecheru\AppData\Local\Temp\arduino\sketches\027A870490436DAEC8F2337E3B1B36D6/project_test1.ino.hex"
avrdude: writing flash (3956 bytes):

Writing | ################################################## | 100% 0.37s

avrdude: 3956 bytes of flash written

avrdude done. Thank you.

Nothing wrong with that as far as I can see. It might be displayed in red but that does not necessarily indicate an error.

If the notification area (right bottom of the IDE 2.x) indicates a successful upload, the upload was successful.

You can make the output less verbose by disabling verbose output during upload under file → preferences. From memory, you will only see this part of the above

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
Device code: 0x44

and after i connected Uno and select its port in the IDE i remove the Uno from the port ?

my Windows has COM1 but its already used for communications port

In IDE 2.x. no. In IDE 1.x you can but there is no reason. Just keep the board as Leonardo.

In both IDEs you need to keep the Uno connected; the IDE needs to see have a valid serial port to use for the reset.

Which application / process uses it as a communication port? In my view / experience, it's a dummy port that is there for no reason.

it doesn t show any application that uses the communication port COM1

So use that and try.

but how ? i chnage the port number in device manager for arduino leonardo ?

In post #7 you have shown the output of a successful upload. So what are you trying to achieve?

No, in the IDE select the Leonardo as the board and select COM1 as the port.

if i select the COM1 in the IDE it gives me this message:
Failed uploading: uploading error: exit status 1

i could not successul uploade after the output of the post #7 it gives me this message:
Failed uploading: uploading error: exit status 1

i tried to upload a blink sketch on my macbook and it worked so the problem isn t the leonardo

In that case I don't know.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.