-
-
Notifications
You must be signed in to change notification settings - Fork 7k
avrdude 6.3-20171130 fails with attiny13a #8198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The first signal that something is going wrong seems |
@facchinm, sounds like the programmer is supported, but doesn't implement everything that is being used (e.g. perhaps not block writes, no chipe erase or no voltage control, stuff like that). Still, if some operation that is expected is not executed, that could cause a problem. Pity the error message doesn't say what operation exactly. |
Here is the command line being issued by the Arduino IDE.
@facchinm please also keep in mind that this command worked perfectly with the avrdude 6.3 that came with version 1.8.5 of the Arduino IDE. The only thing that has changed is the version of avrdude. Also, it has been my experience that all "usbtiny" class programmers produce the "operation not supported" error for certain chips, but seem to have no problem programming these chips anyway. Again, my original post is a new problem that only appeared with avrdude 6.3-20171130. Does anybody know why the Arduino team switched versions or what is different about this version of avrdude? |
@bratoff we switched version to support new Microchip AVR chips with UPDI programming interface. The change should not affect older chips/programmers so I'll double check your commandline. |
I have both versions of avrdude on my machine. Rather than downgrade my Arduino configuration, I am now programming the atttiny13a from the command line so that I can force the older version of avrdude. |
@bratoff the best way would be to bisect the avrdude history until we find the root cause, but unfortunately I don't have an usbtiny programmer to test it. Could you send both the successful output and the broken one launched with |
@facchinm Here are the console outputs from the two runs. The two versions are definitely issuing different commands to initialize the chip and read the signature. This is the successful run using the avrdude from the 1.6.21 AVR core: And this is the broken run using the avrdude from the latest AVR core: From what I can see in the successful run the chip does not respond to the first Programming Enable command, avrdude retries and is successful on the second attempt. Everything else then works after that. In the broken run, avrdude apparently does not detect that the first Programming Enable command did not get a valid response and does not retry. That easily explains why nothing works after that - the chip was never put in programming mode. Thank you very much for your follow-up. I hope this helps track down the issue. |
The only commit regarding |
Great to hear that! I think the patch can be further reduced into changing this line; I'm sending you another binary for testing and if it works I'll file a PR for mainline avrdude. diff --git a/usbtiny.c b/usbtiny.c
index 1f86b1d..8c303de 100644
--- a/usbtiny.c
+++ b/usbtiny.c
@@ -503,7 +503,7 @@ static int usbtiny_initialize (PROGRAMMER *pgm, AVRPART *p )
}
for (tries = 0; tries < 4; ++tries) {
- if (pgm->program_enable(pgm, p) >= 0)
+ if (pgm->program_enable(pgm, p) == 0)
break;
// no response, RESET and try again
if (usb_control(pgm, USBTINY_POWERUP,
-- |
Reported mainline at https://savannah.nongnu.org/patch/index.php?9728 |
@facchinm, Nice fix, some good digging there :-) |
As reported on arduino/Arduino#8198 , `patch #8924: Enable TPI for usbtiny` broke the functionality of such programmer for non TPI targets. The refactor included reworking `usbtiny_initialize`, which used to call `pgm->program_enable` once and, in case of failure, reset the programmer and call it again. The new code considers the return code successful if >=0, so the first failure is not reported and the programmer is not being reset. The attached patch restores the previous behaviour by checking if `pgm->program_enable() == 0` Cross reference: https://savannah.nongnu.org/patch/index.php?9728
The avrdude team accepted the patch in January, but it has not been included in the 1.8.9 release. |
The patch has been merged in facchinm/avrdude@a45d203 and is available on megaAVR core since 1.8.1 (on AVR it will arrive soon). |
I receive the following error output when attempting to program an attiny13a using avrdude 6.3-20171130, which is installed by Arduino 1.8.7. If I revert to the previous version of avrdude (by installing version 1.6.21 of Arduino AVR Boards), everything works normally.
I can reproduce the exact same behavior by running avrdude from a command prompt, completely outside of the Arduino IDE, using the same configuration file, command parameters and programmer. IMO, this isolates the issue to the 20171130 release of avrdude.
I have tried several other AVR family chips, and of those I've tried only the attiny13a appears to have this problem.
I have also tried several different versions of avrdude.conf, and that made no difference.
I do not have any other type of programmer than the usbtiny, so I cannot determine if that is a factor.
The text was updated successfully, but these errors were encountered: