avrdude-dev
[Top][All Lists]
Advanced

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

Re: [avrdude-dev] [bug #18727] Writing flash failed


From: Joerg Wunsch
Subject: Re: [avrdude-dev] [bug #18727] Writing flash failed
Date: Tue, 9 Jan 2007 23:14:50 +0100
User-agent: Mutt/1.5.11

As Joerg Wunsch wrote:

> > >Can you please re-run both versions with -vvvv added, ...
> 
> > Hm, -ww is an unknown option in both version. But I have attechedthe
> > output with -v -v added.
> 
> Sorry, that's not sufficient.  The option combination wasn't -ww but
> -vvvv (or -v -v -v -v).  Maybe you'd better read mails with a
> fixed-size font. :)

OK, Thomas sent me the logs privately.  Now I also know why this was
some kind of deja vu to me.  The difference in both traces is:

@@ -588,7 +87,7 @@
     Device code: 0x76
 avrdude: Recv: . [00] 
 
-avrdude: Send: T [54] v [76] 
+avrdude: Send: T [54] w [77] 
 avrdude: Recv: . [0d] 
 avrdude: Send: P [50] 
 avrdude: Recv: . [0d] 

The current version of AVRDUDE uses device code 0x77 for the ATmega8,
older versions have been using 0x76, and that's what the bootloader
(?) also expects.

Alas, with the overly simplified concept of a device ID back from
AVR910, there has always been some discrepance about which device gets
which ID.  The ATmega8's device ID currently listed in avrdude.conf
has been taken from Atmel's appnote AVR109, so I think it has some
kind of authority.

The deja vu, I've read about that before (but couldn't remember), and
added an option to the "avr910" programmer that allows to override
this by the -F option.  In that case, the first device code that was
listed by the device (hopefully the only one...) will be used instead
of the one from avrdude.conf.

For the "butterfly" (aka. avr109) programmer, this has not been added.
According to AVR109, the 'T' command is being ignored by AVR109
bootloaders, as there is really no device to select from on a
bootloader.  Thus, the bootloader in this application should be
upgraded.

I wonder whether avrdude's butterfly/avr109 code would better always
be sending the (first, usually the only one on a bootloader) device
code listed as supported as returned by the bootloader before, rather
than ever trying to use the AVR910 code from avrdude.conf.  Unless
someone seriously objects this change, I'll commit it:

Index: butterfly.c
===================================================================
RCS file: /home/cvs/avrdude/avrdude/butterfly.c,v
retrieving revision 1.16
diff -u -u -r1.16 butterfly.c
--- butterfly.c 11 Dec 2006 12:47:35 -0000      1.16
+++ butterfly.c 9 Jan 2007 22:11:21 -0000
@@ -226,7 +226,7 @@
   char hw[2];
   char buf[10];
   char type;
-  char c;
+  char c, devtype_1st;
 
   no_show_func_info();
 
@@ -307,18 +307,28 @@
 
   butterfly_send(pgm, "t", 1);
   fprintf(stderr, "\nProgrammer supports the following devices:\n");
+  devtype_1st = 0;
   while (1) {
     butterfly_recv(pgm, &c, 1);
+    if (devtype_1st == 0)
+      devtype_1st = c;
+
     if (c == 0)
       break;
     fprintf(stderr, "    Device code: 0x%02x\n", (unsigned int)(unsigned 
char)c);
   };
   fprintf(stderr,"\n");
 
-  /* Tell the programmer which part we selected. */
+  /* Tell the programmer which part we selected.
+     According to the AVR109 code, this is ignored by the bootloader.  As
+     some early versions might not properly ignore it, rather pick up the
+     first device type as reported above than anything out of avrdude.conf,
+     so to avoid a potential conflict.  There appears to be no general
+     agreement on AVR910 device IDs beyond the ones from the original
+     appnote 910. */
 
   buf[0] = 'T';
-  buf[1] = p->avr910_devcode;
+  buf[1] = devtype_1st;
 
   butterfly_send(pgm, buf, 2);
   butterfly_vfy_cmd_sent(pgm, "select device");

As a short-term solution, you can modify your avrdude.conf to use the
AVR910 ID 0x76 rather than 0x77 for the ATmega8.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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