bugAVR Downloader/UploaDEr - Bugs: bug #29913, 246 Byte Bug - AVRdude crashes

 
 

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

bug #29913: 246 Byte Bug - AVRdude crashes

Submitter:  None
Submitted:  Wed 19 May 2010 09:55:46 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Invalid Privacy:  Public
Assigned to:  None Originator Name:  Tobias Neumann
Originator Email:  -email is unavailable- Open/Closed:  Closed
Release:  None Programmer hardware: 
Device type: 

Jump to the original submission

Thu 03 Jun 2010 04:20:31 PM UTC, comment #6: 

Well, the prerequisite is a non-buggy libusb 0.1 (or API
compatible) ;-), there is no specific dependency against
any particular kernel revision of any supported OS.

Anyway, I added an entry to the "Troubleshooting" section
of the texinfo doc file, explaining that some Linux versions
have troubles with their 0.1 API wrapper.  I'm not sure
people will actually read this though. ;-)

Joerg Wunsch <joerg_wunsch>
Group administrator
Thu 03 Jun 2010 07:58:21 AM UTC, comment #5: 

Perhaps we should file another bug report for not mentioning the prerequisites regarding kernel/libusb in the AVRDUDE documentation?

Even if there is no clean solution this would help some people when they hit this problem. It took my about two days of working power to find an explanation; it was very important for me to figure it out because I am using an AVRISP mkII with AVRDUDE in a production test system. Of course changing just the file size could have solved/obfuscated the problem but I had to be sure that the in-circuit tester works reliable.



Andreas Schweigstill <schweigstill>
Thu 03 Jun 2010 04:19:46 AM UTC, comment #4: 

Thanks for the analysis, Andreas.  That explains why I could
never see it myself (FreeBSD using either original libusb
0.1.x, or FreeBSD 8 which provides a libusb 0.1 API wrapper
to its own libusb which is different from libusb 1.x).

Unfortunately, I don't think there's anything that can be
done about it on the AVRDUDE side.  If someone has a
suggestion for a workaround that doesn't break anything else,
I'm willing to commit it.

Joerg Wunsch <joerg_wunsch>
Group administrator
Wed 02 Jun 2010 07:30:24 PM UTC, comment #3: 

I also experienced such problems and found the reason for such file
size depending behaviour. A description of what I have found out can
be read here (in German language):

http://www.mikrocontroller.net/topic/96528

The problem is related to improper handling of USB zero-length packets
(ZLP) which was introduced by the libusb 0.1 API wrapper for libusb 1.0.

Some workarounds:
- use a very old Linux system which doesn't support libusb 1.0
- use a very new Linux kernel >=2.6.31 AND libusb >= 1.0.3

This ZLP problem affects also many other projects which use USB bulk
communication over libusb:

http://www.libusb.org/ticket/6

With best regards
Andreas Schweigstill

Andreas Schweigstill <schweigstill>
Mon 31 May 2010 12:37:12 PM UTC, comment #2: 

I attached a tar file of all the contents you need to see the bug. I
tested it and it still crashes.

The program isnt doing anything usefull, it is just to demonstrade the
crash. If you add or delete anything from the programm it will be burned
on the µC without any problems.

Greetings,
Tobias Neumann.

$ avrdude -v -c avrispmkII -P usb -p m16

avrdude: usbdev_open(): Found AVRISP mkII, serno: 0000B0018759        
         AVR Part                      : ATMEGA16                     
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll             
Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages
MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
           eeprom         4    10   128    0 no        512    4      0
9000  9000 0xff 0xff
           flash         33     6   128    0 yes     16384  128    128
4500  4500 0xff 0xff
           lock           0     0     0    0 no          1    0      0
9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0
9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0
9000  9000 0x00 0x00
           signature      0     0     0    0 no          3    0    

  1.     0     0 0x00 0x00

           calibration    0     0     0    0 no          4    0    

  1.     0     0 0x00 0x00


         Programmer Type : STK500V2
         Description     : Atmel AVR ISP mkII
         Programmer Model: AVRISP mkII
         Hardware Version: 1
         Firmware Version Master : 1.13
         Vtarget         : 5.0 V
         SCK period      : 4.00 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9403
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as 99

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as 99
avrdude: safemode: Fuses OK

avrdude done.  Thank you.





(file #20663)

Tobias Neumann <tobias0405>
Wed 19 May 2010 12:55:52 PM UTC, comment #1: 

Please attach the file that makes it crash for you.  Also
(just in case) I'd like to know the firmware revision your
AVRISPmkII is using (you can see it when adding one -v to
AVRDUDE).

Joerg Wunsch <joerg_wunsch>
Group administrator
Wed 19 May 2010 09:55:46 AM UTC, original submission:  

I am programming a ATmega16 on openSUSE 11.2 and I found a bug that crashes the AVRdude, Version 5.10.

My output from "uname -a":
Linux linux-zpyf 2.6.31.5-0.1-desktop #1 SMP PREEMPT 2009-10-26 15:49:03 +0100 x86_64 x86_64 x86_64 GNU/Linux

I burn my Programm with the following line:
avrdude -u -e -c avrisp2 -P usb -p m16 -U flash:w:beispiel.hex

I am using the following programmer:
AVRATAVRISPMKII

I get the same result with another programmer of this type.

When the crash occurs, the status LED of my programmer turns RED.

The AVRdude hangs at this point:
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9403
avrdude: erasing chip
avrdude: reading input file "beispiel.hex"
avrdude: input file beispiel.hex auto detected as Intel Hex
avrdude: writing flash (246 bytes):

Writing | ##########################                         | 52% 0.03s

If I add or delete something in my sourcecode to get a smaller or bigger program size (i.e. 244 or 248 bytes), the AVRdude burns the programm on my ATmega16 without any problems.

On request I could send you a progoramm that crashes.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #20663:  246_byte_crash.tgz added by tobias0405 (2KiB - application/x-compressed-tar)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by schweigstill (Posted a comment)
  • -email is unavailable- added by tobias0405 (Updated the item)
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-06-03 joerg_wunsch StatusNeed Info Invalid
        Open/ClosedOpen Closed
    2010-05-31 tobias0405 Attached File- Added 246_byte_crash.tgz, #20663
    2010-05-19 joerg_wunsch StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code