avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avrdude-dev] [bug #34339] back to back avrdude commands fail on dragon_


From: anonymous
Subject: [avrdude-dev] [bug #34339] back to back avrdude commands fail on dragon_isp on Ubuntu 10.10
Date: Tue, 20 Sep 2011 07:49:31 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:5.0.1) Gecko/20100101 Firefox/5.0.1

URL:
  <http://savannah.nongnu.org/bugs/?34339>

                 Summary: back to back avrdude commands fail on dragon_isp on 
Ubuntu 10.10
                 Project: AVR Downloader/UploaDEr
            Submitted by: None
            Submitted on: Tue 20 Sep 2011 07:49:30 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Bill Perry
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

While I'm seeing this on Ubuntu 10.10 with the AVR dragon I'm guessing that
this
os and this device may not be the only one to experience this problem.

If you issue back to back avrdude commands when using dragon_isp the second
command will fail unless a delay is done between the commends.

This shows up when applications like the Arduino IDE
use 2 avrdude commands to burn a bootloader. 1 to set the fuses and 1 to burn
the actual bootloader. Since they are back to back, the second avrdude fails.

The problem is that the usbdev_close() function in usb_libusb.c is reseting
the USB device by calling usb_reset() an all OSs but FreeBSD. This forces the
dragon (or any USB device) to have to re-enumerate which takes time. If the
next open attempt is done before the enumeration is finished, the dragon will
not be seen and you get an error:

avrdude: usbdev_open(): did not find any USB device "usb"

Through experimentation 2 seconds seems to be enough delay
to allow the enumeration to complete at least in my environment.

But in looking at the comment above the usb_reset() call it appears
that usb_reset() was added to resolve an issue with the AVRISP mkII on the
second time around (probably also back to back commands).

If the usb_reset() is omitted the dragon_isp will also fail
on back to back commands but in a different way:

avrdude: usb_open(): cannot read serial number "error sending control message:
Cannot send after transport endpoint shutdown"
avrdude: usb_open(): cannot read product name "error sending control message:
No such device"
avrdude: usbdev_open(): error setting configuration 1: could not set config 1:
No such device
avrdude: usbdev_open(): did not find any USB device "usb"

However, again if you delay for 2 seconds the problem goes away.
So at least for the dragon you cannot attempt to talk to the dragon for a few
seconds after you terminate a connection to it.

This could be fixed in several ways.
A few  possibilities:
- have usbdev_open() do a retry internally a few seconds later if no devices
were found. (no changes to any other code)
- add a dumb/blind sleep in usbdev_close() after the usb_reset()/usb_close()
to slow down back to back commands.

For now, because I'm lazy, I've patched my version of 5.11.1 to have a
blind/dumb sleep(2) after usb_close() in  the function usbdev_close()

BTW, according to the libusb API it is not valid to call usb_close() after
usb_reset() so for now, I've also taken a short cut
by simply commenting out the usb_reset() which does not
seem to be needed for the Dragon on Ubuntu 10.10 anyway.

--- bill








    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?34339>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]