Submitted by "Malte" and John McCorquodale:

patch #7876 JTAGICE mkII fails to connect to attiny if debugwire
is enabled AND target has a very slow clock
* jtagmkII.c (jtagmkII_getsync): When leaving debugWIRE mode
temporarily, immediately retry with ISP, rather than leaving.
* stk500v2 (stk500v2_program_enable): Implemented similar logic
for the JTAGICE3.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1183 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2013-05-17 16:23:55 +00:00
parent 203fe6d14a
commit 46f7b6b470
4 changed files with 40 additions and 9 deletions

View File

@ -1,3 +1,13 @@
2013-05-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by "Malte" and John McCorquodale:
patch #7876 JTAGICE mkII fails to connect to attiny if debugwire
is enabled AND target has a very slow clock
* jtagmkII.c (jtagmkII_getsync): When leaving debugWIRE mode
temporarily, immediately retry with ISP, rather than leaving.
* stk500v2 (stk500v2_program_enable): Implemented similar logic
for the JTAGICE3.
2013-05-16 Rene Liebscher <R.Liebscher@gmx.de> 2013-05-16 Rene Liebscher <R.Liebscher@gmx.de>
* configure.ac: reactivate check for TYPE_232H, which does not * configure.ac: reactivate check for TYPE_232H, which does not

5
NEWS
View File

@ -78,6 +78,8 @@ Current:
read device signature read device signature
- bug #37265: wrong page sizes for XMega64xx in avrdude.conf - bug #37265: wrong page sizes for XMega64xx in avrdude.conf
- bug #37942: Latest SVN can't program in dragon_jtag mode - bug #37942: Latest SVN can't program in dragon_jtag mode
- patch #7876 JTAGICE mkII fails to connect to attiny if debugwire
is enabled AND target has a very slow clock
* Keep track of input file contents * Keep track of input file contents
@ -134,6 +136,9 @@ Current:
traces, in particular in environments which do not offer traces, in particular in environments which do not offer
shell-style redirection functionality for standard streams. shell-style redirection functionality for standard streams.
* When leaving debugWIRE mode, immediately retry with ISP rather
than bailing out completely.
* Programmer types in configuration file are no longer keywords but * Programmer types in configuration file are no longer keywords but
specified as string. specified as string.

View File

@ -831,6 +831,8 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
if(mode < 0) return 0; // for AVR32 if(mode < 0) return 0; // for AVR32
tries = 0;
retry:
/* Turn the ICE into JTAG or ISP mode as requested. */ /* Turn the ICE into JTAG or ISP mode as requested. */
buf[0] = mode; buf[0] = mode;
if (jtagmkII_setparm(pgm, PAR_EMULATOR_MODE, buf) < 0) { if (jtagmkII_setparm(pgm, PAR_EMULATOR_MODE, buf) < 0) {
@ -855,11 +857,17 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
* program. * program.
*/ */
(void)jtagmkII_reset(pgm, 0x04); (void)jtagmkII_reset(pgm, 0x04);
if (tries++ > 3) {
fprintf(stderr,
"%s: Failed to return from debugWIRE to ISP.\n",
progname);
return -1;
}
fprintf(stderr, fprintf(stderr,
"%s: Target prepared for ISP, signed off.\n" "%s: Target prepared for ISP, signed off.\n"
"%s: Please restart %s without power-cycling the target.\n", "%s: Now retrying without power-cycling the target.\n",
progname, progname, progname); progname, progname);
return JTAGII_GETSYNC_FAIL_GRACEFUL; goto retry;
} }
} else { } else {
return -1; return -1;

View File

@ -1105,7 +1105,7 @@ static int stk500v2_program_enable(PROGRAMMER * pgm, AVRPART * p)
{ {
unsigned char buf[16]; unsigned char buf[16];
char msg[100]; /* see remarks above about size needed */ char msg[100]; /* see remarks above about size needed */
int rv; int rv, tries;
PDATA(pgm)->lastpart = p; PDATA(pgm)->lastpart = p;
@ -1120,6 +1120,8 @@ static int stk500v2_program_enable(PROGRAMMER * pgm, AVRPART * p)
/* Activate AVR-style (low active) RESET */ /* Activate AVR-style (low active) RESET */
stk500v2_setparm_real(pgm, PARAM_RESET_POLARITY, 0x01); stk500v2_setparm_real(pgm, PARAM_RESET_POLARITY, 0x01);
tries = 0;
retry:
buf[0] = CMD_ENTER_PROGMODE_ISP; buf[0] = CMD_ENTER_PROGMODE_ISP;
buf[1] = p->timeout; buf[1] = p->timeout;
buf[2] = p->stabdelay; buf[2] = p->stabdelay;
@ -1185,14 +1187,20 @@ static int stk500v2_program_enable(PROGRAMMER * pgm, AVRPART * p)
cmd[1] = CMD3_MONCON_DISABLE; cmd[1] = CMD3_MONCON_DISABLE;
if (jtag3_command(pgm, cmd, 3, &resp, "MonCon disable") >= 0) if (jtag3_command(pgm, cmd, 3, &resp, "MonCon disable") >= 0)
free(resp); free(resp);
fprintf(stderr,
"%s: Target prepared for ISP, signed off.\n"
"%s: Please restart %s without power-cycling the target.\n",
progname, progname, progname);
} }
} }
pgm->cookie = mycookie; pgm->cookie = mycookie;
if (tries++ > 3) {
fprintf(stderr,
"%s: Failed to return from debugWIRE to ISP.\n",
progname);
break;
}
fprintf(stderr,
"%s: Target prepared for ISP, signed off.\n"
"%s: Now retrying without power-cycling the target.\n",
progname, progname);
goto retry;
} }
break; break;