bug #42908: no external reset at JTAGICE3

* jtag3.c (jtag3_initialize): Retry with external reset applied if
the first sign-on attempt fails.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1349 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch 2014-11-24 09:52:00 +00:00
parent 0013a990fa
commit ccaf9e9549
3 changed files with 32 additions and 20 deletions

View File

@ -1,3 +1,9 @@
2014-11-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #42908: no external reset at JTAGICE3
* jtag3.c (jtag3_initialize): Retry with external reset applied if
the first sign-on attempt fails.
2014-11-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c: Allow the -B option argument to be suffixed with Hz,

1
NEWS
View File

@ -51,6 +51,7 @@ Current:
- bug #43078: AVRDUDE crashes after sucessfully reading/writing eeprom
- bug #43137: Writing and reading incorrect pages when using jtagicemkI
- bug #40870: config nitpick: ATtiny25/45/85 have 1 calibration byte not 2
- bug #42908: no external reset at JTAGICE3
* Internals:
- Removing exit calls from config parser

45
jtag3.c
View File

@ -836,29 +836,22 @@ static int jtag3_program_enable_dummy(PROGRAMMER * pgm, AVRPART * p)
static int jtag3_program_enable(PROGRAMMER * pgm)
{
unsigned char buf[3], *resp;
int use_ext_reset;
if (PDATA(pgm)->prog_enabled)
return 0;
for (use_ext_reset = 0; use_ext_reset <= 1; use_ext_reset++) {
buf[0] = SCOPE_AVR;
buf[1] = CMD3_ENTER_PROGMODE;
buf[2] = 0;
buf[0] = SCOPE_AVR;
buf[1] = CMD3_ENTER_PROGMODE;
buf[2] = 0;
if (jtag3_command(pgm, buf, 3, &resp, "enter progmode") >= 0) {
free(resp);
break;
}
if (jtag3_command(pgm, buf, 3, &resp, "enter progmode") >= 0) {
free(resp);
PDATA(pgm)->prog_enabled = 1;
/* XXX activate external reset here */
avrdude_message(MSG_NOTICE, "%s: retrying with external reset applied\n",
progname);
return 0;
}
PDATA(pgm)->prog_enabled = 1;
return 0;
return -1;
}
static int jtag3_program_disable(PROGRAMMER * pgm)
@ -1109,13 +1102,25 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
return -1;
}
cmd[0] = SCOPE_AVR;
cmd[1] = CMD3_SIGN_ON;
cmd[2] = 0;
cmd[3] = 0; /* external reset */
int use_ext_reset;
if ((status = jtag3_command(pgm, cmd, 4, &resp, "AVR sign-on")) < 0)
for (use_ext_reset = 0; use_ext_reset <= 1; use_ext_reset++) {
cmd[0] = SCOPE_AVR;
cmd[1] = CMD3_SIGN_ON;
cmd[2] = 0;
cmd[3] = use_ext_reset; /* external reset */
if ((status = jtag3_command(pgm, cmd, 4, &resp, "AVR sign-on")) >= 0)
break;
avrdude_message(MSG_INFO, "%s: retrying with external reset applied\n",
progname);
}
if (use_ext_reset > 1) {
avrdude_message(MSG_INFO, "%s: JTAGEN fuse disabled?\n", progname);
return -1;
}
/*
* Depending on the target connection, there are two different