bugAVR Downloader/UploaDEr - Bugs: bug #41357, OS X: Avrdude messes with the usb...

 
 

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

bug #41357: OS X: Avrdude messes with the usb stack?

Submitter:  Juergen Eckert <jesid>
Submitted:  Sun 26 Jan 2014 08:45:30 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  joerg_wunsch Originator Name:  Juergen Eckert
Open/Closed:  Closed Release:  None
Programmer hardware:  Device type: 

Jump to the original submission

Mon 27 Jan 2014 09:16:20 PM UTC, comment #6: 

I restricted the usb_reset() call to #if defined(_linux_).

Joerg Wunsch <joerg_wunsch>
Group administrator
Mon 27 Jan 2014 02:08:47 PM UTC, comment #5: 

I just tried the patch on my mkII. It remains responsive all the time. No problems at all...

I recommend patching this into the main branch.

Greetinx
Juergen

Juergen Eckert <jesid>
Sun 26 Jan 2014 09:53:35 PM UTC, comment #4: 


> What is necessary to get this change into the main branch?


Your bug report (plus confirmation) suffices. ;-)

Joerg Wunsch <joerg_wunsch>
Group administrator
Sun 26 Jan 2014 09:44:39 PM UTC, comment #3: 

Joerg,
you made my day!

I changed the corresponding line to:

#ifdef _linux_

and it works w/o my workaround. (I tested it with my dragon.) I will test it on my second MAC with the below mentioned problematic mkII as soon as I get it back from my student.

What is necessary to get this change into the main branch?

Danke (thx)
Juergen

Juergen Eckert <jesid>
Sun 26 Jan 2014 09:15:36 PM UTC, comment #2: 

Thank you very much for your fast reply. I will try to compile the software myself and report back ASAP.

What I do not understand is why my micro script seems to solve the problem...

Juergen


Juergen Eckert <jesid>
Sun 26 Jan 2014 08:59:12 PM UTC, comment #1: 

Can you recompile your AVRDUDE version yourself?

In usb_libusb.c, there's the following piece of code:


#if !( defined(__FreeBSD__) ) // || ( defined(__APPLE__) && defined(__MACH__) ) )
  /*
   * Without this reset, the AVRISP mkII seems to stall the second
   * time we try to connect to it.  This is not necessary on
   * FreeBSD.
   */
  usb_reset(udev);
#endif


As you can see, opinions varied over time whether the
usb_reset() were needed for OSX or not.  It seems to be
needed for Linux, where this code originates from, and it's
for sure not needed on FreeBSD, as FreeBSD's initial libusb
implementation implemented usb_reset() only as a stub without
any action, yet it works there.

Try removing the comment mark in the #if line.  Well, maybe
we should actually change the #if into an #ifdef _linux_
if Linux is the only system that needs this.

Joerg Wunsch <joerg_wunsch>
Group administrator
Sun 26 Jan 2014 08:45:30 PM UTC, original submission:  

Mac OSX 10.9.1
Eclipse: 20130919-0819
AVR Plugin: 2.4.1
AVRDude: 6.0.1 (CrossPack-AVR-20131216)
AVR ISP: Dragon and MKII

Hi,

if a programming attempt fails (e.g. due to an unconnected ISP) it happens that the USB bus of the whole system gets a reset (in approximately 50% of the cases). Keyboard, mouse, and the rest is not functional for a few seconds. However, the main problem is that the USB programmer does not get recognized anymore. The only solution I have is rebooting (annoying). (Note: rebooting takes twice the usual time.)

The output:

>avrdude: jtagmkII_setparm(): bad response to set parameter command: RSP_FAILED
>avrdude: jtagmkII_getsync(): ISP activation failed, trying debugWire
>avrdude: jtagmkII_setparm(): bad response to set parameter command: RSP_NO_TARGET_POWER
>avrdude: failed to sync with the AVR Dragon in ISP mode


Which is normal because I disconnected the target board. However with a probability of 50% a reset occurs on the USB bus and the programmer is unaccessable (replugging is useless). The next attempts until the next system reboot (!!) looks like:

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


The system does not recognize the programmer until the next reboot.

The problem only occurs if I try to upload the sketch using the avr-eclipse-plugin. I already reported this: https://sourceforge.net/p/avr-eclipse/bugs/66/ and came up with a man-in-the-middle like script which solves the problem.

I don't know what is causing the problem. The plugin, avrdude, or libusb. Or why the script seems to be a workaround. However, I find it very strange/disturbing that it can crash the usb stack like this...

I tried it with two different MACs and two different ISPs. Always with the same result.

Greetinx
Juergen


Juergen Eckert <jesid>

 

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

No files currently attached

 

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 jesid (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-27 joerg_wunsch StatusNone Fixed
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code