Killed Arduino Leonardo with "power_all_disable()"

Hey guys,

I accidentally "killed" my Arduino Leonardo with the "power.h" library. I used a power_all_disable() at the setup point.

Problem now is, that the Arduino is not getting detected as a serial device from my computer, so I can't upload any new sketches. I got an USB to Serial cp2102 stick, and hoped that I could overwrite the sketch, but I couldn't get it done.

Does someone maybe got a clue, how I can get my Arduino working again?

Press the reset button just before the upload begins?

You have about 1 to 2 seconds for this during which the bootloader is active.

If that doesn't help, use an ICSP programmer, connect it to the ICSP header and choose "Upload bootloader".

majenko:
Press the reset button just before the upload begins?

Tried that, but it didn't work.

Here is what I tried:
Connected the USB-cp2102 stick with the computer. Connected tx and rx with tx and rx on the Arduino Leonardo, and the GND and 5V with the Arduino ones.

In the Arduino IDE, I selected Board "Arduino Leonardo", Port selected the USB-cp2102 one, Programmer: AVR ISP.

Choose the Blink example sketch, hold the reset button on the Arduino, hit the upload button. After compiling released the reset button. But it just says Uploading... and nothing happends.

I also tried to switch the tx and rx lines, and also connected external power via usb at the arduino instead of the 5v from the usb-serial stick.

@pylon
Soo you mean, compile sketch I want to upload. Press the reset button, connect power to arduino, release reset and hit immediately the upload button?

Connected the USB-cp2102 stick with the computer. Connected tx and rx with tx and rx on the Arduino Leonardo, and the GND and 5V with the Arduino ones.

You cannot upload sketches to the Leonardo using the hardware serial interface, it doesn't have a bootloader that supports this.

In the Arduino IDE, I selected Board "Arduino Leonardo", Port selected the USB-cp2102 one, Programmer: AVR ISP.

Your USB-to-serial converter (CP2102) isn't an AVR ISP, that's another piece of hardware.

Soo you mean, compile sketch I want to upload. Press the reset button, connect power to arduino, release reset and hit immediately the upload button?

No. Connect the Leonardo as usual at the micro USB connector. Press (and hold) the reset button on the Leonardo, push the upload button on the IDE, as soon as the compilation is finished (and the upload should start), release the reset button on the Leonardo. You might need several tries until you get the correct timing but this worked for most people after they got some practice.

An ICSP programmer is a special hardware that you connect to the header more or less in the middle between pin 0 and pin A5 (6 pins). The cheapest on the market are usually of type USBtiny. With such a programmer you can get your Leonardo to life again for sure.

Hmm, ok.

Sadly the "normal" uploading via usb isn't working, because the Arduino isn't getting detected as an serial device. So I can't upload via the Arduino IDE.

But with another Arduino I should be able to bring this one back to life? I just burn another bootloader via this tutorial:

Right?

There is a brief period (a few seconds) right after reboot where the board should be detected by the computer. During that period the uploads should work fine.

majenko:
There is a brief period (a few seconds) right after reboot where the board should be detected by the computer. During that period the uploads should work fine.

Nope, it isn't. No com device, checked the device manager.

That device is visible for about 1 second, maybe two. Did you really check the device manage in that time frame? As I wrote: you want get the correct timing in the first try but most people had success with this method.
If you don't have the time to try, get an ICSP programmer and burn a new bootloader to the Leonardo.

pylon:
That device is visible for about 1 second, maybe two. Did you really check the device manage in that time frame? As I wrote: you want get the correct timing in the first try but most people had success with this method.
If you don't have the time to try, get an ICSP programmer and burn a new bootloader to the Leonardo.

Nope, it isn't visible. I checked it several times, plug-in and unplug and looking at the device manager. There is no "serial" device detected. Not even for a millisecond.

So it seems that the only way to get the arduino back working, is programming it via an external programmer. I have to admit that I was a little bit suprised, that there is no way to just reset the arduino back to "factory settings".

I'm a bit surprised that the leonardo isn't showing up even briefly when you press reset - I've bricked my leo many times and it always shows up after a reboot for the brief bootloader period, but perhaps the function you called has affected the bootloader somehow.

Short answer is, borrowing an arduino from a friend and doing the ArduinoISP thing is the easiest way to get it back.
(and the reason the Leo is such a pain with a hung sketch is because it doesn't have a dedicated USB comms/bootloader chip, but that's also why it can do HID keyboard, mouse and joystick)

They should really have provided a "program" button on it - only a few ยข more to implement. Hold the program button down while resetting / plugging in and it enters the bootloader and stays there. But no, they did the silly open-at-1200-baud idiotic thing.

It does give you a good incentive to write reliable code though :wink:

There's also the problem that Windows is generally pretty sh*t at detecting USB devices. It could well be that it's taking longer for windows to decide that it's got a COM port than the COM port exists for, what with it having to reinstall the drivers into the kernel, and play silly little tunes. You could probably do it fine with a Linux machine.

By the way, the LED labelled as "L" should be throbbing gently while it's in bootloader mode. All the time that is going in the board should be detected in Windows and you should be able to upload to it. It's only when it stops throbbing that your code will run.