Opened 10 years ago

Closed 10 years ago

#41654 closed defect (fixed)

cross/avrdude: update to 6.0.1 broken with AVR ISP MK2

Reported by: abusse@… Owned by: bd34n (Brian Dean)
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: g5pw (Aljaž Srebrnič)
Port: avrdude

Description (last modified by mf2k (Frank Schima))

After updating to 6.0.1, trying to program with an AVR ISP MK2 only results in the following repeating statement:

avrdude: stk500v2_recv_mk2: error in USB receive

Reverting to 5.11.1 resolved the problem and everything works as expected. So it seems the port gets broke with the push to 6.0.1.

Change History (12)

comment:1 Changed 10 years ago by mf2k (Frank Schima)

Description: modified (diff)
Owner: changed from macports-tickets@… to bsd@…
Port: avrdude added

In the future, please use WikiFormatting, fill in the Port field and Cc the port maintainers (port info --maintainers avrdude).

comment:2 Changed 10 years ago by macports@…

I believe this is part of a bigger issue with avrdude. I am having similar issues with 6.0.1 on three different computers (10.6.8, 10.7.5, and 10.9). I've tried two different programmers. The AVRISP MKII, and the AVR Dragon via JTAG. The AVR ISM MKII was used on a ATmega328P (Uno), and the dragon on a ATmega64L on a custom board. Both devices work on on all machines using the 5.11 binary shipped with the Arduino IDE, but fail (sometimes hang, others timeout endlessly depending on the type of read) using 6.0.1. Here is the failed output from both targets while reading fuses:

HackNMac:~ admin$ /opt/local/bin/avrdude -vvvv -c dragon_jtag -p ATmega64 -P usb

avrdude: Version 6.0.1, compiled on Jan  3 2014 at 14:01:59
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/opt/local/etc/avrdude.conf"
         User configuration file is "/Users/admin/.avrduderc"

         Using Port                    : usb
         Using Programmer              : dragon_jtag
avrdude: jtagmkII_dragon_open()
avrdude: usbdev_open(): Found AVRDRAGON, serno: 00A20000357E
avrdude: jtagmkII_getsync()
avrdude: jtagmkII_getsync(): Sending sign-on command: 
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Sent: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97] 
avrdude: jtagmkII_recv():
avrdude: usb_fill_buf(): usb_bulk_read() error Operation timed out
avrdude: jtagmkII_recv(): Timeout receiving packet
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): Sending sign-on command: 
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Sent: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97] 
avrdude: jtagmkII_recv():
avrdude: usb_fill_buf(): usb_bulk_read() error Operation timed out
avrdude: jtagmkII_recv(): Timeout receiving packet
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): Sending sign-on command: 
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Sent: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97] 
avrdude: jtagmkII_recv():

and...

HackNMac:~ admin$ /opt/local/bin/avrdude -vvv -P usb -c avrispmkii -p ATmega328P -qq -U lfuse:r:/tmp/LOW.tmp:h -U efuse:r:/tmp/EXTENDED.tmp:h -U hfuse:r:/tmp/HIGH.tmp:h

avrdude: Version 6.0.1, compiled on Jan  3 2014 at 14:01:59
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/opt/local/etc/avrdude.conf"
         User configuration file is "/Users/admin/.avrduderc"

         Using Port                    : usb
         Using Programmer              : avrispmkii
avrdude: usbdev_open(): Found AVRISP mkII, serno: 0000B0016102
avrdude: usbdev_recv_frame(): usb_bulk_read(): Operation timed out
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: usbdev_recv_frame(): usb_bulk_read(): Operation timed out
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: usbdev_recv_frame(): usb_bulk_read(): Operation timed out
avrdude: stk500v2_recv_mk2: error in USB receive
^Cavrdude: usbdev_recv_frame(): usb_bulk_read(): Operation timed out
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: usbdev_recv_frame(): usb_bulk_read(): Operation timed out
avrdude: stk500v2_recv_mk2: error in USB receive
^C
HackNMac:~ admin$

Both output were generated on the 10.7.5 machine.

All three errors are USB related, though the hardware driver appears to report the error differently. All three of my machines have the same libusb:

HackNMac:~ admin$ sudo port list | grep libusb
Password:
libusb                         @1.0.17         devel/libusb
libusb-compat                  @0.1.4          devel/libusb-compat
libusb-devel                   @1.0.8.20101017 devel/libusb-devel
libusb-legacy                  @0.1.12         devel/libusb-legacy
HackNMac:~ admin$

comment:3 Changed 10 years ago by mf2k (Frank Schima)

port list doesn't tell us anything very useful. The output of the following command will however:

port installed libusb*

comment:4 in reply to:  3 ; Changed 10 years ago by abusse@…

Stupid me already forgot about this ticket. In fact I had solved the problem back in december but had not the time to to get back since I had a very pressing deadline. I am very sorry for that!

The problem is that the patch to the file stk500v2.c was removed with the push to 6.0.1. Adapting the changes from that file to 6.0.1 did the trick for me.

Version 0, edited 10 years ago by abusse@… (next)

comment:5 in reply to:  3 Changed 10 years ago by macports@…

Replying to macsforever2000@…:

port list doesn't tell us anything very useful. The output of the following command will however:

port installed libusb*

Here is the output from the 10.7.5 machine (the other two are identical):

HackNMac:~ admin$ port installed libusb*
The following ports are currently installed:
  libusb @1.0.17_0 (active)
  libusb-compat @0.1.4_0 (active)
HackNMac:~ admin$

comment:6 in reply to:  4 Changed 10 years ago by macports@…

Replying to abusse@…:

Stupid me already forgot about this ticket. In fact I had solved the problem back in december but had not the time to to get back since I had a very pressing deadline back then. I am very sorry for that!

The problem is that the patch to the file stk500v2.c was removed with the push to 6.0.1. Adapting the changes from that file to 6.0.1 did the trick for me.

Which patch is that? It sounds like it'll fix the problem with the AVR ISP MKII, but isn't likely to address the AVR Dragon via JTAG. Is there a chance a patch was left out there as well? It would be great to solve these issues and update the port.

Last edited 10 years ago by macports@… (previous) (diff)

comment:7 Changed 10 years ago by g5pw (Aljaž Srebrnič)

Does it work with avrdude 6.1 (just updated in r120473)?

comment:8 Changed 10 years ago by g5pw (Aljaž Srebrnič)

Cc: g5pw@… added

Cc Me!

comment:9 in reply to:  7 Changed 10 years ago by abusse@…

Thanks for the upgrade! Unfortunately this does not fix the problem. Like I said before applying the patch from 5.11.1 of the stk500v2.c file made 6.0.1 working again. But looking at the vanilla code of 6.1 the part of the code in question looks like this:

  DEBUG("STK500V2: stk500v2_getsync()\n");

  if (PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE_MKII ||
      PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE3)
    return 0;

retry:

To make it work, I would expect something like this:

  DEBUG("STK500V2: stk500v2_getsync()\n");

  if (PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE_MKII ||
      PDATA(pgm)->pgmtype == PGMTYPE_JTAGICE3 ||
      PDATA(pgm)->pgmtype == PGMTYPE_AVRISP_MKII)
    return 0;

retry:

I am currently using an Arduino Mega to test it and since the Arduino does only an emulation of the original programmer it might be a flaw on the Arduino side. I do not have an original AVR programmer at my disposal right now, so I cannot test this hypothesis. But since I assume that some people are trying to use the Arduino with a Mac it might be worth fixing this flaw in avrdude, so they can simply get everything running without a problem. If you don't want to have this patch in the code, maybe we can at least create a variant with this patch to make life of some people easier.

comment:10 Changed 10 years ago by g5pw (Aljaž Srebrnič)

This sounds like it should be reported upstream, though, as it doesn't look like a bug in the port as a bug in avrdude itself. Perhaps it's linked to this bug or this one?

comment:11 in reply to:  10 Changed 10 years ago by abusse@…

Yes definitely, I will report it as soon as I have some minutes to spare...and it doesn't seem to be connected to the bugs you mentioned. However, the patch was part of the port file prior to version 6.0, so for me it raises the question why?

comment:12 Changed 10 years ago by g5pw (Aljaž Srebrnič)

Resolution: fixed
Status: newclosed

Re-added patch in r120866.

Note: See TracTickets for help on using tickets.