[Solved] Cannot burn bootloader w/ Tiny AVR Programmer on Linux (Windows works)

Hello,

EDIT 3: Solved. Needed to add a udev rule as documented here: AVRDUDE | USBtinyISP | Adafruit Learning System

EDIT 2: This appears to be a software issue. I was able to burn a bootloader on the first on a Windows machine, so something must be wrong with my Linux config. I changed the title of this thread accordingly. Any ideas?

I'm attempting to use a Tiny AVR Programmer[1] to burn a new bootloader to an Atmega328[2] via avrdude on Linux, but I'm running into some issues. Specifically, "initialization failed" from avrdude. I can upload sketches to the same Atmega328 chip via a USB FTDI breakout[3] so I think the chip itself is ok.

As for the physical connections, I'm connecting RESET, GND, VCC, MISO, MOSI, SCK to the Atmega via jumper wires, and I've confirmed the jumper wires are good. I've confirmed VCC is ~+5V. I've tried with and without a cap and pull-up resistor on the RESET pin of the Atmega. The Atmega itself has a 16mhz crystal between XTAL1 and XTAL2 with 2 caps to ground. Nothing else is connected. I've tried removing the crystal as well.

On the Tiny AVR Programmer side, I've tried connecting to the 2x3 ISP pins, the 1x6 programmer out pins, the prototyping pins, and the ATTiny socket pins itself.

In avrdude, I've tried using -pm328p and -pm328 instead of -patmega328p to no avail. The -F option also fails, and outputs a different device signature on every run. Looking at avrdude's source code, I suspect it has to do with a RESET. I have no idea how to debug this further though.

Here's the command output from avrdude:

$ sudo /usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega328p -cusbtiny -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

avrdude: Version 6.0.1, compiled on Oct 21 2013 at 15:55:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/***/.avrduderc"

         Using Port                    : usb
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 003:017
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         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] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

EDIT: I find that if I run the command continually, I randomly get this output instead, which leads me to believe it may be a clock issue:

avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [ac 53 53 02]
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00sCMD: [30 00 00 00] [00 00 00 00]
CMD: [30 00 01 00] [00 00 00 00]
Reading | #################                                  | 33% 0.00sCMD: [30 00 02 00] [00 00 00 00]
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000 (retrying)

Reading |                                                    | 0% 0.00sCMD: [30 00 00 00] [00 00 00 00]
CMD: [30 00 01 00] [30 00 01 00]
Reading | #################                                  | 33% 0.00sCMD: [30 00 02 00] [37 ff ff ff]
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x0000ff
avrdude: Expected signature for ATmega328P is 1E 95 0F
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

Any tips? Thank you!

[1] https://www.sparkfun.com/products/11801
[2] http://www.mouser.com/ProductDetail/Arduino/A000048/?qs=tbM5a8K56PVlawqT75jO/A==
[3] https://www.sparkfun.com/products/9716

Provide schematic for better understanding of your issue. Remember atmega328p has 2 vcc pins and 2 gnd pins you must connect them all. Cap and pull up resistor on reset pin is not neccesary. 16 mhz crystal is needed because as I see you have Arduino bootloader on the chip.

A photo of the circuit:

Imgur

Not pictured: The rails on the right are also connected.

nx1101:
A photo of the circuit:

http://imgur.com/0mSv40k

Not pictured: The rails on the right are also connected.

Well, if you dont solder that header to the tiny programmer, its possible that signal on pins wont be connected at all.

Maybe you should plug the wires to the already soldered on board headers, the ones that are on two rows of 4.

Hm I had no luck connecting to the dip8 socket, the prototype pins, or the programmer output pins. I’m using jumper wires to make these connections.

Do you have continuity tester? You have to check if pins on breadboard are connected to dip socket pins correctly. Sometimes breadboard doesnt connect very well.

Just checked. Continuity is good.

OK, so I was able to burn a bootloader via a Windows machine on the first try.

I wonder what's wrong in my Linux config?

nx1101:
OK, so I was able to burn a bootloader via a Windows machine on the first try.

I wonder what's wrong in my Linux config?

Nice.

And about linux, did you unlock usb port permission? At least for usbtinyisp you have to do that and some other stuff which are documented on adafruit.

That was it. I followed the instructions on adafruit[1] and now it works. Thank you very much for the help mart82.

[1] AVRDUDE | USBtinyISP | Adafruit Learning System