Pages: [1]   Go Down
Author Topic: "Invalid device signature" (0x000000) since Arduino 1.0; works in 0022  (Read 2185 times)
0 Members and 1 Guest are viewing this topic.
Boston, MA
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Batteries? We don't need no steenking batteries!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I am (finally) patching my Arduino-derived project up to 1.0 and ran into an oddity; it seems 1.0 (or the version of avrdude that comes with it?) no longer recognizes the Arduino serial (Duemilanove and earlier) bootloader's protocol (stk500), or at least has altered its implementation in such a way that it no longer recognizes the chip. The Mosquino (Sanguino-based) board uses an ATmega644pa with the Sanguino's 'adaboot' bootloader. Its boards.txt file specifies the upload protocol as follows:

Code:
mosquino.upload.protocol=stk500


Randomly changing this from 'stk500' to 'arduino' (as mentioned in this thread) gets it working again, but for a published project, I'm wary of relying on what seems to be a 'voodoo' fix without understanding how or why it works, or what the problem was in the first place. Does anyone know more about this - e.g. is the underlying problem/solution/change documented anywhere, and is this a 'stable' fix that I can safely push out? What actually changed?

Thanks in advance!


More info:
With Arduino IDE versions up through 0022, uploading a sketch proceeds normally. Abridged verbose output:

Code:
avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "J:\arduino-0022\hardware/tools/avr/etc/avrdude.conf"

         Using Port            : \\.\COM18
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 19200
...
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: Send: u [75]   [20]
avrdude: Recv:
################################################## | 100% 0.02s

avrdude: Device signature = 0x1e960a
...

But with 1.0, upload produces:
Code:
avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "J:\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM18
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
...
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: Send: V [56] 0 [30] . [00] . [00] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
avrdude: Send: V [56] 0 [30] . [00] . [01] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
################avrdude: Send: V [56] 0 [30] . [00] . [02] . [00]   [20]
avrdude: Recv: . [14]
avrdude: Recv: . [00]
avrdude: Recv: . [10]
################################## | 100% 0.05s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

It seems to use a different method to read the signature(?).

Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 209
Posts: 13024
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


I have no idea if the following paragraph is correct but it is what I recall from reading various tidbits... avrdude has been drifting towards more use of the "universal command" (that's the 'V' in the send data).  This moves more "intelligence" up into avrdude and allows the programmer to be become much "dumber".  In the extreme case, avrdude handles all the details and the programmer only has to support a single command.  The idea is that avrdude is much easier to change and fix than a programmer.

I don't think any of the Arduino STK500 bootloaders support the "universal command".  Optiboot definitely does not support it...

    else if(ch == STK_UNIVERSAL) {
      // UNIVERSAL command is ignored
      getNch(4);
      putch(0x00);
    }


Quote
Does anyone know more about this - e.g. is the underlying problem/solution/change documented anywhere,

Probably.  But I have no idea where.  That bit escapes my memory.

Quote
and is this a 'stable' fix that I can safely push out?

Yes.  There are too many boards that do not support the "universal command".  One way or another avrdude has to support STK500 as you used to know it.

Quote
What actually changed?

Is the stuff above a good enough explanation?
Logged

Boston, MA
Offline Offline
Full Member
***
Karma: 0
Posts: 129
Batteries? We don't need no steenking batteries!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I understand it's just hearsay, but this sounds plausible. What you're saying is most likely this is an issue with avrdude itself...i.e. that the official STK500v1 protocol has supported the "universal command" always, but older versions of avrdude didn't make use of it until now (causing problems since the Arduino "STK500" serial bootloaders don't support it). Is the 'arduino' entry then some "STK500-like" protocol definition (that all Arduino projects should have been using all along) that forces the non-use of the "universal" commands?

David Mellis himself (*genuflection*) posted the fix in the thread linked above, so I've replied there in case he's still watching that thread and can give the answer definitively. Figuring he knows a thing or two ;-)
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 209
Posts: 13024
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is the 'arduino' entry then some "STK500-like" protocol definition (that all Arduino projects should have been using all along)

Probably not "all along" but the "arduino" protocol has been available at least since 2010-01-19 (the latest WinAVR release).

Quote
that forces the non-use of the "universal" commands?

I believe the "arduino" protocol is just the old STK500 source code.

In fairness to the Arduino folks, the old STK500 (the new "arduino" protocol) is very likely much more efficient (i.e. faster uploads).
Logged

Pages: [1]   Go Up
Jump to: