Fix issue where locked UPDI devices couldn't be erased

Resolves issue #1124
This commit is contained in:
MCUdude 2022-10-13 14:06:15 +02:00
parent f2fb3b45b4
commit bfec594ffd
3 changed files with 25 additions and 18 deletions

View File

@ -14856,6 +14856,7 @@ part parent ".avr8x_mega"
part part
desc = "AVR-Dx family common values"; desc = "AVR-Dx family common values";
id = ".avrdx"; id = ".avrdx";
family_id = "AVR ";
prog_modes = PM_SPM | PM_UPDI; prog_modes = PM_SPM | PM_UPDI;
# Dedicated UPDI pin, no HV # Dedicated UPDI pin, no HV
hvupdi_variant = 1; hvupdi_variant = 1;
@ -15012,6 +15013,7 @@ part
part parent ".avrdx" part parent ".avrdx"
desc = "AVR32DA28"; desc = "AVR32DA28";
id = "avr32da28"; id = "avr32da28";
family_id = " AVR";
mcuid = 338; mcuid = 338;
signature = 0x1e 0x95 0x34; signature = 0x1e 0x95 0x34;
@ -15036,6 +15038,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR32DA32"; desc = "AVR32DA32";
id = "avr32da32"; id = "avr32da32";
family_id = " AVR";
mcuid = 342; mcuid = 342;
signature = 0x1e 0x95 0x33; signature = 0x1e 0x95 0x33;
@ -15060,6 +15063,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR32DA48"; desc = "AVR32DA48";
id = "avr32da48"; id = "avr32da48";
family_id = " AVR";
mcuid = 346; mcuid = 346;
signature = 0x1e 0x95 0x32; signature = 0x1e 0x95 0x32;
@ -15084,6 +15088,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR64DA28"; desc = "AVR64DA28";
id = "avr64da28"; id = "avr64da28";
family_id = " AVR";
mcuid = 351; mcuid = 351;
signature = 0x1e 0x96 0x15; signature = 0x1e 0x96 0x15;
@ -15108,6 +15113,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR64DA32"; desc = "AVR64DA32";
id = "avr64da32"; id = "avr64da32";
family_id = " AVR";
mcuid = 355; mcuid = 355;
signature = 0x1e 0x96 0x14; signature = 0x1e 0x96 0x14;
@ -15132,6 +15138,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR64DA48"; desc = "AVR64DA48";
id = "avr64da48"; id = "avr64da48";
family_id = " AVR";
mcuid = 359; mcuid = 359;
signature = 0x1e 0x96 0x13; signature = 0x1e 0x96 0x13;
@ -15156,6 +15163,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR64DA64"; desc = "AVR64DA64";
id = "avr64da64"; id = "avr64da64";
family_id = " AVR";
mcuid = 362; mcuid = 362;
signature = 0x1e 0x96 0x12; signature = 0x1e 0x96 0x12;
@ -15180,6 +15188,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR128DA28"; desc = "AVR128DA28";
id = "avr128da28"; id = "avr128da28";
family_id = " AVR";
mcuid = 364; mcuid = 364;
signature = 0x1e 0x97 0x0a; signature = 0x1e 0x97 0x0a;
@ -15204,6 +15213,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR128DA32"; desc = "AVR128DA32";
id = "avr128da32"; id = "avr128da32";
family_id = " AVR";
mcuid = 366; mcuid = 366;
signature = 0x1e 0x97 0x09; signature = 0x1e 0x97 0x09;
@ -15228,6 +15238,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR128DA48"; desc = "AVR128DA48";
id = "avr128da48"; id = "avr128da48";
family_id = " AVR";
mcuid = 368; mcuid = 368;
signature = 0x1e 0x97 0x08; signature = 0x1e 0x97 0x08;
@ -15252,6 +15263,7 @@ part parent ".avrdx"
part parent ".avrdx" part parent ".avrdx"
desc = "AVR128DA64"; desc = "AVR128DA64";
id = "avr128da64"; id = "avr128da64";
family_id = " AVR";
mcuid = 370; mcuid = 370;
signature = 0x1e 0x97 0x07; signature = 0x1e 0x97 0x07;

View File

@ -1191,24 +1191,14 @@ int main(int argc, char * argv [])
if (rc == LIBAVRDUDE_SOFTFAIL && (p->prog_modes & PM_UPDI) && attempt < 1) { if (rc == LIBAVRDUDE_SOFTFAIL && (p->prog_modes & PM_UPDI) && attempt < 1) {
attempt++; attempt++;
if (pgm->read_sib) { if (pgm->read_sib) {
// Read SIB and compare FamilyID // Read SIB and compare FamilyID
char sib[AVR_SIBLEN + 1]; char sib[AVR_SIBLEN + 1];
pgm->read_sib(pgm, p, sib); pgm->read_sib(pgm, p, sib);
avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n", avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n", progname, sib);
progname, sib);
if (quell_progress < 2) if (quell_progress < 2)
avrdude_message(MSG_INFO, "%s: Received FamilyID: \"%.*s\"\n", progname, AVR_FAMILYIDLEN, sib); 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); 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) { if(erase) {
erase = 0; erase = 0;
@ -1223,6 +1213,12 @@ int main(int argc, char * argv [])
goto sig_again; 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", avrdude_message(MSG_INFO, "%s: error reading signature data, rc=%d\n",
progname, rc); progname, rc);
@ -1235,9 +1231,7 @@ int main(int argc, char * argv [])
if (sig == NULL) { if (sig == NULL) {
avrdude_message(MSG_INFO, "%s: WARNING: signature data not defined for device \"%s\"\n", avrdude_message(MSG_INFO, "%s: WARNING: signature data not defined for device \"%s\"\n",
progname, p->desc); progname, p->desc);
} } else {
if (sig != NULL) {
int ff, zz; int ff, zz;
if (quell_progress < 2) { if (quell_progress < 2) {

View File

@ -903,6 +903,7 @@ static int serialupdi_read_signature(const PROGRAMMER *pgm, const AVRPART *p, co
m->buf[0]=0x00; m->buf[0]=0x00;
m->buf[1]=0x00; m->buf[1]=0x00;
m->buf[2]=0x00; m->buf[2]=0x00;
return LIBAVRDUDE_SOFTFAIL;
} else { } else {
updi_read_byte(pgm, m->offset + 0, m->buf); updi_read_byte(pgm, m->offset + 0, m->buf);
updi_read_byte(pgm, m->offset + 1, m->buf+1); updi_read_byte(pgm, m->offset + 1, m->buf+1);