bugAVR Downloader/UploaDEr - Bugs: bug #19773, ATmega2561 not correctly flashed

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #19773: ATmega2561 not correctly flashed

Submitted by:  Harald Kipp <haraldkipp>
Submitted on:  Wed 02 May 2007 02:47:41 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: InvalidPrivacy: Public
Assigned to: Joerg Wunsch <joerg_wunsch>Originator Name: Harald Kipp
Open/Closed: ClosedRelease: None
Programmer hardware: Device type: 

(Jump to the original submission Jump to the original submission)

Sun 06 May 2007 03:20:33 PM UTC, comment #6:

Further investigation shows that spduo simply flashed the
last block transferred into address 0x31900 rather than
0x11900 where it is supposed to be placed at. Two differences
can be noticed here between the way avrdude and AVR Studio
are working: avrdude issues a new LOAD ADDRESS command for
that block (does that confuse SP Duo?), and avrdude writes a
short block, i.e. the block only contains as many bytes as
have been read from the input file for this memory page.
AVR Studio instead writes a page-sized block even for the
last block, where the remaining data up to the page size have
been padded with 0xff.

Does that confuse SP Duo's firmware? After reading AVR068, I
believe avrdude is allowed to write a short block, and the
programmer should simply issue the WRITE PAGE command after
all input data have been processed.

A different issue is that the data read back from the flash
apprently are wrong when hitting the 0x10000 boundary (this
is what causes the verification error shown below). Alas,
the trace does not show any of the data read back by avrdude
(all the "Recv: " lines are empty, for whatever reason).
However, there's again the difference between avrdude and
AVR Studio that avrdude re-issues the LOAD ADDRESS command
right before address 0x10000, while AVR Studio simply proceeds,
and relies on the programmer to correctly wrap the address.

It appears to me that avrdude's operation, while different
than AVR Studio's, is fully in agreement with the protocol
description in AVR067.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Sat 05 May 2007 09:52:25 PM UTC, comment #5:

Thanks for the trace files.

The most critical parts of both traces look very similar. In
particular, the LOAD ADDRESS has bit 31 set (to mark the device
as requiring an extended address operation), and both programs
don't do any special action when wrapping the 128 KiB boundary,
they just rely on the programmer to correctly count up the
target address across that boundary.

The "delay" parameter in AVR Studio is 10 when avrdude uses
6. Sigh, this is one of those situations where Atmel changed
the XML files without notice: the parameter used to be 6 in
the initial files, but has been changed to 10 with AVR Studio
4.12 release (build 460).

Interestingly enough, the stock STK500 doesn't appear to care
about that.

Find below a patch to fix this.

The spduo appears to have some really funny responses to
parameter inquiries:

Hardware Version: 14
Firmware Version: 50.51
Vtarget : 14.8 V
SCK period : 165.0 us

The remaining differences in the initialization sequence
are that avrdude uses a few SPI_MULTI commands (still) to
read the device signature.

Index: avrdude.conf.in
===================================================================
RCS file: /home/cvs/avrdude/avrdude/avrdude.conf.in,v
retrieving revision 1.119
diff -u -u -r1.119 avrdude.conf.in
--- avrdude.conf.in 26 Feb 2007 19:52:53 -0000 1.119
+++ avrdude.conf.in 5 May 2007 21:32:50 -0000
@@ -8633,7 +8633,7 @@
" x x x x x x x x";

mode = 0x41;
- delay = 6;
+ delay = 10;
blocksize = 256;
readsize = 256;
;
@@ -8821,7 +8821,7 @@
" x x x x x x x x";

mode = 0x41;
- delay = 6;
+ delay = 10;
blocksize = 256;
readsize = 256;
;
@@ -9010,7 +9010,7 @@
" x x x x x x x x";

mode = 0x41;
- delay = 6;
+ delay = 10;
blocksize = 256;
readsize = 256;
;
@@ -9203,7 +9203,7 @@
" 0 0 0 0 0 0 0 0";

mode = 0x41;
- delay = 6;
+ delay = 10;
blocksize = 256;
readsize = 256;
;
@@ -9396,7 +9396,7 @@
" 0 0 0 0 0 0 0 0";

mode = 0x41;
- delay = 6;
+ delay = 10;
blocksize = 256;
readsize = 256;
;

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Thu 03 May 2007 08:05:31 AM UTC, comment #4:

The archive

http://www.ethernut.de/arc/inetq-spduo-trace.zip

contains the related traces from avrdude and avrstudio.

I tried firmware 2.2 on SP Duo 1 and firmware 2.30a on SP Duo 2.

Btw. the firmware is closed source and I do not have it. Louis Beaudoin, the author of the firmware, is usually extremely busy. But in case we'd need information about the internals, he will surely provide them.

Harald Kipp <haraldkipp>
Wed 02 May 2007 08:19:55 PM UTC, comment #3:

That reminds me: if you could also attach AVR Studio's
communications trace for comparision, that would be great.
The appnote AVR068 document contains a description how to
take that trace file.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Wed 02 May 2007 08:15:33 PM UTC, comment #2:

I have no troubles programming that hex file into an ATmega2561
here, using an STK500 with the most recent firmware (2.10).

So somehow, there must be a difference between the spduo and
the genuine STK500. I agree with Colin, please attach a full
debugging session log, i. e. one with -vvvv (four v's).

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Wed 02 May 2007 08:01:53 PM UTC, comment #1:

I notice the avrduo has different firmware than the STK500, so there is more than one spot for a problem to occur here...

What version are you using of avrdude?

avrdude -v

And I assume you have at least firmware version 2.2 in the avrduo?

Also maybe attach a log of avrdude doing the programming, specify some debug options with -v. Maybe even a few v's (-vvv) for more info.

Colin O Flynn <c_oflynn>
Project Member
Wed 02 May 2007 02:47:41 PM UTC, original submission:

avrdude fails to flash some of our hex files. A sample project (without Nut/OS libs) is available for download:
http://www.ethernut.de/arc/inetq-spduo.zip

avrdude -p atmega2561 -P com2 -c stk500v2 -U flash:w:inetq.hex
fails with
avrdude: verification error, first mismatch at byte 0x10000
0x90 != 0xff
avrdude: verification error; content mismatch

We use the SP Duo Programmer
http://www.ethernut.de/en/isp/spduo.html

AVR Studio works fine.

The inetq-spduo.zip archive contains three hex files:
inetq.hex - the original hex file
image-spduo.hex - image of the failed avrdude programming, read back with AVR Studio and JTAGICE
image-jtagice.hex - image of correct programming (at least this one runs fine)

Harald Kipp <haraldkipp>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by joerg_wunsch (Posted a comment)
  • -unavailable- added by c_oflynn (Posted a comment)
  • -unavailable- added by haraldkipp (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 May 2007 08:15:37 PM UTCjoerg_wunschOpen/ClosedOpen=>Closed
    Sun 06 May 2007 03:20:33 PM UTCjoerg_wunschStatusIn Progress=>Invalid
      Assigned toNone=>joerg_wunsch
    Sat 05 May 2007 09:52:47 PM UTCjoerg_wunschStatusNeed Info=>In Progress
    Wed 02 May 2007 08:15:33 PM UTCjoerg_wunschStatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1