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 ee8a3b1f4d
commit 98d2f6fff8
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> 2012-04-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATxmega16D4, ATxmega32D4, ATxmega64D4, * avrdude.conf.in (ATxmega16D4, ATxmega32D4, ATxmega64D4,

2
NEWS
View File

@ -60,6 +60,8 @@ Current:
supported error supported error
- bug #28744: Can't load bootloader to xmega128a1 - bug #28744: Can't load bootloader to xmega128a1
- bug #29019: pagel/bs2 warning when uploading using stk500 to xmega - 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 * Keep track of input file contents

19
main.c
View File

@ -989,6 +989,11 @@ int main(int argc, char * argv [])
* are valid. * are valid.
*/ */
if(!(p->flags & AVRPART_AVR32)) { if(!(p->flags & AVRPART_AVR32)) {
int attempt = 0;
int waittime = 10000; /* 10 ms */
sig_again:
usleep(waittime);
if (init_ok) { if (init_ok) {
rc = avr_signature(pgm, p); rc = avr_signature(pgm, p);
if (rc != 0) { if (rc != 0) {
@ -1022,11 +1027,17 @@ int main(int argc, char * argv [])
if (sig->buf[i] != 0x00) if (sig->buf[i] != 0x00)
zz = 0; zz = 0;
} }
if (ff || zz) {
if (++attempt < 3) {
waittime *= 5;
if (quell_progress < 2) {
fprintf(stderr, " (retrying)\n");
}
goto sig_again;
}
if (quell_progress < 2) { if (quell_progress < 2) {
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
if (ff || zz) {
fprintf(stderr, fprintf(stderr,
"%s: Yikes! Invalid device signature.\n", progname); "%s: Yikes! Invalid device signature.\n", progname);
if (!ovsigck) { if (!ovsigck) {
@ -1037,6 +1048,9 @@ int main(int argc, char * argv [])
exitrc = 1; exitrc = 1;
goto main_exit; goto main_exit;
} }
} else {
if (quell_progress < 2) {
fprintf(stderr, "\n");
} }
} }
@ -1057,6 +1071,7 @@ int main(int argc, char * argv [])
} }
} }
} }
}
if (init_ok && safemode == 1) { if (init_ok && safemode == 1) {
/* If safemode is enabled, go ahead and read the current low, high, /* If safemode is enabled, go ahead and read the current low, high,