Skip to main content
Topic: avrdude: initialization failed, rc=-2 (Read 46509 times) previous topic - next topic

avrdude: initialization failed, rc=-2

Hello!.I buy a new buspirate v3b.  I need help with avrdude 5.10 and buspirate Firmawate 5.10. Don't work buspirate with avrdude?
When i try program atmega328p , in Windows or Linux, I see alwais "avrdude: initialization failed, rc=-2"
The test command in buspirate its ok.  Help, please.

Re: avrdude: initialization failed, rc=-2

Reply #1
Can you copy and paste your output?  

Off the top of my head, I think you have the right versions of avrdude and the bus pirate firmware.

There are two common error cases for "initialization failed, rc=..."

1. AVRdude can't talk to the programmer.   Which could be you don't have the right port, or you have one of the bad combinations of avrdude and buspirate firmware"

2. AVRdude isn't getting responses from the target avr.   You don't have it wired correctly or it's a bad chip, wrong target type, etc.

Re: avrdude: initialization failed, rc=-2

Reply #2
[quote author="rct"]
2. AVRdude isn't getting responses from the target avr.   You don't have it wired correctly or it's a bad chip, wrong target type, etc.
[/quote]

Forgot to mention this class of error can also occur if your fuse settings aren't correct/don't match your target environment.  For example, if you've set the fuses to use an external crystal / resonator as a clock source, but don't have one during programming.

Note: I've seen some instructions for programming the Arduino boot loader onto a fresh ATmega chip that set the fuses first and program the chip second.  If you are doing this with the bare chip connected to the programmer, the first step setting the fuses will succeed, however the 2nd step will then fail because you've now programmed the chip to operate with a 16 mhz clock that doesn't exist.   So to be able to talk to the chip again, you need to connect a clock source or place it in an arduino style board and connect to the isp connector.    Reversing the instructions so you program the bootloader first, and then change the fuses last once you are sure you are done programming.

Hope this helps,
--Rob

Re: avrdude: initialization failed, rc=-2

Reply #3
I try to program arduino board with ISCP the avrdude answere is:

Note: Can be damaged by bad wiring connections?. Is that the wire first confused me, because on the web there are two schemes, the Sparkfun and the SeedStudio and chose the wrong first

administrador@ubuntu:~$ sudo avrdude -P /dev/ttyUSB0 -c buspirate -p m328p -v

avrdude: Version 5.10, compiled on Jun 29 2010 at 03:44:14
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/administrador/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : buspirate
         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     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : BusPirate
         Description     : The Bus Pirate

Detecting BusPirate...
avrdude: buspirate_readline(): #
avrdude: buspirate_readline(): RESET
avrdude: buspirate_readline():
** 
avrdude: buspirate_readline(): Bus Pirate v3b
**  Bus Pirate v3b
avrdude: buspirate_readline(): Firmware v5.10 (r559)  Bootloader v4.4
**  Firmware v5.10 (r559)  Bootloader v4.4
avrdude: buspirate_readline(): DEVID:0x0447 REVID:0x3043 (24FJ64GA002 B5)
**  DEVID:0x0447 REVID:0x3043 (24FJ64GA002 B5)
avrdude: buspirate_readline(): http://dangerousprototypes.com
**  http://dangerousprototypes.com
avrdude: buspirate_readline(): HiZ>
**
BusPirate: using BINARY mode
BusPirate binmode version: 1
BusPirate SPI version: 1
avrdude: initialization failed, rc=-2
         Double check connections and try again, or use -F to override
         this check.

BusPirate is back in the text mode

avrdude done.  Thank you.

Re: avrdude: initialization failed, rc=-2

Reply #4
That looks pretty good. It makes it to the correct mode. I'm not sure what the next step is, maybe it is configuring SPI and gets an error? What happens if you use -F to override?
Got a question? Please ask in the forum for the fastest answers.

Re: avrdude: initialization failed, rc=-2

Reply #5
Hello. I solve the problem powering de avr with 3.3V from de buspirate instead 5V.
Thanks

Re: avrdude: initialization failed, rc=-2

Reply #6
Hi.  I am getting the same problem, but for a different reason I think.  My bus pirate only powers up my avr for a few hundred milliseconds.  I have also tried applying external power to the board, both 3 and 5 volts from the bus pirate and my external power supply.  Any guesses or thoughts as to why?  Below is an output of my error. except without links as spam filter is yelling at me


avrdude -v -F  -c buspirate -p m328p -P /dev/buspirate -b 115200 -B 10

avrdude: Version 5.10, compiled on Jun 27 2010 at 00:38:29
        Copyright (c) 2000-2005 Brian Dean,
        Copyright (c) 2007-2009 Joerg Wunsch

        System wide configuration file is "/etc/avrdude.conf"
        User configuration file is "/home/mog/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/buspirate
        Using Programmer              : buspirate
        Overriding Baud Rate          : 115200
        Setting bit clk period        : 10.0
        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    5    4    0 no      1024    4      0  3600  3600 0xff 0xff
          flash        65    6  128    0 yes    32768  128    256  4500  4500 0xff 0xff
          lfuse          0    0    0    0 no          1    0      0  4500  4500 0x00 0x00
          hfuse          0    0    0    0 no          1    0      0  4500  4500 0x00 0x00
          efuse          0    0    0    0 no          1    0      0  4500  4500 0x00 0x00
          lock          0    0    0    0 no          1    0      0  4500  4500 0x00 0x00
          calibration    0    0    0    0 no          1    0      0    0    0 0x00 0x00
          signature      0    0    0    0 no          3    0      0    0    0 0x00 0x00

        Programmer Type : BusPirate
        Description    : The Bus Pirate

Detecting BusPirate...
avrdude: buspirate_readline(): #
avrdude: buspirate_readline(): RESET
avrdude: buspirate_readline():
** 
avrdude: buspirate_readline(): Bus Pirate v3a
**  Bus Pirate v3a
avrdude: buspirate_readline(): Firmware v5.10 (r559)  Bootloader v4.4
**  Firmware v5.10 (r559)  Bootloader v4.4
avrdude: buspirate_readline(): DEVID:0x0447 REVID:0x3046 (24FJ64GA002 B8)
**  DEVID:0x0447 REVID:0x3046 (24FJ64GA002 B8)
avrdude: buspirate_readline():
** 
avrdude: buspirate_readline(): HiZ>
**
BusPirate: using BINARY mode
BusPirate binmode version: 1
BusPirate SPI version: 1
avrdude: initialization failed, rc=-2
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
BusPirate is back in the text mode

avrdude done.  Thank you.

Re: Re: avrdude: initialization failed, rc=-2

Reply #7
Hi mogorman,

I'm sorry, I missed this post on an old thread.

Here's a few things to check:
*Are the wiring connections correct? Wrong power connection could short the power supplies and programming would fail.
*Is there a short circuit on the target board, or is it a very heavy load? The Bus Pirate power supplies will turn off automatically if the voltage does not rise to a safe level after a few milliseconds. That is consistent with your problem.
Got a question? Please ask in the forum for the fastest answers.

Re: avrdude: initialization failed, rc=-2

Reply #8
I had this problem and it was because of wrong wiring.

Specifically, it was using the sandboxelectronics bus pirate with its included ribbon cable and assuming the colors matched. They don't. You need to look at the pin out for the sandboxelectronics bus pirate (also available from serial connection to it and issue a command, I forget which, to show the pin outs and colors)..

If Initialization failed rc=-2 it means the target chip could not be put into programming mode, which usually means the wiring is not correct.

Re: avrdude: initialization failed, rc=-2

Reply #9
Quote
bus pirate with its included ribbon cable and assuming the colors matched.
Can you please tell the difference from the original wiring?
It's surprising to see it doesn't match since I tested SPI with 595 IC and it worked as expected,
so power pins as well as MOSI/CLK/CS are where they should be (as listed per 'v' command).

I have the same problem with BP from Sandbox Electronics.
It can't see my atmega168/328's or attiny13/2313's.

BP version info:
Quote
Bus Pirate v3b
Firmware v5.10 (r559)  Bootloader v4.4

Avrdude 5.11.1 (also tested with 5.10). I'm not sure if the two are compatible to each other.

Re: Re: avrdude: initialization failed, rc=-2

Reply #10
when I typed "it was using" I meant to say "I was using'.

So I was using the sandbox electronics bus pirate, and getting that error so I just connected to it and used the command (I forget which) to dump the cable colors and wires, then followed those, ignoring the particular instructions i had in front of me which showed a picture of the dangerous prototypes bus pirate and its included ribbon cable colors and how they hooked up to the device in question.
The end result was very different to someone using the authentic bus pirate and I can't remember the details but it wasn't the case of a swapped color or anything, nearly everything, or entirely everything was different.

Re: avrdude: initialization failed, rc=-2

Reply #11
I'm so confused. When I type 'v' my BP from Sandbox electronics shows the exact same pinout as the original BP:
Code: [Select]
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND    3.3V    5.0V    ADC    VPU    AUX    CLK    MOSI    CS      MISO
That's what I used to wire up to my AVR chips, too.

Re: Re: avrdude: initialization failed, rc=-2

Reply #12
Quote
When I type 'v' my BP from Sandbox electronics shows the exact same pinout as the original BP:

I don't know the pinout of the SE bus pirate, but it uses our firmware so the pinout display is going to be exactly the same as any other Bus Pirate. No saying if their cable actually aligns with the pinout table in our firmware.

@arup - are you sure the chip @5volts can be programmed by a 3.3volt programmer? What happens if the whole system is powered at 3.3volts?

I'll try to test out the avrdude compat with a ATINY13A tomorrow. You might also try asking for help from AVRDude or the author(s) of the avrdude Bus Pirate patch.
Got a question? Please ask in the forum for the fastest answers.

Re: avrdude: initialization failed, rc=-2

Reply #13
It does align, the pinout is the same, SPI works, programming AVR's doesn't :(

Re: Re: avrdude: initialization failed, rc=-2

Reply #14
I gave away my attiny13a dev board (old christmas card). I will dig up an arduino and try that, but I am out of the office until early next week.
Got a question? Please ask in the forum for the fastest answers.