开发者

Arduino stuck in an infinite loop

My Arduino is stuck in an infinite loop trying to read from a pin and print it to the serial console. I can't upload any other pro开发者_如何学Pythongrams now. What can I do to get the chip out of the loop?


Remove the USB connection, close the IDE, open the IDE, open BareMinimum, hold the reset button, plugin the USB connection, click the upload button 1/2 a second after removing your finger from the reset button.


If you're using an Arduino Uno, you might want to check out Updating the Atmega8U2 on an Uno or Mega2560 using DFU. Apparently there was a bug in the interface firmware.


This may sounds silly but what about disconnect it from the power supply to reset the MCU?

Edit:

I see it is powered via USB; then make sure you disconnect the device, remove/discharge any battery/capacitors whatsoever. If nothing works, close down the Arduino IDE, change the USB port you are using (sometimes it does happen that they get stuck..), reboot the PC.. Good luck!


Reprogramming the interface firmware (see ViennaMike's response) did not work for me, so I purchased another Arduino and turned it into an ISP programmer and overwrote the offending application:

https://stackoverflow.com/a/8453576/1090713

While this approach had some cost, I now have another tool and a way to save an Arduino in the future.


Upload your boot loader using Avr pocket programmer. This solves your MCU reset. Use Watchdog timer instruction while coding infinite loop provided you are dealing with critical parameter to be written when it restarts.


If you run across the same problem with Arduino Yun, try uploading empty sketch using WIFI as port. It worked for me when I couldn't upload new sketch via USB.


The Arduino will wait a short while when attempting to upload. So you can press the reset and hold it until the Ide shows attempting to upload. then let go of it.

The problem can be that when you click upload the Ide first compiles then at the end of the process attempts to upload. So pressing reset, clicking compile and immediately letting go of reset doesn't always work because you let go of the reset too quickly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜