Not detecting Leonardo

Hello everyone!

My PC does not detect my arduino Leonardo. Last time I connected the arduino it was also acting weird. I think it is because of a test program that repeats a keyboard stroke continuously. Do you know a way to reset the arduino so that it deletes the program?

Thanks a lot!
Wildplasser

Hi,
If you overload the Serial port, then the Arduino IDE can not find the bootloader.
I did not know that overloading the keyboard strokes could do the same, but I guess it is the same kind of USB device inside the ATmega32U4.

First of all, you need an empty or good sketch.
When uploading, press the reset button twice at the right moment. It is not that hard, everyone can do it (it is just me who can't).
If that does not work, then you can burn the bootloader with a programmer.

See [solved] Bricked Arduino Leonardo - #11 by sterretje for the steps to take.

Hallo Koepel en Sterretje

Het lukt me niet om een programma te uploaden. De pc detecteert op geen enkel moment dat er een Arduino aangesloten is dus ik kan ook niet de juiste poort selecteren.

In case I made a mistake and you don't speak Dutch:
I am unable to upload a programme to the Leonardo. The computer doesn't detect that an Arduino is connected at all, so I can't select the right port either.

Thanks!
Wildplasser

This is the English section. You are not supposed to use a language that others don't understand. Even if only two reply, this topic might be read by many more. Some steenkolenengels (Dunglish) is no problem.
The Dutch section is here: Nederlands - Arduino Forum

Both sterretje and me are from the Netherlands, as you may have guessed :wink:

I have a USBasp V2 programmer with a 10-pin to 6-pin adapter to burn a bootloader. It is also possible to use a Arduino Uno as a programmer.
You have a 50% chance that burning the bootloader will unbrick the Leonardo.

Have you been using 12V ? If a wire with 12V touches the Leonardo board, then it is damaged.

You could buy a new board, while trying to fix this one.

First you need to know if the bootloader is still OK. If you press and release the reset the button on the Leonardo, the L-led should fade in and out for a couple of seconds. If that does not happen, you will have to burn the bootloader.

Below are three ways that possibly can get you a serial port in the IDE.

  1. If you use Windows, does your PC show COM1 or COM2? If so, select one of those. I think that a similar apporach will be possible in Linux/Mac.
  2. If you have another Arduino, connect it to the PC and select the its serial port. You need to use a board that does not have native USB (e.g. Nano, Uno, Mega)
  3. If you have a TTL-to-USB adapter, connect it to the PC and select its port.

It does not matter what you select, as long as the IDE has a valid port that it can use to send the software reset to. And don't worry if you use (2), the other Arduino will not be programmed as it will not react on the software reset.

Once you have a serial port in the IDE, you can do the upload as described.

1 Like

Hello again!
Not in Dutch this time so back with deeple. :grin:

I checked some things. First of all, the L LED flashes when I click the reset button, so if I understand correctly, I don't need to burn a bootleader?
I don't have any modules to do this but I do have an arduino Uno.

I did try star 2nd option. I connected my Arduino Uno and chose the right port, and pulled out the Usb. Then I held down the reset button on the Leonardo and uploaded an empty program. When the program displayed the memory I released the reset button.
Unfortunately, the program gave an error message...

One last thing I noticed. When I connect my Uno, the L LED lights up. My Leonardo does not do this (it does if I reset it, +/- 8 seconds).

thanks & Greetz form Belgium :grin:!

Which error message?

You were not supposed to disconnect the Uno, maybe a mistake in my description; problem is that the IDE will stop at the moment that it can't open the Uno port.

That's the sign that the bootloader is active; it should be fading in and out. Do not compare it with the Uno, they work differently.

1 Like

Sometimes the programme gives an error on uploading and sometimes it says it cannot find a port.

Sorry Sterretje, I don't really understand what you mean.

All right :ok_hand:

Does that indeed happen?

OK, might be a misunderstanding from my side. Which USB did you pull out? Uno or Leonardo? You will have to keep the Uno connected.

These should be your settings (COM4 can be a different port)

image

In the status bar of the IDE at the right bottom you should see

image

To see a little more what is happening, disable verbose output during compilation and enable verbose output during upload in file -> preferences in the IDE and start an upload with the reset button of the Leonardo pressed. The below is my output.

Sketch uses 3956 bytes (13%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port COM4
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, COM16, } => {COM16, }
Found upload port: COM16

COM1 is a standard Windows port, COM4 is my Uno. The PORTS lines indicate that the IDE is trying to find a bootloader. At about the 4th or 5th PORTS line, I released the reset button of the Leonardo. The 6th PORTS line indicates that it found the (Leonardo's) upload port on COM16.

I tried to write a sketch that will make the Leonardo disappear but did not manage quickly. If you still have the sketch that you suspect that made the Leonardo disappear, please post it so I can simulate.

Hi

Yes, the LED blinked for a few seconds

Sorry, I don't have the programme any more. In any case, it was a try-out with a keyboard command; Keyboard.press, Keyboard.print or keyboard.write. I guess it was a very stupid program with only the keyboard command in the loop.

Sorry I completely misunderstood. I had pulled out the uno and replaced it with the Leonardo.
But I did it again in this way:
So this is what I did, can you just check if I did it right this time?
I connected both arduinos to the PC. Then I selected port of the uno and set the board to Leonardo. The correct text appeared at the bottom of the screen.
I then pressed the reset button on the Leonardo and uploaded the programme. When the "PORTS {COM11, } / {COM11, } => {}" line appeared I released the reset button. This is the information that the program gave when uploading.

This is the uploadinformation I get:

De schets gebruikt 3462 bytes (12%)  programma-opslagruimte. Maximum is 28672 bytes.
Globale variabelen gebruiken 149 bytes (5%) van het dynamisch geheugen. Resteren 2411 bytes voor lokale variabelen. Maximum is 2560 bytes.
Een reset wordt geforceerd (met 1200bps openen/sluiten) op poort COM11
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
Uploading using selected port: COM11
C:\Users\wildplasser\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\wildplasser\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM11 -b57600 -D -Uflash:w:C:\Users\MATTHI~1.MON\AppData\Local\Temp\arduino_build_533328/sketch_jun08a.ino.hex:i 

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\wildplasser\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM11
         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: .avrdude: butterfly_recv(): programmer is not responding

avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = "F"; type = @
    Software Version =  .v; Hardware Version = �. 
avrdude: butterfly_recv(): programmer is not responding
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: exit bootloader

avrdude done.  Thank you.

de geselecteerde seriële poort 
 bestaat niet of uw board is niet aangesloten.

Steps are correct as far as I can see.

One more thing to check? What happens in Windows device manager when you press and release the reset button. Below the two scenarios.

Normal operation

image

After press/release reset button

image

If you don't see the second one, you are possibly using a charge-only cable that does not carry the USB data signals; try other cables (ones that are proven to work with e.g. a cell phone to copy data from cellphone to PC).

The only stupid ( :slight_smile: ) thing might have been to forget to use `Keyboard.release() or Keyboard.releaseAll() after the use of Keyboard.press().

I connected the Arduino with another cable and there came the familiar sound. I shall never forget that mini-usb's also have charge-only cables! :laughing:
Thanks @Sterretje and @Koepel for helping me out and for introducing me to the wonderful world of Arduino's!

Greetz Wildplasser

Great.

You can mark your topic as solved by clicking the "solution" button under the most useful reply.

1 Like

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