Skip to content

Commit

Permalink
Fix issue where locked UPDI devices couldn't be erased
Browse files Browse the repository at this point in the history
Resolves issue #1124
  • Loading branch information
MCUdude committed Oct 13, 2022
1 parent d208bc3 commit 88dd393
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
12 changes: 12 additions & 0 deletions src/avrdude.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -14848,6 +14848,7 @@ part parent ".avr8x_mega"
part
desc = "AVR-Dx family common values";
id = ".avrdx";
family_id = "AVR ";
prog_modes = PM_SPM | PM_UPDI;
# Dedicated UPDI pin, no HV
hvupdi_variant = 1;
Expand Down Expand Up @@ -15004,6 +15005,7 @@ part
part parent ".avrdx"
desc = "AVR32DA28";
id = "avr32da28";
family_id = " AVR";
mcuid = 338;
signature = 0x1e 0x95 0x34;

Expand All @@ -15028,6 +15030,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR32DA32";
id = "avr32da32";
family_id = " AVR";
mcuid = 342;
signature = 0x1e 0x95 0x33;

Expand All @@ -15052,6 +15055,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR32DA48";
id = "avr32da48";
family_id = " AVR";
mcuid = 346;
signature = 0x1e 0x95 0x32;

Expand All @@ -15076,6 +15080,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR64DA28";
id = "avr64da28";
family_id = " AVR";
mcuid = 351;
signature = 0x1e 0x96 0x15;

Expand All @@ -15100,6 +15105,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR64DA32";
id = "avr64da32";
family_id = " AVR";
mcuid = 355;
signature = 0x1e 0x96 0x14;

Expand All @@ -15124,6 +15130,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR64DA48";
id = "avr64da48";
family_id = " AVR";
mcuid = 359;
signature = 0x1e 0x96 0x13;

Expand All @@ -15148,6 +15155,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR64DA64";
id = "avr64da64";
family_id = " AVR";
mcuid = 362;
signature = 0x1e 0x96 0x12;

Expand All @@ -15172,6 +15180,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR128DA28";
id = "avr128da28";
family_id = " AVR";
mcuid = 364;
signature = 0x1e 0x97 0x0a;

Expand All @@ -15196,6 +15205,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR128DA32";
id = "avr128da32";
family_id = " AVR";
mcuid = 366;
signature = 0x1e 0x97 0x09;

Expand All @@ -15220,6 +15230,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR128DA48";
id = "avr128da48";
family_id = " AVR";
mcuid = 368;
signature = 0x1e 0x97 0x08;

Expand All @@ -15244,6 +15255,7 @@ part parent ".avrdx"
part parent ".avrdx"
desc = "AVR128DA64";
id = "avr128da64";
family_id = " AVR";
mcuid = 370;
signature = 0x1e 0x97 0x07;

Expand Down
30 changes: 12 additions & 18 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,24 +1191,14 @@ int main(int argc, char * argv [])
if (rc == LIBAVRDUDE_SOFTFAIL && (p->prog_modes & PM_UPDI) && attempt < 1) {
attempt++;
if (pgm->read_sib) {
// Read SIB and compare FamilyID
char sib[AVR_SIBLEN + 1];
pgm->read_sib(pgm, p, sib);
avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n",
progname, sib);
// Read SIB and compare FamilyID
char sib[AVR_SIBLEN + 1];
pgm->read_sib(pgm, p, sib);
avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n", progname, sib);
if (quell_progress < 2)
avrdude_message(MSG_INFO, "%s: Received FamilyID: \"%.*s\"\n", progname, AVR_FAMILYIDLEN, sib);

if (strncmp(p->family_id, sib, AVR_FAMILYIDLEN)) {
if (strncmp(p->family_id, sib, AVR_FAMILYIDLEN))
avrdude_message(MSG_INFO, "%s: Expected FamilyID: \"%s\"\n", progname, p->family_id);
if (!ovsigck) {
avrdude_message(MSG_INFO, "%sDouble check chip, "
"or use -F to override this check.\n",
progbuf);
exitrc = 1;
goto main_exit;
}
}
}
if(erase) {
erase = 0;
Expand All @@ -1223,6 +1213,12 @@ int main(int argc, char * argv [])
goto sig_again;
}
}
if (!ovsigck) {
avrdude_message(MSG_INFO, "%sDouble check chip, or use -F to override this check.\n",
progbuf);
exitrc = 1;
goto main_exit;
}
}
avrdude_message(MSG_INFO, "%s: error reading signature data, rc=%d\n",
progname, rc);
Expand All @@ -1235,9 +1231,7 @@ int main(int argc, char * argv [])
if (sig == NULL) {
avrdude_message(MSG_INFO, "%s: WARNING: signature data not defined for device \"%s\"\n",
progname, p->desc);
}

if (sig != NULL) {
} else {
int ff, zz;

if (quell_progress < 2) {
Expand Down
1 change: 1 addition & 0 deletions src/serialupdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ static int serialupdi_read_signature(const PROGRAMMER *pgm, const AVRPART *p, co
m->buf[0]=0x00;
m->buf[1]=0x00;
m->buf[2]=0x00;
return LIBAVRDUDE_SOFTFAIL;
} else {
updi_read_byte(pgm, m->offset + 0, m->buf);
updi_read_byte(pgm, m->offset + 1, m->buf+1);
Expand Down

0 comments on commit 88dd393

Please sign in to comment.