From bfbe775df8aff18c0ad2e3da4907d1593ac9ed27 Mon Sep 17 00:00:00 2001 From: "Brian S. Dean" Date: Sun, 18 Sep 2005 00:28:19 +0000 Subject: [PATCH] This is patch #3277 which appears to fix a number of issues with the avr910 programmer. Original Submission: The attached patch against avrdude 4.4.0 fixes the following problems with paged writes in avr910.c: - failure to re-set address after page writes; - no polling or delay after page writes; - no page writes when not using auto-increment; - an extraneous page write when data ends on page boundary. Submitted by: "Nic" git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@510 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/avr910.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/avrdude/avr910.c b/avrdude/avr910.c index e0a97fac..5250fb99 100644 --- a/avrdude/avr910.c +++ b/avrdude/avr910.c @@ -358,7 +358,7 @@ static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, if ((addr & 0x01) == 0) { *value = buf[1]; - cached = 1; + // cached = 1; cvalue = buf[0]; caddr = addr; } @@ -421,21 +421,25 @@ static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, addr++; page_bytes--; - if ((has_auto_incr_addr != 'Y') && ((addr & 0x01) == 0)) { - avr910_set_addr(pgm, addr>>1); - } - else if (m->paged && (page_bytes == 0)) { + if (m->paged && (page_bytes == 0)) { /* Send the "Issue Page Write" if we have sent a whole page. */ avr910_set_addr(pgm, page_addr>>1); avr910_send(pgm, "m", 1); avr910_vfy_cmd_sent(pgm, "flush page"); + page_wr_cmd_pending = 0; + usleep(m->max_write_delay); + avr910_set_addr(pgm, addr>>1); + /* Set page address for next page. */ page_addr = addr; page_bytes = page_size; } + else if ((has_auto_incr_addr != 'Y') && ((addr & 0x01) == 0)) { + avr910_set_addr(pgm, addr>>1); + } report_progress (addr, max_addr, NULL); } @@ -447,6 +451,7 @@ static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, avr910_set_addr(pgm, page_addr>>1); avr910_send(pgm, "m", 1); avr910_vfy_cmd_sent(pgm, "flush final page"); + usleep(m->max_write_delay); } return addr; @@ -468,6 +473,7 @@ static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p, cmd[1] = m->buf[addr]; avr910_send(pgm, cmd, sizeof(cmd)); avr910_vfy_cmd_sent(pgm, "write byte"); + usleep(m->max_write_delay); addr++;