arduino / arduino/Arduino

If the controller resets externally for some reason while writing the code, AVRdude gets stuck in an infinite loop avrdude: stk500_recv(): programmer is not responding

Open
#7,704 8 comments 0 reactions 0 assignees View on GitHub
Architecture: AVR Component: Uploading Type: Bug
Dominant language
Java
Stars
14.6k
Forks
7k
PR merge metrics
No merged PRs in 30d

Description

Hi,

I know this is an avrdude issue, but i have detected the same issue with the AVRdude bundled with the Arduino IDE 1.8.4 on MacOs

To replicate the same, you will need an Arduino, and a compiled hex file with relatively large size (2 to 4kb should be perfect).
Exact conditions for error

1. Use the following code to start upload to the Arduino
./avrdude -c arduino -p m328p -P /dev/cu.usbmodem1411 -U flash:w:.hex
2. Keep your hand ready on the reset button of the Arduino.
3. As soon as avrdude goes into write mode press the reset button.
4. Do not release the button until avrdude starts giving the error
avrdude: stk500_recv(): programmer is not responding
5. Leave the reset button.

The code gets stuck in the same loop and keeps printing the error message every 1 second.
I know I can fix this for myself by resetting the board again at the right time, but then again, I feel that the code should be able to handle this and at the least exit so that it does not claim system resources.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the provided avrdude command, Arduino hardware, and compiled 2–4 KB hex file while holding reset during writing. No source file or test is named, so locate the retry loop that repeatedly reports stk500_recv() programmer-not-responding errors. Done means the process exits instead of continuing indefinitely and retaining system resources.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, macos
Domain
cli, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.