*sigh* RC=-1

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

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
wcoggeshall
 
Posts: 5
Joined: Mon Mar 25, 2013 9:52 pm

*sigh* RC=-1

Post by wcoggeshall »

I feel guilty about posting two threads for the same problem, but I could use some help. I am using a usbtiny that I have been able to use to program an attiny2313 before. What does "programmer operation not supported" mean here? What operation? I also noticed that, even with the power-to-target jumper off, enough power is still supplied to the vcc pin to run the power-on led on my breadboard. The wires are fine, (I won't make that mistake again) and I have tried both external and usbtiny power, and on two different breadboards. I'm at the end of my rope.

Code: Select all

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [ac 53 00 00]
CMD: [ac 53 00 00] [ac 53 00 00]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.
This is when running as root. When not root, I get an error that I do not have permission to send control messages.

mrcity
 
Posts: 8
Joined: Mon May 20, 2013 8:05 pm

Re: *sigh* RC=-1

Post by mrcity »

The "programmer operation not supported" tends to happen a lot to me too, but doesn't affect what I'm doing. If you're interested, you could look at avrdude.c and find out all the places where it says that, then come up with your own custom error strings and recompile. :wink: Not sure that'd really be worth all the trouble though.

I'm not exactly sure what your command is, but if you're just running "avrdude -c usbtiny -p <processor> -vvvv", you might throw a -F in there and see if it'll give you an idea of what it thinks the device signature is. (At least I hope the attiny2313 has a standard type of device signature.) When I was getting rc=-1, it was usually because the signature was returned as basically random noise from across the line (such as 0x30a007) and would change each time I ran it. You might get the same rc=-1 if the device signature is read back as 0xffffff. What solved it for me was adding in an external clock -- somehow my fuse bits got corrupted and I had to add a clock in order for my chips to come back to life.

Note: I'm sure the Powers That Be might frown upon my speaking of -F; you should certainly avoid using it when you actually intend to write to the chip, as unpredictable things can happen.

There are 2 ways you can provide a clock:
1) (simple) Use another Arduino to generate a clock on an output pin.
2) (could be simpler or more advanced depending on your experience -- but you will brick your chip if not careful) Set the fuse bit CKOUT=0 so one of your output pins will output the chip's clock. If you haven't used ATmega fuses before, now might not be such a good time to attempt this. :wink:

If you need help with this, I can post some solid example code. One caveat is at the end of your loop(), there are some additional instructions executed before it begins the loop again, so on an oscilloscope, the last cycle in the loop will appear much longer than the others, and if you only write 1 cycle, it'll stay HIGH or LOW a lot longer than the other. Thus I made my loop contain many cycles before it ended. Even though the oscilloscope said my fake clock was only running at 4MHz, it still worked well enough for me to rescue one of my chips once. :P

If it turns out that a clock solves your problem, then you should research fuses specifically for your attiny2313 (as most every Atmel product uses different fuse settings) and find out how to make it use an internal clock if you so desire. It's certainly feasible that your chip was programmed to need an external oscillator or crystal, in which case you'd want to hook up the XTAL1 and/or XTAL2 port of your attiny2313 to the clock output of whatever chip that's serving as your oscillator. And, while some might regard this as sloppy, I don't tend to bother with capacitors when I'm hooking up a clock in this manner.

Best,
- Stephen

wcoggeshall
 
Posts: 5
Joined: Mon Mar 25, 2013 9:52 pm

Re: *sigh* RC=-1

Post by wcoggeshall »

Thanks for the advice. I tried running avrdude with -F, I just got 0x00000000. I'll give reprogramming the fuse bits a try, but if I can't write the flash, how can I write the fuses?

mrcity
 
Posts: 8
Joined: Mon May 20, 2013 8:05 pm

Re: *sigh* RC=-1

Post by mrcity »

Given that it's showing 0x000000, it seems like you have decent electrical connections but just can't get the communication to work properly. I'd suggest searching around the Interwebs to find what other people have done in this case.

One thing you might try is
avrdude -c usbtiny -p attiny2313 -B 5 -vvvv
A -B value of >1 slows down AVRDUDE's communication clock speed and may help you reach the chip. If this works, you might consider examining the fuses to find out what the chip's clock speed is, and increase it if desired.

Unless you can get communication working without a doubt, I wouldn't attempt to reprogram the fuses.

- Stephen

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

Return to “USBtinyISP”