diff --git a/src/jtagmkI.c b/src/jtagmkI.c index 7a97217b..e5d3d5d8 100644 --- a/src/jtagmkI.c +++ b/src/jtagmkI.c @@ -1058,7 +1058,7 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, { unsigned char cmd[6], datacmd[1 * 2 + 1]; unsigned char resp[1], writedata; - int len, need_progmode = 1; + int len, need_progmode = 1, need_dummy_read = 0; avrdude_message(MSG_NOTICE2, "%s: jtagmkI_write_byte(.., %s, 0x%lx, ...)\n", progname, mem->desc, addr); @@ -1072,20 +1072,26 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, } else if (strcmp(mem->desc, "eeprom") == 0) { cmd[1] = MTYPE_EEPROM; need_progmode = 0; + need_dummy_read = 1; PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L; } else if (strcmp(mem->desc, "lfuse") == 0) { cmd[1] = MTYPE_FUSE_BITS; + need_dummy_read = 1; addr = 0; } else if (strcmp(mem->desc, "hfuse") == 0) { cmd[1] = MTYPE_FUSE_BITS; + need_dummy_read = 1; addr = 1; } else if (strcmp(mem->desc, "efuse") == 0) { cmd[1] = MTYPE_FUSE_BITS; + need_dummy_read = 1; addr = 2; } else if (strcmp(mem->desc, "lock") == 0) { cmd[1] = MTYPE_LOCK_BITS; + need_dummy_read = 1; } else if (strcmp(mem->desc, "calibration") == 0) { cmd[1] = MTYPE_OSCCAL_BYTE; + need_dummy_read = 1; } else if (strcmp(mem->desc, "signature") == 0) { cmd[1] = MTYPE_SIGN_JTAG; } @@ -1154,6 +1160,8 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem, avrdude_message(MSG_NOTICE2, "OK\n"); } + if(need_dummy_read) + jtagmkI_recv(pgm, resp, 1); return 0; }