Olimex AVR ISP MKII error in USB receive

Started by xi, June 24, 2016, 04:44:53 PM

Previous topic - Next topic

xi

Hello,

I know this is a common problem: avrdude 6.x doesn't work with Olimex AVR ISP MKII, so I am doing this post for giving a few more informations for those who are still stuck with this issue.


  • Introduction:
    I bought the Olimex AVR-ISP-MK2 a few month ago on Radiospares or Farnell. It work(ed*) on windows. But I use Linux (Mageia 5) with avrdude 6.3 version.
    .

  • Problem:
    Some operations worked with avrdude (detecting the device, dumping the memory, ...), but, writing the device failed with these kind of errors:
Writing |                                                    | 0% 0.00savrdude: stk500v2_recv_mk2: error in USB receive
avrdude: usbdev_send(): wrote -5 out of 1 bytes, err = Input/output error
avrdude: stk500_send_mk2(): failed to send command to serial port
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: stk500v2_recv_mk2: error in USB receive


  • Solution:
    So why this post?


    • First: the avrdude bug with Olimex programmer is still here in version 6.3 of avrdude :(
      So you have to apply the patch from here: https://savannah.nongnu.org/bugs/?40831
      But, for me, the problem is still here after doing this! (tested 6.2, 5.11.1 too, and still have the same kind of errors).
      +

    • The "error in USB receive" had two causes: the above bug, plus a "not up to date (?)" firmware in the Olimex programmer, so you have to upgrade the firmware of the Olimex programmer:
      - Download the firmware from here: https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/resources/AVR-ISP-MK2-Firmware-WindowsDrivers.zip
      - Instructions for upgrade on Linux are in the user's manual of the programmer: https://www.olimex.com/Products/AVR/Programmers/AVR-ISP-MK2/resources/AVR-ISP-MK2.pdf
      - Download the latest firmware loader called "dfu-programmer" from here and install it (currently v0.7.1): https://github.com/dfu-programmer/dfu-programmer/releases

      - Install the firmware into the Olimex programmer:
      Uncompress the firmwares file
      Go into the "AVR-ISP-MK2-Firmware-WindowsDrivers/Firmware_Drivers/FIRMWARE-FOR-AVRDUDE-LIBUSB/" directory
      Plug your Olimex programmer
      Press its upgrade button
      Run command "dfu-programmer at90usb162 erase" as root
      Run command "dfu-programmer at90usb162 flash --debug 6 libUSB-AVRISP-MKII.hex" as root

      - That's it!
      Now flashing my Attiny 26L with Olimex programmer works :)
      avrdude -c avrispmkII -P usb -p attiny26 -U flash:w:test_file.hex

*Question for Olimex: my AVR-ISP-MK2 from Olimex worked on windows with stk500.exe software before this firmware upgrade. Will it still work after the upgrade? (I can't verify currently, but I would prefer that my colleague can still use it on windows ::))

xi

In addition to what I wrote: to access the programmer as a non-root user, you have to add udev rules ... and the procedure given in the user's manual are unlikely to work on a "normal" recent Linux system (Mageia 5 for me, most likely the same for Fedora and RedHat).

So, to get the udev rules working:
- as root, create a file named /etc/udev/rules.d/avrisp.rules

- put the following into the file:
SUBSYSTEM!="usb", ACTION!="add", GOTO="avrisp_end"

# Atmel Corp. JTAG ICE mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2103", MODE="0666", GROUP="dialout"
# Atmel Corp. AVRISP mkII
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2104", MODE="0666", GROUP="dialout"
# Atmel Corp. Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", MODE="0666", GROUP="dialout"

LABEL="avrisp_end"

(note the differences with the ubuntu version : ATTR must be used everywhere, and MODE value allow any user to use the programmer. If you want to be more subtle, you can let MODE="660" and add the user(s) that need to access the programmer to the group "dialout" ...)

- Still as root, you have to reload the rules, and AFAIK, udev is no more a service but is integrated into systemd, so restarting the "udev" service wont work, you have to use udevadm command:
udevadm control --reload-rules
udevadm trigger

- Then your programmer should work as a non root user :)

LubOlimex

Thank you for the great post and the detailed guide! I will point Linux users to it for sure!

Salut,
Lub/OLIMEX
Technical support and documentation manager at Olimex