patchAVR Downloader/UploaDEr - Patches: patch #7896, DFU FLIPv2 programming support

 
 

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

patch #7896: DFU FLIPv2 programming support

Submitted by:  Kirill Levchenko <kirill_levchenko>
Submitted on:  Sat 01 Dec 2012 09:01:31 AM UTC  
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  Joerg Wunsch <joerg_wunsch> Open/Closed:  Closed

Fri 17 Jan 2014 04:57:27 PM UTC, comment #4: 

Done (with a few minor changes), thanks!

I also took this occasion to clone the FLIPv2 implementation
into a FLIPv1 one (for AT90USB* and ATmega*U* devices), so we
cover all FLIP/DFU-capable AVR devices now.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Tue 12 Mar 2013 01:58:19 PM UTC, comment #3: 

It stops at that point under Linux since it segfaults.  This
is because there are zero endpoint descriptors present, so

found->config->interface->altsetting->endpoint

equals 0 here:

  memcpy(&dfu->endp_desc, found->config->interface->altsetting->endpoint,
    sizeof(dfu->endp_desc));

If I conditionalize that memcpy() on ...->endpoint being != 0,
the Linux behaviour resembles the one under FreeBSD:

avrdude: Warning: USB bDeviceClass = 255 (expected 0)
avrdude: Warning: USB bDeviceSubClass = 1 (expected 0)
avrdude: Warning: USB bInterfaceClass = 0 (expected 255)
avrdude: Warning: Failed to read USB device string 1: error sending control message: Broken pipe
avrdude: Warning: Failed to read USB device string 2: error sending control message: Broken pipe
avrdude: Error: DFU_DNLOAD failed: error sending control message: Broken pipe
avrdude: Error: Failed to get DFU status: error sending control message: Broken pipe
avrdude: Error: Failed to set memory unit 0x05 (signature)
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: error reading signature data for part "ATmega32U2", rc=-1
avrdude: error reading signature data, rc=-1

avrdude done.  Thank you.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Tue 12 Mar 2013 10:58:14 AM UTC, comment #2: 

I just tested it under Linux.  Result:

% sudo ./avrdude -C avrdude.conf -c flip2 -p atmega32u2 -v

avrdude: Version 5.11svn, compiled on Mar 12 2013 at 11:34:51
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

...
         Programmer Type : flip2
         Description     : FLIPv2 USB DFU protocol (AVR4023)

avrdude: Found VID=0x03eb PID=0x2ff0 at 003:003

At that point, it just exits.

I guess it needs a bit of further debugging before we can
commit it.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Tue 12 Mar 2013 07:33:17 AM UTC, comment #1: 

Thanks for the patch, Kirill!  I just tried it, using an ATmega32U2.

Here are some remarks.  First, if I don't have the target plugged in,
I get:

% ./avrdude -C avrdude.conf -c flip2 -p m32u2 -t

avrdude: Error: No matching USB device found
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: error reading signature data for part "ATmega32U2", rc=-1
avrdude: error reading signature data, rc=-1

avrdude done.  Thank you.

I think it should bail out there before proceeding to read the
signature.

Second, after plugging in the controller, I get (on FreeBSD):

% ./avrdude -C avrdude.conf -c flip2 -p m32u2 -t

avrdude: Warning: USB bDeviceClass = 255 (expected 0)
avrdude: Warning: USB bDeviceSubClass = 1 (expected 0)
avrdude: Warning: USB bInterfaceClass = 0 (expected 255)
avrdude: Error: DFU_DNLOAD failed: Unknown error
avrdude: Error: DFU status ERR_WRITE
avrdude: Error: Failed to read 0x0004 bytes at 0x0000
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: error reading signature data for part "ATmega32U2", rc=-1
avrdude: error reading signature data, rc=-1

avrdude done.  Thank you.

So, at least for the USB megaAVR devices, something's still wrong.

(Yes, I did add the USB PID of the ATmega32U2 to avrdude.conf before.)

I think, all new files should get your copyright, with the current
year, not anybody else's.

For reference, here are the descriptors I can read out from the
device:

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x00ff
  bDeviceSubClass = 0x0001
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0020
  idVendor = 0x03eb
  idProduct = 0x2ff0
  bcdDevice = 0x0000
  iManufacturer = 0x0001  <ATMEL>
  iProduct = 0x0002  <ATmega32U2 DFU>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

Configuration index 0

    bLength = 0x0009
    bDescriptorType = 0x0002
    wTotalLength = 0x0012
    bNumInterfaces = 0x0001
    bConfigurationValue = 0x0001
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x0080
    bMaxPower = 0x0032

    Interface 0
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0000
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0000
      bInterfaceClass = 0x0000
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Sat 01 Dec 2012 09:01:31 AM UTC, original submission:  

The attached patch adds FLIPv2 (AVR4023) suppport, allowing EEPROM and Application Flash to be programmed on USB-capable XMEGA parts that have a pre-installed bootloader.

Tested with XMEGA128A3U and XMEGA128A4U.

Kirill Levchenko <kirill_levchenko>

 

Attached Files
file #27009:  flip2.patch added by kirill_levchenko (57KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by kirill_levchenko (Submitted the item)
  •  

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

    Only logged-in users can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-17 joerg_wunsch StatusIn Progress => Done
        Open/ClosedOpen => Closed
    2013-03-12 joerg_wunsch StatusNone => In Progress
        Assigned toNone => joerg_wunsch
    2012-12-01 kirill_levchenko Attached File- => Added flip2.patch, #27009

    Back to the top


    Powered by Savane 3.5