Arduino IDE sending avrdude commands to avrisp2 too fast

Hi, have come across an issue when burning a bootloader with the IDE.

The IDE sends the 2 avrdude commands too quickly without the AVRispMK2 getting a chance to reset.

I tested this with a batch file by copy/pasting the avrdude commands from the verbose output of the Arduino IDE window.

I was able to reproduce the issue by sending the commands 1 after another immediately using a batch file. I tried the same again with 'wait 1' to add a 1 second delay to the batch file between commands and the issue was resolved.

This issue may depend on speed of computer. It would be good to experiment with delays as a full 1 second delay may not be required.

If anyone has any idea how i might add and accurate sub 1s delay to a batch file I'd be happy to test and report my findings.

PC is an i5 3570K, 8gig, Win7x64, Intel SSD

Cheers.

It isn’t a timing issue and adding/modifying delays is the wrong way to address this issue.
This is a an outstanding bug in avrdude.
It is due to the way avrdude and libusb handle the USB bus.

I reported this a long time ago - back in 2011, but am unable to get the avrdude author to fix it.
He doesn’t like the 6 line patch.

See these bug reports for more details:

Here is the savanah bug report for avrdude:
While I reported this for the AVR dragon, it also applies to other Atmel devices.

http://savannah.nongnu.org/bugs/?34339

Here is the bug reported to the Arduino bug list:
https://code.google.com/p/arduino/issues/detail?id=650&q=AVR%20dragon

And here it is on the new github issues list:

It is such a small easy to fix thing, yet I was unable to get the fix in the main line code.
I patch the avrdude code and build my own version.
It would be nice if the Arduino team could patch it in their release since Joerg won’t fix it in the mainline code.

As an alternative the IDE could do its programming in a single avrdude command rather than 2. This also solves the issue since it avoids the avrdude bug.

Every few years I bring it up, but can’t seem to get it fixed.
The irony is that it primarily affects Atmel products like the AVR dragon, and MK series programmers/debuggers.
So sad…

I guess I’ll poke Arduino team again to see if we can get this fixed.

— bill