Pages: [1]   Go Down
Author Topic: Mega 2560 with ArduinoISP -fix for avrdude  (Read 807 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi forum,

Posting a resolved issue here so that it is more widely known.  First post so be gentle!

Attempting to re-program the Mega2560 bootloader using another Arduino as ISP I traced the 'verify error' that many had experienced doing this (using logic analyser to capture the whole 90sec programming cycle and examine the bytes transferred on the target SPI bus), and studying the protocol in detail.

It turns out that avrdude is not setting the 'extended-address' byte, which is required to program a device with >128K of flash.  The ArduinoISP uses stk500 (v1) but most devepment seems to be focussed on stk500 (v2), which is very different.

This may be the limitation that lead in part to Nick (Gammon) re-writing the programmer?  Anyway there is a fairly small patch to avrdude that I have posted on that mailing list and bugtracker:

http://savannah.nongnu.org/bugs/?40897

With this fix, the ISP completes the programming without errors.  I think this change would also be necessary to program user code using the ISP (rather than through the bootloader).

Would be interested in others comments, etc.

Regards

Alan
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Alan, I am struggling with getting my Mega2560 working while using an UNO as ISP. I am plagued by the timeout errors. Your posting here offers hope, but I simply don't know how to implement. Please suggest a website where I can learn how to apply your patch. Simply putting that file into stk500v2 folder is not enough. All suggestions welcome. Thanx, Tom
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Tom,

The timeout you see is probably unrelated to the issue fixed by the patch (though that may come afterwards).  It would probably help if you describe your set-up (PC operating system, how you are trying to do the Mega programming etc) &/or link to a tutorial you are following.  Without knowing any of that, it sounds perhaps like the Uno is not being kept from resetting when serial data is sent (1uF capacitor from reset to +5V (or Gnd) on the *Uno* board).  I notice also you mentioned the stk500v2 folder - but the ISP should be using stk500v1 protocol, eg
    "avrdude -p m2560 -c avrisp ....... "  for the command (avrisp is equivalent to 'stk500v1').
and the baud needs to be correct (depends what is specified in the ArduinoISP you build - I think 19200 is default?).

Hope this is some help,

Alan
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just to say this fix has been accepted into avrdude with a small revision, so should be in the next release (don't hold your breath, though), or get the svn head version, or since it essentially only affects one file, get just that file (stk500.c) from svn and replace your local 6.0.1 source copy.  I've also successfully patched the older version 5.11.1.

Alan
Logged

Pages: [1]   Go Up
Jump to: