diff --git a/ChangeLog b/ChangeLog index 428cbdfd..a16699e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-10-07 Joerg Wunsch + + bug #42267: jtag3isp fails to read lock and fuse bytes directly + after changing lock byte + * stk500v2.c (stk500isp_write_byte): As a workaround for broken + tool firmware, add 10 ms of delay before returning from any + single-byte write operation. + 2014-10-06 Joerg Wunsch * stk500v2.c: Use stk500isp_read_byte/stk500isp_write_byte for diff --git a/NEWS b/NEWS index 99c1068d..e952b983 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,8 @@ Current: * Bugfixes - bug #22248: Read efuse error (partial fix) + - bug #42267: jtag3isp fails to read lock and fuse bytes directly + after changing lock byte * Internals: - ... diff --git a/stk500v2.c b/stk500v2.c index fd8b5e1b..53b92917 100644 --- a/stk500v2.c +++ b/stk500v2.c @@ -2241,19 +2241,16 @@ static int stk500isp_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, return -1; } - if (buf[0] == CMD_PROGRAM_FUSE_ISP) { - /* - * The JTAGICE3 needs one leave progmode / enter progmode cycle - * after writing fuses, before being able to read them back. - */ - buf[0] = CMD_LEAVE_PROGMODE_ISP; - buf[1] = 1; // preDelay; - buf[2] = 1; // postDelay; - - stk500v2_command(pgm, buf, 3, sizeof(buf)); - - pgm->program_enable(pgm, p); - } + /* + * Prevent verification readback to be too fast, see + * https://savannah.nongnu.org/bugs/index.php?42267 + * + * After all, this is just an ugly hack working around some + * brokeness in the Atmel firmware starting with the AVRISPmkII (the + * old JTAGICEmkII isn't affected). Let's hope 10 ms of additional + * delay are good enough for everyone. + */ + usleep(10000); return 0; }