EEVblog® Electronics Community Forum
Electronics => Microcontrollers => Topic started by: ppTRN on May 21, 2023, 07:06:25 pm
-
Hi, I uploaded a very stupid program into my arduino yun (Atmega16U4)
void loop(){
cli();
}
As soon as i uploaded it windows notified me that "usb device not responding" and told me that it might not be funcional. Tried to upload blink(), reset and immediatly try to upload, tried to reupload bootloader, nothing. Did I screw up?
-
cli() disables interrupts. Disabling interrupts crashes the USB link to the host after approximately 1ms when the Arduino fails to respond to USB link activity, resulting in a 'dirty' disconnect.
Try pressing the Arduino reset button twice in quick succession. It should then enter USB bootloader mode, and you then have about eight seconds to select the correct COM port and upload a good sketch (e.g. 'Blink') before it drops out of bootloader mode and starts your FUBARed code.
-
Uploading a program that disables interrupts (cli()) in the loop() function of your Arduino Yun sketch can indeed cause issues with the board's functionality. Disabling interrupts can lead to a situation where the board becomes unresponsive or behaves unexpectedly.
-
It's not even that it's in the loop() function. Even if it was in setup(), disabling interrupts and not re-enabling them will prevent responding to external interrupt-driven communication -- or even timers.
You should always endeavour to put as few instructions as possible between cli() and sei().
-
Try pressing the Arduino reset button twice in quick succession. It should then enter USB bootloader mode, and you then have about eight seconds to select the correct COM port and upload a good sketch
Thanks, I did not know this boot mode. I will try it as soon as possible.
-
It worked! Thank you very much