From d23e035b3bc81cdf7a60f79c17f7b44b43c17af4 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Mon, 11 Jan 2010 16:04:29 +0000 Subject: [PATCH] After erasing an Xmega part, do *not* reinitialize the world, as a subsequent programming operation will fail (for unknown reasons). Actually, this was really only required for ancient AVRs, but doesn't hurt on mega and tiny devices. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@904 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 8 ++++++-- avrdude/jtagmkII.c | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index 1c5c317b..7b64eb15 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -4,8 +4,12 @@ * jtagmkII_private.h: Add CMND_XMEGA_ERASE as well as the various XMEGA_ERASE_* definitions (from updated appnote AVR067) - * jtagmkII.c (jtagmkII_chip_erase): Correctly implement - Xmega chip erase based on CMND_XMEGA_ERASE. + * jtagmkII.c (jtagmkII_chip_erase): Correctly implement Xmega chip + erase based on CMND_XMEGA_ERASE. After erasing an Xmega part, do + *not* reinitialize the world, as a subsequent programming + operation will fail (for unknown reasons). Actually, this was + really only required for ancient AVRs, but doesn't hurt on mega + and tiny devices. * jtagmkII.c (jtagmkII_pre_write): Remove, this turned out to be just a chip erase. * jtagmkII.c (jtagmkII_program_disable): Don't try reading diff --git a/avrdude/jtagmkII.c b/avrdude/jtagmkII.c index 95cababc..c66852f2 100644 --- a/avrdude/jtagmkII.c +++ b/avrdude/jtagmkII.c @@ -907,7 +907,8 @@ static int jtagmkII_chip_erase(PROGRAMMER * pgm, AVRPART * p) return -1; } - pgm->initialize(pgm, p); + if (!(p->flags & AVRPART_HAS_PDI)) + pgm->initialize(pgm, p); return 0; }