Problem uploading to Mightcore1284 with Olimex AVR-ISP-MK2, "Error in USB receive"

Hello! I’m using an Olimex AVR-ISP-MK2 to upload to an ATMega1284 based board. I’m experiencing a familiar error in which the programmer says “Error in USB receive”. This is on account of a bug in avrdude conflicting with LUFA and the Olimex programmer using LUFA.

From it’s product page it says

"The hardware of your AVR-ISP-MK2 is fine. There is a software bug that affects LUFA-based programmers in newest releases of AVRDUDE. Either use AVRDUDE versions prior to 6.x.x or apply this patch to the AVRDUDE sources and compile.

The same problems appears in newest releases of Arduino IDE – they use AVRDUDE versions 6.0.1 or newer. The last suitable Arduino IDE version that uses pre-6.x.x AVRDUDE version is Arduino IDE 1.5.7.

The official bug report is here: AVR Downloader/UploaDEr - Bugs: bug #40831, LUFA AVRISP-MKII fails with... [Savannah]

More about the issue can be found here: http://www.avrfreaks.net/forum/lufa-based-avrisp-mkii-doesnt-work-avrdude-601"

I fixed this in Arduino 1.6.3 by simply using an earlier version of avrdude before avrdude 6 and have since found no problems. Unfortunately in PlatformIO I don’t know how to replace avrdude or if that’s a bad idea so I’m wondering what you think would be the best practice here?

Should I simply buy the Atmel AVRISP mk2 since it isn’t LUFA based? The Olimex programmer is great otherwise, cheaper than the Atmel and has a jumper to provide 5v or 3.3v power to target.

Thanks for any suggestions!

You definitely should try to replace avrdude, the package is located here:
Linux: /home/user/.platformio/packages/tool-avrdude
Windows: c:\Users\user\.platformio\packages\tool-avrdude

Ok thank you! I’ll make a backup in that directory just in case. Didn’t know if it would be automatically overwritten by updates or something. I’ll try that later tonight and report back whether it fixes it as expected.

Replacing PlatformIO’s avrdude with version 5.11 worked for me!

@jordanapplewhite Thanks! Please keep in mind that your changes will be overwritten with the next avrdude update.

I updated to the latest version of PlatformIO CLI and IDE and it seems like now when I copy my old avrdude and avrdude.conf files over, I’m getting an error during “Upload Using Programmer”:
Using Port : lpt1
Using Programmer : arduino
avrdude: ser_open(): can’t open device “lpt1”: The system cannot find the file specified.
avrdude done. Thank you.

I tried specifying in platformio.ini:
upload_port = usb
upload_protocol = stk500v2

but I get:
Using Port : com1
Using Programmer : stk500v2
avrdude: ser_open(): can’t open device “\.\com1”: The system cannot find the file specified.
avrdude done. Thank you.

This programmer works with my version of avrdude v5 using the options -Pusb and -Cstk500v2. I’m grateful for any hints or suggestions to get platformio to use -Pusb with this earlier version of avrdude! Thank you!

Oh! I got it working by specifiying
upload_flags = -Pusb

instead of
upload_port = usb

:slight_smile:

Be careful with the documentation :blush: Atmel AVR — PlatformIO v6.1 documentation

1 Like