Sometime I update my sketch in the Arduino environment, and when I click on the transfer arrow but forget to plug my arduino (I'm using the UART in my project so every time I need to plug/unplug some wires) it's a drama, avrdude throw this for at least 2 minutes :
avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x32
It's a real pain because I can't stop avrdude when this happens. Is there a way to configure the Arduino environment to disable it?
2 Answers 2
Unfortunately, MAX_SYNC_ATTEMPTS
is a constant in the source code, and one which appears several times.
avrdude is an open source project, so customizing and building it should be relatively straightforward. Since it is a numeric rather than string value, and is checked in several places, simply modifying the binary is likely to be tricky.
One can of course manually kill the process, though it is annoying to have to.
Another approach could be to write a wrapper which might potentially do some sanity checking first (does any other process have the port open?) and then would launch avrdude as its child, passing through all the arguments. By monitoring the output before passing it on, it should be possible to detect this message and terminate the avrdude instance automatically.
I had the same question and found following solution in linux: write a script,
#!/bin/bash
avrdude=`ps -C avrdude | tail -n 1 | head -c 7`
kill $avrdude
store it and connect it with a shortcut
killall avrdude
and it stops it...