Bricked Arduino Leonardo

I wrote a script for the leonardo years ago but stupidly I just made it constantly press the the a key, I followed the guide about holding the reset button and then uploading when memory usage appears, but then the list of ports go empty when I press the reset button. Is there anyway to fix this?

try a double reset

How do i do that?

Just did a double reset, and used verbose output and got this:

Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avrdude -CC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v2 -Pusb -Uflash:w:C:\Users\Harvey\AppData\Local\Temp\arduino_build_832238/Blink.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:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.57.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : stk500v2
avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104)

avrdude done.  Thank you.

An error occurred while uploading the sketch

the port is right and board selected is right as well

select Leonardo in Tools menu

If you don't come right, which operating system are you using and which version of the IDE?

I did that and selecting uno, neither worked

Windows 10 pro, arduino ide 1.8.19

OK

It should be sufficient to keep the Leonardo in reset till just before the actual upload starts. The easy way is to enable verbose output during upload under file → preferences. When the IDE states "linking everything together", release the reset button.

If you have difficulty finding the right moment to release the reset button, you can use the below procedure.

Always select the Leonardo as the board.

If your Windows has a COM1, select it as the port. If your Windows does not have COM1, hook up your Uno and select its port; keep the board as Leonardo and keep the Uno connected. If you have a dedicated TTL-to-USB adapter, you can use that instead of the Uno; again keep the board as Leonardo and select the port of the TTL-to-USB adapter.

The result of this is that the IDE will see a valid port when it issues the software reset (opening and closing the serial port with a baud rate of 1200 baud).

Keep your Leonardo in reset and connect it to the PC. In the IDE, start the upload of an innocent sketch (e.g. blink); Leonardo still in reset. When the IDE reports the memory usage, release the reset and double-tap it; The double-tap will invoke the boot loader.

I would advice to add a safety pin to your code; only if that pin is connected to GND, allow your Leonardo to act as a HID. So you can easily prevent the spamming (and other possible issues) and you don't have to keep the Leonardo in reset.

Notes:

  1. While the boot loader is active, you should se the L-LED fade in and out.
  2. The boot loader times out after approximately 8 seconds.

since the avrdude output you posted is for Uno, it is useless for troubleshooting Leonardo

1 Like

This is with board set as leonardo:

Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
H:\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CH:\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega32u4 -cstk500v2 -Pusb -Uflash:w:C:\Users\Harvey\AppData\Local\Temp\arduino_build_116017/Blink.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 "H:\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : stk500v2
avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104)

avrdude done.  Thank you.

An error occurred while uploading the sketch

Bit confused, about why an uno is needed, I don't have one immediately to hand, but have a nano coming shortly, can I use that to burn the boot loader onto the Leonardo?

Regarding post #11

What are you trying to do? It looks like you're trying to upload using programmer. Why? Do a normal upload.

The problem I am having is that I can't select a port when the reset button is being pressed on the Leonardo

The Uno is needed to re-bootload the Leo.
A Nano (Classic - not an 'Every' or any other type) may be suitable, but following instructions / tutorials that use a Uno may be 'confusing'.

Arduino Leonardo Bootloader Replacement - iFixit Repair Guide

You have to press and release (often referred to as tap). Now the big question is what the Leonardo does when you press and release the reset button. Does the L-LED fade in and out for approximately 8 seconds? And in Windows device manager you should see a Leonardo boot loader appear instead of the standard Leonardo..
On my Leonardo, that is the behaviour. But I have seen reports where you have to double tap the reset (tap it twice in quick succession).

The second suggestion that I gave earlier allows you to select a port that is not related to the Leonardo. Does your Windows have a COM1? If so use that. If not (and you don't have an Uno/Mega/Nano), double tap the reset button of the Leonardo; in the IDE you have approximately 8 seconds to select the bootloader port. This should work in IDE 1.x, I have never managed to get it right in IDE 2.x.

After that, you can follow the process of keeping the Leonardo in reset, starting an upload and release the reset at the right moment. If your Leonardo requires the double tap reset to invoke the boot loader, do that immediately after releasing the reset.

Not in my scenario :wink: It is needed to provide the IDE with a valid serial port so when the IDE issues the software reset (opening and closing the serial port with a baudrate of 1200 baud); so it does not bark that there is no serial port.

OK, different method, perspective.

The only time I ever had trouble with a Leo I was able to hold the button.
My link is the re-bootload procedure (if that's necessary). There are probably others, maybe one using a Nano.

Thank you so much!! I followed your instructions and saved my device!

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\H\AppData\Local\Temp\arduino_build_620511/Blink.ino.hex"
avrdude: writing flash (3956 bytes):

Writing | ################################################## | 100% 0.40s

avrdude: 3956 bytes of flash written
avrdude: verifying flash memory against C:\Users\H\AppData\Local\Temp\arduino_build_620511/Blink.ino.hex:
avrdude: load data flash data from input file C:\Users\H\AppData\Local\Temp\arduino_build_620511/Blink.ino.hex:
avrdude: input file C:\Users\H\AppData\Local\Temp\arduino_build_620511/Blink.ino.hex contains 3956 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.15s

avrdude: verifying ...
avrdude: 3956 bytes of flash verified

avrdude done.  Thank you.


You're good now?