From c3acdccbe52d8a67a08702ccd8df60db08ae612d Mon Sep 17 00:00:00 2001 From: Cristiano De Alti Date: Tue, 22 Nov 2022 02:17:19 +0100 Subject: [PATCH] Fix JTAGICE mkII by removing the initialize call after CMD_CHIP_ERASE_ISP (#1172) - The extra call to initialize() sends CMD_ENTER_PROGMODE_ISP causing a flash verification mismatch --- src/stk500v2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/stk500v2.c b/src/stk500v2.c index edf26cae..a4cf943a 100644 --- a/src/stk500v2.c +++ b/src/stk500v2.c @@ -948,8 +948,10 @@ static int stk500v2_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) { memset(buf+3, 0, 4); avr_set_bits(p->op[AVR_OP_CHIP_ERASE], buf+3); result = stk500v2_command(pgm, buf, 7, sizeof(buf)); - usleep(p->chip_erase_delay); - pgm->initialize(pgm, p); + usleep(p->chip_erase_delay); // should not be needed + if (PDATA(pgm)->pgmtype != PGMTYPE_JTAGICE_MKII) { // skip for JTAGICE mkII (FW v7.39) + pgm->initialize(pgm, p); // should not be needed + } pgm->pgm_led(pgm, OFF);