bug #30756: When setting SUT to 64ms on XMEGA, avrdude doesn't

read device signature
* main.c: When reading the signature yields 0x000000 or 0xffffff,
retry (up to twice) after some progressive delay.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1084 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2012-04-20 12:33:15 +00:00
parent 973e615dbe
commit 2343e419d3
3 changed files with 44 additions and 20 deletions

View File

@ -1,3 +1,10 @@
2012-04-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #30756: When setting SUT to 64ms on XMEGA, avrdude doesn't
read device signature
* main.c: When reading the signature yields 0x000000 or 0xffffff,
retry (up to twice) after some progressive delay.
2012-04-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATxmega16D4, ATxmega32D4, ATxmega64D4,

2
NEWS
View File

@ -60,6 +60,8 @@ Current:
supported error
- bug #28744: Can't load bootloader to xmega128a1
- bug #29019: pagel/bs2 warning when uploading using stk500 to xmega
- bug #30756: When setting SUT to 64ms on XMEGA, avrdude doesn't
read device signature
* Keep track of input file contents

55
main.c
View File

@ -989,6 +989,11 @@ int main(int argc, char * argv [])
* are valid.
*/
if(!(p->flags & AVRPART_AVR32)) {
int attempt = 0;
int waittime = 10000; /* 10 ms */
sig_again:
usleep(waittime);
if (init_ok) {
rc = avr_signature(pgm, p);
if (rc != 0) {
@ -1022,11 +1027,17 @@ int main(int argc, char * argv [])
if (sig->buf[i] != 0x00)
zz = 0;
}
if (quell_progress < 2) {
fprintf(stderr, "\n");
}
if (ff || zz) {
if (++attempt < 3) {
waittime *= 5;
if (quell_progress < 2) {
fprintf(stderr, " (retrying)\n");
}
goto sig_again;
}
if (quell_progress < 2) {
fprintf(stderr, "\n");
}
fprintf(stderr,
"%s: Yikes! Invalid device signature.\n", progname);
if (!ovsigck) {
@ -1037,23 +1048,27 @@ int main(int argc, char * argv [])
exitrc = 1;
goto main_exit;
}
} else {
if (quell_progress < 2) {
fprintf(stderr, "\n");
}
}
}
if (sig->size != 3 ||
sig->buf[0] != p->signature[0] ||
sig->buf[1] != p->signature[1] ||
sig->buf[2] != p->signature[2]) {
fprintf(stderr,
"%s: Expected signature for %s is %02X %02X %02X\n",
progname, p->desc,
p->signature[0], p->signature[1], p->signature[2]);
if (!ovsigck) {
fprintf(stderr, "%sDouble check chip, "
"or use -F to override this check.\n",
progbuf);
exitrc = 1;
goto main_exit;
if (sig->size != 3 ||
sig->buf[0] != p->signature[0] ||
sig->buf[1] != p->signature[1] ||
sig->buf[2] != p->signature[2]) {
fprintf(stderr,
"%s: Expected signature for %s is %02X %02X %02X\n",
progname, p->desc,
p->signature[0], p->signature[1], p->signature[2]);
if (!ovsigck) {
fprintf(stderr, "%sDouble check chip, "
"or use -F to override this check.\n",
progbuf);
exitrc = 1;
goto main_exit;
}
}
}
}