mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-16 18:44:17 +00:00
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:
20
stk500v2.c
20
stk500v2.c
@@ -1105,7 +1105,7 @@ static int stk500v2_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
unsigned char buf[16];
|
||||
char msg[100]; /* see remarks above about size needed */
|
||||
int rv;
|
||||
int rv, tries;
|
||||
|
||||
PDATA(pgm)->lastpart = p;
|
||||
|
||||
@@ -1120,6 +1120,8 @@ static int stk500v2_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
/* Activate AVR-style (low active) RESET */
|
||||
stk500v2_setparm_real(pgm, PARAM_RESET_POLARITY, 0x01);
|
||||
|
||||
tries = 0;
|
||||
retry:
|
||||
buf[0] = CMD_ENTER_PROGMODE_ISP;
|
||||
buf[1] = p->timeout;
|
||||
buf[2] = p->stabdelay;
|
||||
@@ -1185,14 +1187,20 @@ static int stk500v2_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
cmd[1] = CMD3_MONCON_DISABLE;
|
||||
if (jtag3_command(pgm, cmd, 3, &resp, "MonCon disable") >= 0)
|
||||
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;
|
||||
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user