Got -71?

USB AVR Programmer and SPI interface. Adafruit's USBtinyISP.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Got -71?

Post by Zero »

Since nobody has mentioned the same error I'm about to detail I'm guessing it's isolated, but I'm going to document my progress and describe the error that I am getting so that if anyone else has the same problem they can hopefully get things fixed.

First off, the error I am getting:

Code: Select all

sudo avrdude -c usbtiny -p attiny2313 -e -U flash:w:ringclock.hex -P /dev/USBTiny

USB read error: expected 4, got -71
USB read error: expected 4, got -71
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.
Just to let you know I have a udev rule mapping the device to /dev/USBTiny. This error comes up on a new computer (Intel Core2 Duo, Ubuntu x86-64 version 8.04, also tested under 7.10 with the same error). The version of avrdude I am using is:

Code: Select all

avrdude: Version 5.5, compiled on Mar 16 2008 at 13:02:41
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
and I have tried several other versions, including builds I have made myself and builds I have confirmed to work on two other machines. This current build of 5.5 is one I made myself, as the ubuntu stock version gives me the following error when run (this is also the only line of output):

Code: Select all

avrdude: error: usbtiny_transmit: error sending control message: Protocol error
A recompile from the ubuntu sources package will return the error:

Code: Select all

avrdude: error: usbtiny_receive: error sending control message: Protocol error (expected 8, got -71)
The version I am running now uses my customized usbtiny.c, which is working fine on my other machine and simply includes the customizations for 64 bit systems mentioned in some other threads including my own previous thread. My version simply has everything written out neatly according to the coding standards I am familiar with (eg; when using a particular number multiple times, define it and use the definition to avoid errors and make its purpose apparent). My version is available at kuroi.net/avr/usbtiny.c. I know these modifications to be necessary because of the above error expecting 8 instead of 4. The interesting part is that no matter what we get -71.

This USBTiny unit functions perfectly fine using my other two development computers, so I am certain it is not a problem with the programmer.

Furthermore, the device ID is properly returned in lsusb, and detailed output up until the point the programmer is accessed is identical.

LibUSB is identical on both of my 64 bit boxes, and other USB devices using LibUSB function properly.

One other thing to note is the red status LED on the USBTiny unit. When I attempt to program, the LED turns on, and after the error shown at the top of this post is kicked out and I am returned to the terminal prompt the LED remains lit.

So, at this point I'm rather confused as to where to go. The -71 should be corresponding to an error code, but I have yet to be able to find where these error codes are listed. At this point I'm quite open to suggestions, and am quite curious as to weather anyone else has had the same problem and if anyone else has fixed it.

Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Re: Got -71?

Post by Zero »

It's been quite a while since I've touched my USBtinyISP, and I decided to take it out and see if everything had cleared up. Unfortunately it still gives me the same -71, this is on two new installations of Ubuntu x86-64, with AVRDude 5.6. I can confirm it still works on Windows, and one of the boxes I'm running it is the box I was using it on before when it still worked. I had a spare ATTiny2313 with the firmware flashed on it from when it was still working, and switching it out with the chip that was in there does no better. I guess it's a good thing I have 3 other programmers, but I really did like the USBtinyISP while it was working...

Anyone have any ideas? Has this problem arisen and been solved in the lapse I've been gone?

Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Re: Got -71?

Post by Zero »

It's been quite a while since I've touched my USBtinyISP, and I decided to take it out and see if everything had cleared up. Unfortunately it still gives me the same -71, this is on two new installations of Ubuntu x86-64, with AVRDude 5.6. I can confirm it still works on Windows, and one of the boxes I'm running it is the box I was using it on before when it still worked. I had a spare ATTiny2313 with the firmware flashed on it from when it was still working, and switching it out with the chip that was in there does no better. I guess it's a good thing I have 3 other programmers, but I really did like the USBtinyISP while it was working...

Anyone have any ideas? Has this problem arisen and been solved in the lapse I've been gone?

Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Re: Got -71?

Post by Zero »

It's been quite a while since I've touched my USBtinyISP, and I decided to take it out and see if everything had cleared up. Unfortunately it still gives me the same -71, this is on two new installations of Ubuntu x86-64, with AVRDude 5.6. I can confirm it still works on Windows, and one of the boxes I'm running it is the box I was using it on before when it still worked. I had a spare ATTiny2313 with the firmware flashed on it from when it was still working, and switching it out with the chip that was in there does no better. I guess it's a good thing I have 3 other programmers, but I really did like the USBtinyISP while it was working...

Anyone have any ideas? Has this problem arisen and been solved in the lapse I've been gone?

neutered
 
Posts: 43
Joined: Wed Dec 03, 2008 3:21 pm

Re: Got -71?

Post by neutered »

Zero wrote:Since nobody has mentioned the same error I'm about to detail I'm guessing it's isolated, but I'm going to document my progress and describe the error that I am getting so that if anyone else has the same problem they can hopefully get things fixed.

First off, the error I am getting:

Code: Select all

sudo avrdude -c usbtiny -p attiny2313 -e -U flash:w:ringclock.hex -P /dev/USBTiny

USB read error: expected 4, got -71
on my box here 71 would be EPROTO. this would usually mean that there is a protocol error talking to the device, but since you say it works on windows we can probably rule that out. more likely some structure isn't quite filled out right when doing one of the libusb calls.

\p

Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Re: Got -71?

Post by Zero »

neutered wrote:
Zero wrote:Since nobody has mentioned the same error I'm about to detail I'm guessing it's isolated, but I'm going to document my progress and describe the error that I am getting so that if anyone else has the same problem they can hopefully get things fixed.

First off, the error I am getting:

Code: Select all

sudo avrdude -c usbtiny -p attiny2313 -e -U flash:w:ringclock.hex -P /dev/USBTiny

USB read error: expected 4, got -71
on my box here 71 would be EPROTO. this would usually mean that there is a protocol error talking to the device, but since you say it works on windows we can probably rule that out. more likely some structure isn't quite filled out right when doing one of the libusb calls.

\p

That's quite informative, thank you very much. Can you tell me how you looked up the error code (EPROTO)? I somewhat recall digging around for this before but not finding it.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Got -71?

Post by adafruit »

try 5.6? it fixes the dumb 64bit bug
also, for clarity, run as root?

Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Re: Got -71?

Post by Zero »

ladyada wrote:try 5.6? it fixes the dumb 64bit bug
My original post about a year ago was using 5.5, but as you'll note my post which resurrected the thread notes I'm using 5.6. I also tried my own version that had worked before, but still nothing. Either something other than the Tiny2313 is bad or there is some sort of incompatibility with the newer Libusb or some other library. I'd be curious to hear from some other Ubuntu 64 users to hear if they have their ISPs working.
also, for clarity, run as root?
Of course.

I'm sorry I can't go further into diagnosis as I simply don't have the time at the moment. If I can get confirmation from someone that they have the USBtinyISP working on Ubuntu 8.10+ 64bit then it's probably safe to say I've somehow fried my USBtinyISP itself. Then again if that's the case why it would work in Windows...? For now I'm still thinking it's perhaps an incompatible Libusb or something along those lines.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Got -71?

Post by adafruit »

it may also be uhci vs ohci. in my lizard brain i remember there was a problem with those
search the forums?

neutered
 
Posts: 43
Joined: Wed Dec 03, 2008 3:21 pm

Re: Got -71?

Post by neutered »

Zero wrote:
neutered wrote:
Zero wrote:Since nobody has mentioned the same error I'm about to detail I'm guessing it's isolated, but I'm going to document my progress and describe the error that I am getting so that if anyone else has the same problem they can hopefully get things fixed.

First off, the error I am getting:

Code: Select all

sudo avrdude -c usbtiny -p attiny2313 -e -U flash:w:ringclock.hex -P /dev/USBTiny

USB read error: expected 4, got -71
on my box here 71 would be EPROTO.

That's quite informative, thank you very much. Can you tell me how you looked up the error code (EPROTO)? I somewhat recall digging around for this before but not finding it.
in tis case it happens to be the errno value. these are in <errno.h> (which turns into a rat's nest of includes ending up at <asm-generic/errno.h> for most linux builds). a handy way of tracking this down is to rebuild avrdude and update the error printf w/ a call to strerror(errno) so that you can see the text version of the error (rather tahn the # which can vary).

Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Re: Got -71?

Post by Zero »

neutered: Thank you very much, that is some extremely helpful information.

ladyada: ugh. Part of one of the two projects I'm on now is hardware based and we are using a very nice LCD character display that is currently wired up through a simple serial interface (using a level shifter). The thing is if we could do it over USB we could use the design in other applications and since we're going to have a massive crate of these things in about 6 months we may as well have a nice and flexible interface to them. I'll try using the usbTiny stuff to make a driver/interface for it and while doing that see if I can figure out what's going on. If I succeed hopefully I'll be able to retro-apply what I learned to the USBtinyISP and make that work on this box (assuming this isn't a hardware problem in the first place) and perhaps we can dodge a bullet if it is in fact a problem with the newer implementation of libusb or something else related.

... Perhaps I should also get another USBtinyISP and test that to make sure it isn't my hardware. Can you send to Japan?

Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Re: Got -71?

Post by Zero »

You know what, how would you like to sell in Japan? I can translate all the documentation, perhaps even manage a Japanese community. As long as I have a working programmer it shouldn't be a problem. There is a small but growing AVR community and the quality of DIY programmers here is relatively low. I also have a contact at Akidzuki, perhaps I could work out a deal with them. If you want to bring H8's and SH's to America that would also be a fantastic exchange and I'd love to translate everything out for that and get the H8/SH community going there. Ooh now I'm all excited.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Got -71?

Post by adafruit »

well, the usbtiny is due for an update. v3 is in the works :)

Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Re: Got -71?

Post by Zero »

Excellent. Care to consider a Japan release at V3? I have quite a bit of localization experience and would love to bring strengthen the AVR presence in Japan. At the same time I think America needs a good does of H8/SuperH/S32/the new RX's/ etc. From my personal experience I've come to the opinion that AVR are hands down the best small/open solutions especially for low pin, low power, high durability/flexibility stuff. But Atmel just doesn't have a solution that matches the intense awesomeness of the mid to upper range Renesas stuff. Renesas has some very, very cool devices that really define the Japanese Micro Controller. Atmel releasing the XMega series is exciting, but from what I have seen the XMega is very much a controller targeted at trying to match what the SH stuff has already been. Don't get me wrong, the XMega stuff looks awesome and I can't wait to use it, but to me a lot of that and more seems to already be available in the Renesas stuff.

Anyway, I'm off topic and rambling. I'll do my best to come back to all this once I've cleared out some work.

Zero
 
Posts: 30
Joined: Thu Jul 12, 2007 3:47 am

Re: Got -71?

Post by Zero »

I figured it out, very much by mistake. I have a USB cable I 've used for debugging things I wasn't completely comfortable with plugging straight into a USB port without protection. It basically just has a capacitor between the + a - lines. So, I was doing a prototype today and I couldn't get the board to program off of my AVRISPv2 and in an instant of desperation I grabbed the tinyisp and the nearest USB cable which was the one with the capacitor on it. I plugged it in and the tinyisp lit up, and then it started communicating with the chip when I did a quick "avrdude -c tiny2313 -p usbtiny". The thing is it cut out half way through the communication and I got a timer expired error. So I tried the whole setup with external power (5V from a regulator) and it worked. I tried another USB cable without a capacitor on it. It didn't work. The tinyisp isn't receiving enough power is my best guess, and I'm guessing that has something to do with how it is requesting it and how power was given out on older and newer versions of libusb. Although it's also possible the root problem may have something to do with my hardware as well, it's very possible the USB ports on my machines are made by the same company as they are both Japanese made (Fujitsu and Toshiba). I'm now using the tinyisp connected to a powered external USB hub with no visible problems. Anyway, if anyone has a similar problem: externally power the target (don't forget the jumper on the tinyisp!) and use a powered USB hub.

If you were curious, the problem with my board was there was a copper trace that ran into the trace next to it, so VCC and MISO were jumped. Had I done a few more poking with the continuity test I could have figured that out before hooking up a programmer to the board in the first place. Wheee!

Locked
Please be positive and constructive with your questions and comments.

Return to “USBtinyISP”