Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Pololu Avr Programmer v.2.1: avrdude: initialization failed, rc=-1

I am trying to write a basic program (An Arduino blinker sketch) to an atmega1284p stand-alone micro-controller chip, via ICSP/ISP, using a Pololu USB AVR Programmer v2.1. The Arduino IDE calls avrdude to write the image to the target (which I expect to have a bootloader installed upon fabrication).
Yes, support for this chip has been added to the Arduino IDE.
I followed the instructions at

and checked Troubleshooting at

and prepared Linux via

The write fails with the message:

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1

Yes, we’ve all seen this before, and there are some posts in this forum. But, none has helped. I am hoping that someone could give me a clue.

The programmer’s green LED lights up, and the red LED is off, and the yellow LEDs flash alternately, ‘moving’ across the board. I’ve managed to capture an extra-verbose output of avrdude. Does it seem to suggest an issue with the oscillator? AFAIK, all of these AVR chips have an internal oscillator at 8 MHz, I think. I am using the chip as stand-alone, with no external crystal; and it is powered independently at 5V.
If anyone can make sense of this, I’d be grateful. Thanks, in advance!

‘pavr2gui’, run on Linux says:

 "
 Error: Initial SPI command failed.
 The SPI command for entering programming mode was sent, but the expected
 response from the target was not received.  Make sure that the ISP frequency
 is less than one sixth of the target's clock frequency.
 "

but the ISP frequency is very low, as shown by ‘pavr2cmd -s’:

Name:                                    Pololu USB AVR Programmer v2.1
Serial number:                           00363785
Firmware version:                        1.02
Programming port:                        /dev/ttyACM0
TTL port:                                /dev/ttyACM1

Settings:
  ISP frequency (kHz):                   114
  Max ISP frequency (kHz):               1714
  Regulator mode:                        auto
  VCC output:                            Disabled
  VCC output indicator:                  Blinking
  Line A function:                       None
  Line B function:                       DTR
  VCC/VDD maximum range (mV):            896
  VCC 3.3 V minimum (mV):                2720
  VCC 3.3 V maximum (mV):                3872
  VCC 5 V minimum (mV):                  4128
  VCC 5 V maximum (mV):                  5856
  STK500 hardware version:               F
  STK500 software version:               2.A

Results from last programming:
  Programming error:                     Initial SPI command failed.
  Target VCC measured minimum (mV):      4992
  Target VCC measured maximum (mV):      5088
  Programmer VDD measured minimum (mV):  4832
  Programmer VDD measured maximum (mV):  4864

Current status:
  Target VCC (mV):                       1792
  Programmer VDD (mV):                   3296
  VDD regulator set point:               3.3 V
  Last device reset:                     Power-on reset

The output of avrdude, at extra-verbose, is:

/usr/local/arduino-1.8.7/hardware/tools/avr/bin/avrdude -C/usr/local/arduino-1.8.7/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega1284p -cstk500 -P/dev/ttyACM0 -Uflash:w:/tmp/arduino_build_504075/Blink_moded.ino.hex:i

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/usr/local/arduino-1.8.7/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/honolulu/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : stk500
avrdude: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0b] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [08] 
avrdude: Recv: S [53] 
avrdude: Recv: T [54] 
avrdude: Recv: K [4b] 
avrdude: Recv: 5 [35] 
avrdude: Recv: 0 [30] 
avrdude: Recv: 0 [30] 
avrdude: Recv: _ [5f] 
avrdude: Recv: 2 [32] 
avrdude: Recv: . [02] 
avrdude: stk500v2_getsync(): found STK500 programmer
         AVR Part                      : ATmega1284P
         Chip Erase delay              : 55000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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    10   128    0 no       4096    8      0  9000  9000 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0xff 0xff
                                  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  9000  9000 0x00 0x00
                                  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  9000  9000 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  9000  9000 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  9000  9000 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
                                  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

         Programmer Type : STK500V2
         Description     : Atmel STK500
         Programmer Model: STK500
avrdude: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [02] 
avrdude: Recv: . [00] 
avrdude: Recv: . [03] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0f] 
avrdude: Recv: . [18] 
avrdude: Send: . [1b] . [03] . [00] . [02] . [0e] . [03] . [91] . [86] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: . [03] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: . [02] 
avrdude: Recv: . [14] 
avrdude: Send: . [1b] . [04] . [00] . [02] . [0e] . [03] . [92] . [82] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [04] 
avrdude: Recv: . [00] 
avrdude: Recv: . [03] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0a] 
avrdude: Recv: . [1b] 
         Hardware Version: 15
         Firmware Version Master : 2.10
avrdude: Send: . [1b] . [05] . [00] . [02] . [0e] . [03] . [9a] . [8b] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [05] 
avrdude: Recv: . [00] 
avrdude: Recv: . [03] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: . [ff] 
avrdude: Recv: . [ef] 
         Topcard         : Unknown
avrdude: Send: . [1b] . [06] . [00] . [02] . [0e] . [03] . [94] . [86] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [06] 
avrdude: Recv: . [00] 
avrdude: Recv: . [03] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: 3 [33] 
avrdude: Recv:   [20] 
         Vtarget         : 5.1 V
avrdude: Send: . [1b] . [07] . [00] . [02] . [0e] . [03] . [98] . [8b] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [07] 
avrdude: Recv: . [00] 
avrdude: Recv: . [03] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: . [02] 
avrdude: Recv: . [10] 
avrdude: Send: . [1b] . [08] . [00] . [02] . [0e] . [03] . [95] . [89] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [08] 
avrdude: Recv: . [00] 
avrdude: Recv: . [03] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [1d] 
avrdude: Send: . [1b] . [09] . [00] . [02] . [0e] . [03] . [96] . [8b] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [09] 
avrdude: Recv: . [00] 
avrdude: Recv: . [03] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [1c] 
avrdude: Send: . [1b] . [0a] . [00] . [02] . [0e] . [03] . [97] . [89] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [0a] 
avrdude: Recv: . [00] 
avrdude: Recv: . [03] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [03] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [1f] 
         SCK period      : 8.7 us
         Varef           : 0.0 V
         Oscillator      : Off

avrdude: Send: . [1b] . [0b] . [00] . [03] . [0e] . [02] . [9e] . [01] . [80] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [0b] 
avrdude: Recv: . [00] 
avrdude: Recv: . [02] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [02] 
avrdude: Recv: . [00] 
avrdude: Recv: . [1e] 
avrdude: Send: . [1b] . [0c] . [00] . [0c] . [0e] . [10] . [c8] d [64] . [19]   [20] . [00] S [53] . [03] . [ac] S [53] . [00] . [00] ? [3f] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [0c] 
avrdude: Recv: . [00] 
avrdude: Recv: . [02] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [10] 
avrdude: Recv: . [c0] 
avrdude: Recv: . [cb] 
avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: Send: . [1b] . [0d] . [00] . [03] . [0e] . [11] . [01] . [01] . [0a] 
avrdude: Recv: . [1b] 
avrdude: Recv: . [0d] 
avrdude: Recv: . [00] 
avrdude: Recv: . [02] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [11] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0b] 

avrdude done.  Thank you.

Hello.

I am sorry to hear you are having trouble programming your ATmega1284P chip using the Pololu USB AVR Programmer v2.1. Can you post pictures clearly showing how you have the AVR programmer connected to your ATmega1284P chip and the rest of your setup? Which Arduino hardware support package or settings did you use to add support for the ATmega1284 in your Arduino IDE?

It looks like the AVR programmer is reading the target VCC as 1792 mV, which seems weird. Was the AVR programmer connected to the ATmega1284P chip and was the chip powered before you ran pavr2cmd -s?

- Amanda

Hi! Thanks for the reply.
I might’ve managed to achieve a write, but I’m still in the process of verifying it. Once that happens, I will post an update.
The problem certainly was that I was using the target as a stand-alone chip, which is a no-no. An earlier attempt, with a proper application circuit, had failed as well, which is why I tried an, uh, simpler approach!

As for the voltage, the 1792 mV was after the test had failed; likely, I’d turned off the power by then. You can see that the last test’s “measured” voltage was rightly 5v. The chip was independently powered.
Thanks again! I will update later.