Welcome, Guest

Author Topic: AVR-ISP-MK2 Programmer not working avrdude 6.0.1  (Read 10050 times)

bjacquot

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
AVR-ISP-MK2 Programmer not working avrdude 6.0.1
« on: May 13, 2014, 11:20:41 PM »
Hello,

Can not use the programmer with avrdude 6.0.1 , while it works fine with avrdude 5.x

command used : avrdude -c avrisp2 -P usb - vvvv -p attiny10

result:

avrdude : Version 6.0.1 , compiled on October 21, 2013 at 3:55:32 p.m.
         Copyright ( c) 2000-2005 Brian Dean , http://www.bdmicro.com/
         Copyright ( c) 2007-2009 Joerg Wunsch

         System wide configuration file is " / etc / avrdude.conf "
         User configuration file is " / root / .avrduderc "
         User configuration file does not exist or is not a regular file , skipping

         Using Port : usb
         Using Programmer : avrisp2
avrdude : usbdev_open (): Found AVRISP mkII , serno : 000200012345
avrdude : Sent: . [01]
avrdude : usbdev_recv_frame (): usb_bulk_read () : error Submitting URB : No such file or directory
avrdude : stk500v2_recv_mk2 : error in USB receive
avrdude : Sent: . [01]
avrdude : usbdev_recv_frame (): usb_bulk_read () : error Submitting URB : No such file .....
 ..........
....... URB : No such file or directory
avrdude : stk500v2_recv_mk2 : error in USB receive
avrdude : stk500v2_getsync () : timeout communicating with program
         April Part: ATtiny10
         Chip Erase delay: 0 us
         PAGEL : P00
         BS2 : P00
         RESET disposition : dedicated
         RETRY pulse: SCK
         serial program mode : yes
         parallel program mode : yes
         Timeout: 0
         StabDelay : 0
         CmdexeDelay : 0
         SyncLoops : 0
         ByteDelay : 0
         PollIndex : 0
         PollValue : 0x00
         Memory Detail :

                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size # Pages minW maxW readback
           -------------------------------------------------- --------------------
           Signature 0 0 0 0 no 3 16 0 0 0 0x00 0x00
                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size # Pages minW maxW readback
           -------------------------------------------------- --------------------
           fuse 0 0 4 0 No 1 16 0 0 0 0x00 0x00
                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size # Pages minW maxW readback
           -------------------------------------------------- --------------------
           calibration 0 0 0 0 no 1 16 0 0 0 0x00 0x00
                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size # Pages minW maxW readback
           -------------------------------------------------- --------------------
           LockBits 0 0 0 0 no 1 16 0 0 0 0x00 0x00
                                  Block Poll Page Polled
           Memory Type Mode Delay Size Indx Paged Size Size # Pages minW maxW readback
           -------------------------------------------------- --------------------
           flash 0 0128 0 No 1024 16 0 0 0 0x00 0x00

         Program Type: STK500V2
         Description: Atmel AVR ISP mkII
         Programming Model : AVRISP mkII
avrdude : Sent: . [03] . [ 90 ]
avrdude : usbdev_recv_frame (): usb_bulk_read () : error Submitting URB : No such file or directory
avrdude : stk500v2_recv_mk2 : error in USB receive
avrdude : Sent: . [01]
avrdud .....................................
avrdude : usbdev_recv_frame (): usb_bulk_read () : error Submitting URB : No such file or directory
avrdude : stk500v2_recv_mk2 : error in USB receive
avrdude : stk500v2_getsync () : timeout communicating with program

Thank you to carefully consider this issue, avrdude 6 being the installable version recent distributions !

rons

  • Newbie
  • *
  • Posts: 1
  • Karma: +1/-0
Re: AVR-ISP-MK2 Programmer not working avrdude 6.0.1
« Reply #1 on: May 23, 2014, 04:35:20 PM »
I am experiencing the same problem, still doesn't work in 6.1
It does work fine with avrdude 5.11
For more info/solutions:
https://savannah.nongnu.org/bugs/index.php?40831
https://savannah.nongnu.org/bugs/index.php?40831

Regards

LubOlimex

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1937
  • Karma: +50/-3
Re: AVR-ISP-MK2 Programmer not working avrdude 6.0.1
« Reply #2 on: May 26, 2014, 03:12:39 PM »
Hey guys,

Thank you for the input.

This forum thread is worth the read: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=138424&start=0&postdays=0&postorder=asc&highlight.

Mind that the forum user named abcminiuser is the guy behind the LUFA firmware and the ISP-MK2 reference design we have used.

Considering that avrdude counts this as a bug I guess we have to wait until it is implemented in the next release. Additionally build it from sources as explained in the bug reports linked by rons.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

HypervisorX

  • Newbie
  • *
  • Posts: 2
  • Karma: +1/-0
Re: AVR-ISP-MK2 Programmer not working avrdude 6.0.1
« Reply #3 on: August 27, 2015, 10:02:58 PM »
I found this post trying to find info about getting the AVR-ISP-MK2 working with the newest arduino IDE versions. I set out to compile avrdude with the .patch file provided in the bug report links in previous posts, but they do not work for avrdude-6.0.1.

Here is a diff/.patch file I made that works with the avrdude-6.0.1 source for anyone else that may need it. I wanted to compile 6.0.1 as that is what the Arduino 1.6.4 IDE uses. This worked successfully for use in the Arduino 1.6.4 IDE in combination with the Olimex AVR-ISP-MK2 but of course there is no warranty of any kind that it will work for you etc.

I used MinGW to compile it on windows after copying a few files from libusb 1.2.6.0 to the appropriate places in MinGW. From the libusb-win32-bin-1.2.6.0.zip extract include\lusb0_usb.h to C:\MinGW\include\, lib\gcc\libusb.a to C:\MinGW\lib\, and bin\x86\libusb0_x86.dll to C:\MinGW\bin\

For anyone else trying to compile it to use in the (currently newest version) Arduino 1.6.4 IDE, once avrdude.exe is compiled put it in "C:\Program Files (x86)\Arduino\hardware\tools\avr\bin". You may want to make a backup of the original avrdude.exe before overwriting it, just in case you want to revert back without needing to reinstall.

I do also of course have the compiled avrdude.exe 6.0.1 file with the above patches however I am unsure of the rules on distributing/posting the exe directly. I assume that is probably not allowed so I have not tried to attach it. If a moderator wants it I would be happy to send or email it to them.

olimex-avr-isp-mk2.patch
Code: [Select]
Index: stk500v2.c
===================================================================
--- stk500v2.c (6.0.1)
+++ stk500v2.c (working copy)
@@ -1618,9 +1618,9 @@
     baud = USB_DEVICE_AVRISPMKII;
     PDATA(pgm)->pgmtype = PGMTYPE_AVRISP_MKII;
     pgm->set_sck_period = stk500v2_set_sck_period_mk2;
-    pgm->fd.usb.max_xfer = USBDEV_MAX_XFER_MKII;
-    pgm->fd.usb.rep = USBDEV_BULK_EP_READ_MKII;
-    pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
+    pgm->fd.usb.max_xfer = 0;
+    pgm->fd.usb.rep = -1;
+    pgm->fd.usb.wep = -1;
     pgm->fd.usb.eep = 0;           /* no seperate EP for events */
 #else
     fprintf(stderr, "avrdude was compiled without usb support.\n");
@@ -1674,7 +1674,7 @@
     baud = USB_DEVICE_STK600;
     PDATA(pgm)->pgmtype = PGMTYPE_STK600;
     pgm->set_sck_period = stk600_set_sck_period;
-    pgm->fd.usb.max_xfer = USBDEV_MAX_XFER_MKII;
+    pgm->fd.usb.max_xfer = 0;
     pgm->fd.usb.rep = USBDEV_BULK_EP_READ_STK600;
     pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_STK600;
     pgm->fd.usb.eep = 0;           /* no seperate EP for events */
@@ -3410,9 +3410,9 @@
 #if defined(HAVE_LIBUSB)
     serdev = &usb_serdev;
     baud = USB_DEVICE_JTAGICEMKII;
-    pgm->fd.usb.max_xfer = USBDEV_MAX_XFER_MKII;
-    pgm->fd.usb.rep = USBDEV_BULK_EP_READ_MKII;
-    pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
+    pgm->fd.usb.max_xfer = 0;
+    pgm->fd.usb.rep = -1;
+    pgm->fd.usb.wep = -1;
     pgm->fd.usb.eep = 0;           /* no seperate EP for events */
 #else
     fprintf(stderr, "avrdude was compiled without usb support.\n");
@@ -3523,9 +3523,9 @@
 #if defined(HAVE_LIBUSB)
     serdev = &usb_serdev;
     baud = USB_DEVICE_AVRDRAGON;
-    pgm->fd.usb.max_xfer = USBDEV_MAX_XFER_MKII;
-    pgm->fd.usb.rep = USBDEV_BULK_EP_READ_MKII;
-    pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_MKII;
+    pgm->fd.usb.max_xfer = 0;
+    pgm->fd.usb.rep = -1;
+    pgm->fd.usb.wep = -1;
     pgm->fd.usb.eep = 0;           /* no seperate EP for events */
 #else
     fprintf(stderr, "avrdude was compiled without usb support.\n");
Index: usb_libusb.c
===================================================================
--- usb_libusb.c (6.0.1)
+++ usb_libusb.c (working copy)
@@ -103,9 +103,7 @@
  }
     }
 
-  if (fd->usb.max_xfer == 0)
-    fd->usb.max_xfer = USBDEV_MAX_XFER_MKII;
-

   usb_init();
 
   usb_find_busses();
@@ -202,16 +200,19 @@
      }
 
    fd->usb.handle = udev;
-   if (fd->usb.rep == 0)
+   if (fd->usb.rep < 0)
    {
      /* Try finding out what our read endpoint is. */
      for (i = 0; i < dev->config[0].interface[0].altsetting[0].bNumEndpoints; i++)
      {
-       int possible_ep = dev->config[0].interface[0].altsetting[0].
- endpoint[i].bEndpointAddress;
-
+       int possible_ep = dev->config[0].interface[0].altsetting[0].endpoint[i].bEndpointAddress;
+   int possible_ep_size = dev->config[0].interface[0].altsetting[0].endpoint[i].wMaxPacketSize;
+  
        if ((possible_ep & USB_ENDPOINT_DIR_MASK) != 0)
        {
+   fprintf(stderr,
+   "%s: usbdev_open(): using read endpoint 0x%02x\n",
+   progname, possible_ep);
  if (verbose > 1)
  {
    fprintf(stderr,
@@ -219,33 +220,49 @@
    progname, possible_ep);
  }
  fd->usb.rep = possible_ep;
+ //Take smaller endpoint size as max
+ if ((fd->usb.max_xfer == 0) || (possible_ep_size < fd->usb.max_xfer))
+ {
+ fd->usb.max_xfer = possible_ep_size;
+ }
  break;
        }
      }
-     if (fd->usb.rep == 0)
+     if (fd->usb.rep < 0)
      {
        fprintf(stderr,
-       "%s: usbdev_open(): cannot find a read endpoint, using 0x%02x\n",
-       progname, USBDEV_BULK_EP_READ_MKII);
-       fd->usb.rep = USBDEV_BULK_EP_READ_MKII;
+       "%s: usbdev_open(): ERROR: cannot find a read endpoint\n",
+       progname);
+    
      }
    }
-   for (i = 0; i < dev->config[0].interface[0].altsetting[0].bNumEndpoints; i++)
+   if (fd->usb.wep < 0)
      {
-       if ((dev->config[0].interface[0].altsetting[0].endpoint[i].bEndpointAddress == fd->usb.rep ||
-    dev->config[0].interface[0].altsetting[0].endpoint[i].bEndpointAddress == fd->usb.wep) &&
-   dev->config[0].interface[0].altsetting[0].endpoint[i].wMaxPacketSize < fd->usb.max_xfer)
+       /* Try finding out what our write endpoint is. */
+       for (i = 0; i < dev->config[0].interface[0].altsetting[0].bNumEndpoints; i++)
  {
-   if (verbose != 0)
-     fprintf(stderr,
-     "%s: max packet size expected %d, but found %d due to EP 0x%02x's wMaxPacketSize\n",
-     progname,
-     fd->usb.max_xfer,
-     dev->config[0].interface[0].altsetting[0].endpoint[i].wMaxPacketSize,
-     dev->config[0].interface[0].altsetting[0].endpoint[i].bEndpointAddress);
-   fd->usb.max_xfer = dev->config[0].interface[0].altsetting[0].endpoint[i].wMaxPacketSize;
+   int possible_ep = dev->config[0].interface[0].altsetting[0].endpoint[i].bEndpointAddress;
+   int possible_ep_size = dev->config[0].interface[0].altsetting[0].endpoint[i].wMaxPacketSize;
+
+   if ((possible_ep & USB_ENDPOINT_DIR_MASK) == 0)
+     {
+   fprintf(stderr, "%s: usbdev_open(): using write endpoint 0x%02x\n",
+                                                  progname, possible_ep);
+       fd->usb.wep = possible_ep;
+   //Take smaller endpoint size as max
+   if ((fd->usb.max_xfer == 0) || (possible_ep_size < fd->usb.max_xfer))
+   {
+     fd->usb.max_xfer = possible_ep_size;
+   }
+       break;
+     }
+ }
+       if (fd->usb.wep < 0)
+ {
+   fprintf(stderr, "%s: usbdev_open(): ERROR: cannot find a write endpoint",
+                                          progname);
+ }
  }
-     }
    return 0;
    trynext:
    usb_close(udev);

MathieuMH

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: AVR-ISP-MK2 Programmer not working avrdude 6.0.1
« Reply #4 on: September 28, 2015, 09:53:23 AM »
Hi HypervisorX

Would you be so kind an give some instructions on how to use the patch?

I managed to recompile avrdude6-1 using the lib-usb files suggested.
This tutorial helped me do it: http://tomeko.net/other/avrdude/building_avrdude.php

But I'm curious on how the patch file works. I was not able to figure that out. Do have to edit those lines manually, I guess not?!

HypervisorX

  • Newbie
  • *
  • Posts: 2
  • Karma: +1/-0
Re: AVR-ISP-MK2 Programmer not working avrdude 6.0.1
« Reply #5 on: September 28, 2015, 10:20:02 AM »
Sure. In this example you would Create an empty text file with olimex-avr-isp-mk2.patch filename. Put all the text from the code box I posted above into that text file. The olimex-avr-isp-mk2.patch should be placed in the avrdude 6.0.1 source code directory that contains stk500v2.c and usb_libusb.c. If i recall correctly that is the base directory of the avrdude 6.0.1 source code. once the patch file is there you should be able to apply it using the patch command.

go to the directory with the newly created   olimex-avr-isp-mk2.patch file and the stk500v2.c and usb_libusb.c files in the terminal and run the command
Code: [Select]
patch -i olimex-avr-isp-mk2.patch --dry-run see if that looks like the changes are going to make the correct changes. If they are just take the --dry-run part off the end and run the command again.
Code: [Select]
patch -i olimex-avr-isp-mk2.patch The .patch file is just a file i created using diff. You may find http://jungels.net/articles/diff-patch-ten-minutes.html helpful as a super quick/dirty guide to diff and patch.

Hope that helps. If you need anything clarified let me know and I'll do my best. I'm no expert by any means but hopefully that will get you going.

Edit: if this wasnt clear these commands would be run in your *nix shell not windows command prompt. if diff/patch are not available then you would need to install them first or just do the edits by hand. should be super easy to install if they arent already though. If you are using mingw to compile then it would be in the window opened when you run msys.bat
« Last Edit: September 28, 2015, 10:26:39 AM by HypervisorX »

MathieuMH

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: AVR-ISP-MK2 Programmer not working avrdude 6.0.1
« Reply #6 on: September 28, 2015, 11:49:30 AM »
Hi HypervisorX,

Thank you for the info. It worked like a charm! Now I'm able to program my XMEGA.

bassik

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: AVR-ISP-MK2 Programmer not working avrdude 6.0.1
« Reply #7 on: October 18, 2016, 01:30:23 PM »
Hello,
new on the forum and I start immediatelly withthe question...apologies.

I have bought your AVRISP MKII and I have been trying to use it on my mac laptop yesterday night without any success...then I discover this topic.

As I am not so proficient in computing to the level of compiling a new version of AVRdude, would it be possible to help me on that?
Can you send an already compiled version with the patch?

I have used the following tutorial to set-up avrdude on my laptop:
http://www.ladyada.net/learn/avr/setup-mac.html

I have followed option 1.

Thank you very much in advance
Sero