avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avrdude-dev] AVR910 with firmware 3.2 - two problems


From: Thomas Fischl
Subject: [avrdude-dev] AVR910 with firmware 3.2 - two problems
Date: Thu, 25 Mar 2004 12:35:38 +0100 (MET)

I've built an avr910 programmer based on AT90S2313 with firmware version
3.2. I used the description from http://www.mikrocontroller-projekte.de/.
With AVRDUDE there are two problems:
1. the single-byte 'y' command to clear the LED in avr910_write_setup. This
was discussed earlier on the list, but the current CVS version still has this
problem.
2. write memory command fails after the first page is written to the device.
the programmer needs the address before the pagedata are written: setaddress
('A'), load page data ('c'/'C'), setaddress ('A'), write page ('m'). It
seems that AvrProg and UISP also use this sequence for programming the flash.

My solutions:
1. write an ESC command instead an LED-command and check the response which
has to be a '?' (because ESC is an unknown command)
2. set address before the pagedata is transmitted

With the following changes my programmer works fine,
Thomas

Index: avr910.c
===================================================================
RCS file: /cvsroot/avrdude/avrdude/avr910.c,v
retrieving revision 1.16
diff -u -r1.16 avr910.c
--- avr910.c    29 Jan 2004 13:23:59 -0000      1.16
+++ avr910.c    25 Mar 2004 11:25:13 -0000
@@ -292,8 +292,16 @@
 static void avr910_write_setup(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
 {
   if (strcmp(m->desc, "flash") == 0) {
-    avr910_send(pgm, "y", 1);
-    avr910_vfy_cmd_sent(pgm, "clear LED");
+    char response;
+
+    avr910_send(pgm, "\27", 1);  // send ESC
+    avr910_recv(pgm, &response, 1);
+
+    if (response != '?') {
+      fprintf(stderr, "%s: error: programmer did not respond to
ESC-command\n",
+             progname);
+      exit(1);
+    }
   }
 }

@@ -407,9 +415,14 @@
   avr910_write_setup(pgm, p, m);

   page_addr = addr;
-  avr910_set_addr(pgm, addr>>1);

   while (addr < max_addr) {
+
+    // Send address at the beginning of every page
+    if (page_bytes == page_size) {
+      avr910_set_addr(pgm, addr>>1);
+    }
+
     page_wr_cmd_pending = 1;
     buf[0] = cmd[addr & 0x01];
     buf[1] = m->buf[addr];

-- 
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]