Hi,
This is my first post here...
I recently bought a Sparkfun AVR Pocket Programmer (USBtiny clone) in order to program my Arduino Uno boards (and other bare AVRs) without the need of a bootloader and not having to hook up another Arduino as ISP either.
AVRDUDE gives me the "initialization failed, rc=-1" error. BUT it is definitely NOT a cable connection problem.
Now bear with me a bit longer on this one. I have 4 Arduino boards: 2 italian UNO r3 a Leonardo and a Genuino Micro. I am able to program the Leonardo and the Micro with my USBtiny but not the UNOs(both fail the same way).
I also was able to program an Atmega324p on a breadboard and a breadboard Arduino with 328p running at 16MHz. (like a UNO).
I happen to have an AtmelICE and the UNOs (the boards) are programmable through the ICSP header with that programmer. They also work with a bootloader too. So they are alive and well.
I feel i'm missing something obvious.
Why i can't program my UNO R3 boards? What is the difference? How can i fix it?
I am not expecting an answer like to use my AtmelICE or pop out the 328p and program it on a breadboard. Why my programmer can not do its job while it can on other boards.
Can you still bootload to the Uno's? Perhaps they are bricked, it happens. The one really bad thing about using an ISP tool is since it can set fuses it can make bricks. Save the bricks, cause they can be fixed in parallel programming mode, with a tool like an AVR Dragon (but don't overuse the Dragon cause the USB connector will fall off).
Thank you for your answer Ron, but as i already wrote: both UNOs feel fine. Programmable through ICSP with my "serious" programmer and through the bootloader works well too.
The thing is i never was able to even read the fuses on the UNO, avrdude reports no contact.
At first i almost contacted the retailer to report a faulty programmer but after a few tries i realised it works without problems with other stuff.
It seems to be a popular little programmer and i was surprised no one else had the same problem, that is why i think i might be missing something obvious.
If someone with the same programmer could chime in to compare or test stuff would be also great.
On Linux (Debian based), I think sudo would be needed because it is a USB device... avrdude will use libusb to control it, it is not a serial bridge. Do you also have Atmel Studio on the computer? As it turns out my Dragon uses libusb on Linux and works fine with avrdude, but on Windows, it will not work with avrdude because I'm not willing to mess with the libusb stuff (it is a security thing). I am guessing you are using Windows and that makes for a fun time sorting out what needs libusb to work properly. You can find a lot more about this sort of stuff at http://www.avrfreaks.net/
This response from avrdude means that it can talk to the programmer but the programmer can't talk to the chip.
Some stuff to check:
Are the cables attached properly?
Are the cables in backwards? (The red wire should be at the #1 spot)
Is the green light on, indicating USB enumeration was successful? (note with some Macs it appears the green light only turns on after Avrdude talks to the programmer, weird!)
Is the driver installed (windows)?
Is the device plugged into a target board? (I.e. is it connected to a chip)
Is the target chip powered?
Does the target chip need a crystal? is the crystal oscillating?
Are you trying to provide 5V USB power to a device that is already powered?
Other stuff plugged into the Arduino? Remove and try again.
@ron_sutherland: the avrdude command looks allright.
I have AVR Studio installed because of my AtmelICE.
The programmer seems to be working with other boards so i guess the software side is probably ok.
My suspicion is the UNO R3's reset circuit is to blame but it is a wild guess... Especially since the programmer is demostrated on a UNO...
The other stuff i am able to program with the USBTiny don't have a separate USB2serial or does not have one at all. That is the only difference i could find between working and not working.
@tf68: i think most of the questions got answered in my first post since other boards i can reliably program. There is one particular TYPE that does not work, the Arduino UNO R3(genuine afaik).
I have two such boards and both fail to communicate with this particular programmer. Otherwise both are fully functional and programmable with AtmelICE or through the bootloader. (tested)
I changed the USB AND the flat cables. Tried manually reset the board to get a test reading, no succes. (it worked on my breadboard project). Tried to power it via the programmer (there is a jumper for power target) and via the UNO's barrel connector, no success.
I can see the board going into programming mode as the programmer grounds the reset pin and led 13 stays on. I see the programmer sends but never get an answer.
The board is not connected to any circuit either.
In case someone faces the same problem...
It turned out that the programmer was faulty. The RST pin in the programmers ISP header was shorted to GND. The reset pin should be pulled to ground to program that is why it partially worked but never released the reset pin and failed on the UNO because of its peculiar reset circuit.
Got a replacement and it works without any problems.
Yeah, that is aggravating. I once got a Lilypad from Sparkfun, but it had no bootloader installed so sketches couldn't be loaded, and it did not have the SPI pins brought out so a bootloader couldn't be loaded.
They sent me a replacement, and since then I got a TQFP adapter that presses in place over a chip so I can load SMD 328s now: