4

Note: This is a reference question (but feel free to write answers of your own!)


I uploaded code that contains a bug that causes my Arduino to immediately reset itself when starting using this code from the AVR libc FAQ. The built-in LED keeps flashing. Because it's in this state of constantly resetting, I'm unable to upload my sketch to it.

I tried holding the reset button while uploading and burning a new bootloader, but neither of those worked.

How do I get my Arduino out of this boot loop so I can upload sketches again?

glibg10b
  • 317
  • 1
  • 7

1 Answers1

4
  1. Start holding the reset button. This is to prevent the Arduino from entering the boot loop.
  2. Unplug the Arduino and plug it back in.
  3. Open a new sketch. Remove all of the code and replace it with int main(){}. This is to create a small program that will upload quickly.
  4. Start uploading the sketch. Avrdude will attempt to upload the sketch ten times -- each time it tries, the RX LED on the Arduino will flash briefly.
  5. Notice how often the LED flashes (0.2 Hz for me). Right before it flashes again, release the reset button. There's a small window of oppurtunity for avrdude to upload the sketch before the arduino starts up. If the TX and RX LEDs flash, success!
glibg10b
  • 317
  • 1
  • 7